Add appropriate preprocessor defines to avoid building Eigen kernels when building with kernel generator enabled.

PiperOrigin-RevId: 356464517
Change-Id: I21c8f0a287585b9a9da6acd0a1adbc1955eb965d
This commit is contained in:
Stephan Herhut 2021-02-09 03:25:59 -08:00 committed by TensorFlower Gardener
parent 1b41b5a30d
commit 8b2448df19
18 changed files with 79 additions and 8 deletions

View File

@ -19,7 +19,10 @@ limitations under the License.
namespace tensorflow {
namespace functor {
#if !defined(MLIR_GENERATED_GPU_KERNELS_ENABLED) || \
!defined(MLIR_GENERATED_EXPERIMENTAL_KERNELS_ENABLED)
DEFINE_BINARY2(atan2, float, double);
#endif
} // namespace functor
} // namespace tensorflow

View File

@ -19,8 +19,13 @@ limitations under the License.
namespace tensorflow {
namespace functor {
#if !defined(MLIR_GENERATED_GPU_KERNELS_ENABLED) || \
!defined(MLIR_GENERATED_EXPERIMENTAL_KERNELS_ENABLED)
DEFINE_BINARY8(bitwise_and, int8, int16, int32, int64, uint8, uint16, uint32,
uint64);
#else
DEFINE_BINARY4(bitwise_and, uint8, uint16, uint32, uint64);
#endif
} // namespace functor
} // namespace tensorflow

View File

@ -19,8 +19,13 @@ limitations under the License.
namespace tensorflow {
namespace functor {
#if !defined(MLIR_GENERATED_GPU_KERNELS_ENABLED) || \
!defined(MLIR_GENERATED_EXPERIMENTAL_KERNELS_ENABLED)
DEFINE_BINARY8(bitwise_or, int8, int16, int32, int64, uint8, uint16, uint32,
uint64);
#else
DEFINE_BINARY4(bitwise_or, uint8, uint16, uint32, uint64);
#endif
} // namespace functor
} // namespace tensorflow

View File

@ -19,8 +19,13 @@ limitations under the License.
namespace tensorflow {
namespace functor {
#if !defined(MLIR_GENERATED_GPU_KERNELS_ENABLED) || \
!defined(MLIR_GENERATED_EXPERIMENTAL_KERNELS_ENABLED)
DEFINE_BINARY8(bitwise_xor, int8, int16, int32, int64, uint8, uint16, uint32,
uint64);
#else
DEFINE_BINARY4(bitwise_xor, uint8, uint16, uint32, uint64);
#endif
} // namespace functor
} // namespace tensorflow

View File

@ -19,8 +19,13 @@ limitations under the License.
namespace tensorflow {
namespace functor {
#if !defined(MLIR_GENERATED_GPU_KERNELS_ENABLED) || \
!defined(MLIR_GENERATED_EXPERIMENTAL_KERNELS_ENABLED)
DEFINE_BINARY10(div, Eigen::half, float, double, uint8, uint16, int16, int32,
int64, complex64, complex128);
#else
DEFINE_BINARY4(div, uint8, uint16, complex64, complex128);
#endif
DEFINE_BINARY5(div_no_nan, Eigen::half, float, double, complex64, complex128);
} // namespace functor
} // namespace tensorflow

View File

@ -19,8 +19,14 @@ limitations under the License.
namespace tensorflow {
namespace functor {
#if !defined(MLIR_GENERATED_GPU_KERNELS_ENABLED) || \
!defined(MLIR_GENERATED_EXPERIMENTAL_KERNELS_ENABLED)
DEFINE_BINARY10(equal_to, float, Eigen::half, double, uint8, int8, int16, int64,
complex64, complex128, bool);
#else
DEFINE_BINARY3(equal_to, uint8, complex64, complex128);
#endif
DEFINE_APPROXIMATE_EQUAL2(float, double);
} // namespace functor
} // namespace tensorflow

View File

@ -19,8 +19,13 @@ limitations under the License.
namespace tensorflow {
namespace functor {
#if !defined(MLIR_GENERATED_GPU_KERNELS_ENABLED) || \
!defined(MLIR_GENERATED_EXPERIMENTAL_KERNELS_ENABLED)
DEFINE_BINARY10(greater, Eigen::half, float, double, int64, uint8, uint16,
uint32, uint64, int8, int16);
#else
DEFINE_BINARY4(greater, uint8, uint16, uint32, uint64);
#endif
} // namespace functor
} // namespace tensorflow

View File

@ -19,8 +19,13 @@ limitations under the License.
namespace tensorflow {
namespace functor {
#if !defined(MLIR_GENERATED_GPU_KERNELS_ENABLED) || \
!defined(MLIR_GENERATED_EXPERIMENTAL_KERNELS_ENABLED)
DEFINE_BINARY10(greater_equal, Eigen::half, float, double, int64, uint8, uint16,
uint32, uint64, int8, int16);
#else
DEFINE_BINARY4(greater_equal, uint8, uint16, uint32, uint64);
#endif
} // namespace functor
} // namespace tensorflow

View File

@ -19,8 +19,13 @@ limitations under the License.
namespace tensorflow {
namespace functor {
#if !defined(MLIR_GENERATED_GPU_KERNELS_ENABLED) || \
!defined(MLIR_GENERATED_EXPERIMENTAL_KERNELS_ENABLED)
DEFINE_BINARY10(less, Eigen::half, float, double, int64, uint8, uint16, uint32,
uint64, int8, int16);
#else
DEFINE_BINARY4(less, uint8, uint16, uint32, uint64);
#endif
} // namespace functor
} // namespace tensorflow

View File

@ -19,8 +19,13 @@ limitations under the License.
namespace tensorflow {
namespace functor {
#if !defined(MLIR_GENERATED_GPU_KERNELS_ENABLED) || \
!defined(MLIR_GENERATED_EXPERIMENTAL_KERNELS_ENABLED)
DEFINE_BINARY10(less_equal, Eigen::half, float, double, int64, uint8, uint16,
uint32, uint64, int8, int16);
#else
DEFINE_BINARY4(less_equal, uint8, uint16, uint32, uint64);
#endif
} // namespace functor
} // namespace tensorflow

View File

@ -19,11 +19,14 @@ limitations under the License.
namespace tensorflow {
namespace functor {
#if !defined(MLIR_GENERATED_GPU_KERNELS_ENABLED) || \
!defined(MLIR_GENERATED_EXPERIMENTAL_KERNELS_ENABLED)
template struct BinaryFunctor<GPUDevice, logical_and, 1>;
template struct BinaryFunctor<GPUDevice, logical_and, 2>;
template struct BinaryFunctor<GPUDevice, logical_and, 3>;
template struct BinaryFunctor<GPUDevice, logical_and, 4>;
template struct BinaryFunctor<GPUDevice, logical_and, 5>;
#endif
} // namespace functor
} // namespace tensorflow

View File

@ -19,11 +19,14 @@ limitations under the License.
namespace tensorflow {
namespace functor {
#if !defined(MLIR_GENERATED_GPU_KERNELS_ENABLED) || \
!defined(MLIR_GENERATED_EXPERIMENTAL_KERNELS_ENABLED)
template struct BinaryFunctor<GPUDevice, logical_or, 1>;
template struct BinaryFunctor<GPUDevice, logical_or, 2>;
template struct BinaryFunctor<GPUDevice, logical_or, 3>;
template struct BinaryFunctor<GPUDevice, logical_or, 4>;
template struct BinaryFunctor<GPUDevice, logical_or, 5>;
#endif
} // namespace functor
} // namespace tensorflow

View File

@ -22,6 +22,8 @@ namespace functor {
#if !defined(MLIR_GENERATED_GPU_KERNELS_ENABLED) || \
!defined(MLIR_GENERATED_EXPERIMENTAL_KERNELS_ENABLED)
DEFINE_BINARY6(maximum, Eigen::half, float, double, uint8, int16, int64);
#else
DEFINE_BINARY1(maximum, uint8);
#endif
} // namespace functor
} // namespace tensorflow

View File

@ -22,6 +22,8 @@ namespace functor {
#if !defined(MLIR_GENERATED_GPU_KERNELS_ENABLED) || \
!defined(MLIR_GENERATED_EXPERIMENTAL_KERNELS_ENABLED)
DEFINE_BINARY6(minimum, Eigen::half, float, double, uint8, int16, int64);
#else
DEFINE_BINARY1(minimum, uint8);
#endif
} // namespace functor
} // namespace tensorflow

View File

@ -19,9 +19,11 @@ limitations under the License.
namespace tensorflow {
namespace functor {
DEFINE_BINARY11(mul, Eigen::half, float, double, uint8, uint32, int8, uint16,
int16, int32, int64, complex64);
DEFINE_BINARY2(mul, uint64, complex128);
#if !defined(MLIR_GENERATED_GPU_KERNELS_ENABLED) || \
!defined(MLIR_GENERATED_EXPERIMENTAL_KERNELS_ENABLED)
DEFINE_BINARY7(mul, Eigen::half, float, double, int8, int16, int32, int64);
#endif
DEFINE_BINARY6(mul, uint8, uint32, uint16, uint64, complex64, complex128);
DEFINE_BINARY5(mul_no_nan, Eigen::half, float, double, complex64, complex128);
} // namespace functor
} // namespace tensorflow

View File

@ -19,8 +19,13 @@ limitations under the License.
namespace tensorflow {
namespace functor {
DEFINE_BINARY10(not_equal_to, float, Eigen::half, double, uint8, int8, int16,
int64, complex64, complex128, bool);
#if !defined(MLIR_GENERATED_GPU_KERNELS_ENABLED) || \
!defined(MLIR_GENERATED_EXPERIMENTAL_KERNELS_ENABLED)
DEFINE_BINARY7(not_equal_to, float, Eigen::half, double, int8, int16, int64,
bool);
#endif
DEFINE_BINARY3(not_equal_to, uint8, complex64, complex128);
} // namespace functor
} // namespace tensorflow

View File

@ -19,9 +19,11 @@ limitations under the License.
namespace tensorflow {
namespace functor {
DEFINE_BINARY9(sub, Eigen::half, float, double, int64, complex64, complex128,
uint8, uint16, uint32);
DEFINE_BINARY1(sub, uint64);
#if !defined(MLIR_GENERATED_GPU_KERNELS_ENABLED) || \
!defined(MLIR_GENERATED_EXPERIMENTAL_KERNELS_ENABLED)
DEFINE_BINARY4(sub, Eigen::half, float, double, int64);
#endif
DEFINE_BINARY6(sub, complex64, complex128, uint8, uint16, uint32, uint64);
} // namespace functor
} // namespace tensorflow

View File

@ -19,7 +19,10 @@ limitations under the License.
namespace tensorflow {
namespace functor {
#if !defined(MLIR_GENERATED_GPU_KERNELS_ENABLED) || \
!defined(MLIR_GENERATED_EXPERIMENTAL_KERNELS_ENABLED)
DEFINE_BINARY2(zeta, float, double);
#endif
DEFINE_BINARY2(polygamma, float, double);
} // namespace functor
} // namespace tensorflow