[Build time] Split "tile_functor_cpu.cc" into a shared header and type-specific .cc files.

PiperOrigin-RevId: 304508153
Change-Id: I0560d3f4875ea480ae437f161e30e9d72f28fa70
This commit is contained in:
Derek Murray 2020-04-02 17:06:53 -07:00 committed by TensorFlower Gardener
parent 81595b4044
commit c8355087e9
16 changed files with 454 additions and 53 deletions

View File

@ -1314,7 +1314,23 @@ tf_kernel_library(
tf_kernel_library(
name = "tile_ops",
srcs = ["tile_functor_cpu.cc"],
srcs = [
"tile_functor_cpu.h",
"tile_functor_cpu_bfloat16.cc",
"tile_functor_cpu_bool.cc",
"tile_functor_cpu_complex128.cc",
"tile_functor_cpu_complex64.cc",
"tile_functor_cpu_double.cc",
"tile_functor_cpu_float.cc",
"tile_functor_cpu_half.cc",
"tile_functor_cpu_int16.cc",
"tile_functor_cpu_int32.cc",
"tile_functor_cpu_int64.cc",
"tile_functor_cpu_int8.cc",
"tile_functor_cpu_tstring.cc",
"tile_functor_cpu_uint8.cc",
"tile_functor_sycl.cc",
],
hdrs = ["tile_functor.h"],
gpu_srcs = [
"tile_functor.h",
@ -6821,7 +6837,20 @@ filegroup(
"summary_op.cc",
"tensor_array.cc",
"tensor_array_ops.cc",
"tile_functor_cpu.cc",
"tile_functor_cpu.h",
"tile_functor_cpu_bfloat16.cc",
"tile_functor_cpu_bool.cc",
"tile_functor_cpu_complex128.cc",
"tile_functor_cpu_complex64.cc",
"tile_functor_cpu_double.cc",
"tile_functor_cpu_float.cc",
"tile_functor_cpu_half.cc",
"tile_functor_cpu_int16.cc",
"tile_functor_cpu_int32.cc",
"tile_functor_cpu_int64.cc",
"tile_functor_cpu_int8.cc",
"tile_functor_cpu_tstring.cc",
"tile_functor_cpu_uint8.cc",
"tile_ops.cc",
"tile_ops_cpu_impl_1.cc",
"tile_ops_cpu_impl_2.cc",

View File

@ -12,17 +12,16 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
==============================================================================*/
#ifndef TENSORFLOW_CORE_KERNELS_TILE_FUNCTOR_CPU_H_
#define TENSORFLOW_CORE_KERNELS_TILE_FUNCTOR_CPU_H_
#define EIGEN_USE_THREADS
#include "tensorflow/core/framework/attr_value.pb.h"
#include "tensorflow/core/framework/register_types.h"
#include "tensorflow/core/kernels/ops_util.h"
#include "tensorflow/core/kernels/tile_functor.h"
namespace tensorflow {
namespace internal {
namespace {
template <typename Device, typename T>
void TileSimpleImpl(const Device& d, Tensor* out, const Tensor& in) {
@ -44,8 +43,6 @@ void TileSimpleImpl(const Device& d, Tensor* out, const Tensor& in) {
}
}
} // namespace
template <typename T>
void TileSimple(const Eigen::ThreadPoolDevice& d, Tensor* out,
const Tensor& in) {
@ -59,50 +56,6 @@ void TileSimple(const Eigen::SyclDevice& d, Tensor* out, const Tensor& in) {
#endif
} // namespace internal
namespace functor {
typedef Eigen::ThreadPoolDevice CPUDevice;
// Register functors used for Tile functor.
#define DEFINE_TYPE(T) \
template struct Tile<CPUDevice, T, int32>; \
template struct Tile<CPUDevice, T, int64>;
TF_CALL_bool(DEFINE_TYPE);
TF_CALL_float(DEFINE_TYPE);
TF_CALL_bfloat16(DEFINE_TYPE);
TF_CALL_double(DEFINE_TYPE);
TF_CALL_uint8(DEFINE_TYPE);
TF_CALL_int8(DEFINE_TYPE);
TF_CALL_int32(DEFINE_TYPE);
TF_CALL_int16(DEFINE_TYPE);
TF_CALL_int64(DEFINE_TYPE);
TF_CALL_half(DEFINE_TYPE);
TF_CALL_complex64(DEFINE_TYPE);
TF_CALL_complex128(DEFINE_TYPE);
TF_CALL_tstring(DEFINE_TYPE);
#undef DEFINE_TYPE
#ifdef TENSORFLOW_USE_SYCL
typedef Eigen::SyclDevice SYCLDevice;
#define DEFINE_TYPE(T) \
template struct Tile<SYCLDevice, T, int32>; \
template struct Tile<SYCLDevice, T, int64>;
TF_CALL_bool(DEFINE_TYPE);
TF_CALL_float(DEFINE_TYPE);
TF_CALL_bfloat16(DEFINE_TYPE);
TF_CALL_double(DEFINE_TYPE);
TF_CALL_uint8(DEFINE_TYPE);
TF_CALL_int32(DEFINE_TYPE);
TF_CALL_int16(DEFINE_TYPE);
TF_CALL_int64(DEFINE_TYPE);
#undef DEFINE_TYPE
#endif // TENSORFLOW_USE_SYCL
} // end namespace functor
} // end namespace tensorflow
#endif // TENSORFLOW_CORE_KERNELS_TILE_FUNCTOR_CPU_H_

View File

@ -0,0 +1,29 @@
/* Copyright 2016 The TensorFlow Authors. All Rights Reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
==============================================================================*/
#define EIGEN_USE_THREADS
#include "tensorflow/core/kernels/tile_functor_cpu.h"
namespace tensorflow {
namespace functor {
typedef Eigen::ThreadPoolDevice CPUDevice;
template struct Tile<CPUDevice, bfloat16, int32>;
template struct Tile<CPUDevice, bfloat16, int64>;
} // end namespace functor
} // end namespace tensorflow

View File

@ -0,0 +1,29 @@
/* Copyright 2016 The TensorFlow Authors. All Rights Reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
==============================================================================*/
#define EIGEN_USE_THREADS
#include "tensorflow/core/kernels/tile_functor_cpu.h"
namespace tensorflow {
namespace functor {
typedef Eigen::ThreadPoolDevice CPUDevice;
template struct Tile<CPUDevice, bool, int32>;
template struct Tile<CPUDevice, bool, int64>;
} // end namespace functor
} // end namespace tensorflow

View File

@ -0,0 +1,29 @@
/* Copyright 2016 The TensorFlow Authors. All Rights Reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
==============================================================================*/
#define EIGEN_USE_THREADS
#include "tensorflow/core/kernels/tile_functor_cpu.h"
namespace tensorflow {
namespace functor {
typedef Eigen::ThreadPoolDevice CPUDevice;
template struct Tile<CPUDevice, complex128, int32>;
template struct Tile<CPUDevice, complex128, int64>;
} // end namespace functor
} // end namespace tensorflow

View File

@ -0,0 +1,29 @@
/* Copyright 2016 The TensorFlow Authors. All Rights Reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
==============================================================================*/
#define EIGEN_USE_THREADS
#include "tensorflow/core/kernels/tile_functor_cpu.h"
namespace tensorflow {
namespace functor {
typedef Eigen::ThreadPoolDevice CPUDevice;
template struct Tile<CPUDevice, complex64, int32>;
template struct Tile<CPUDevice, complex64, int64>;
} // end namespace functor
} // end namespace tensorflow

View File

@ -0,0 +1,29 @@
/* Copyright 2016 The TensorFlow Authors. All Rights Reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
==============================================================================*/
#define EIGEN_USE_THREADS
#include "tensorflow/core/kernels/tile_functor_cpu.h"
namespace tensorflow {
namespace functor {
typedef Eigen::ThreadPoolDevice CPUDevice;
template struct Tile<CPUDevice, double, int32>;
template struct Tile<CPUDevice, double, int64>;
} // end namespace functor
} // end namespace tensorflow

View File

@ -0,0 +1,29 @@
/* Copyright 2016 The TensorFlow Authors. All Rights Reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
==============================================================================*/
#define EIGEN_USE_THREADS
#include "tensorflow/core/kernels/tile_functor_cpu.h"
namespace tensorflow {
namespace functor {
typedef Eigen::ThreadPoolDevice CPUDevice;
template struct Tile<CPUDevice, float, int32>;
template struct Tile<CPUDevice, float, int64>;
} // end namespace functor
} // end namespace tensorflow

View File

@ -0,0 +1,29 @@
/* Copyright 2016 The TensorFlow Authors. All Rights Reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
==============================================================================*/
#define EIGEN_USE_THREADS
#include "tensorflow/core/kernels/tile_functor_cpu.h"
namespace tensorflow {
namespace functor {
typedef Eigen::ThreadPoolDevice CPUDevice;
template struct Tile<CPUDevice, Eigen::half, int32>;
template struct Tile<CPUDevice, Eigen::half, int64>;
} // end namespace functor
} // end namespace tensorflow

View File

@ -0,0 +1,29 @@
/* Copyright 2016 The TensorFlow Authors. All Rights Reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
==============================================================================*/
#define EIGEN_USE_THREADS
#include "tensorflow/core/kernels/tile_functor_cpu.h"
namespace tensorflow {
namespace functor {
typedef Eigen::ThreadPoolDevice CPUDevice;
template struct Tile<CPUDevice, int16, int32>;
template struct Tile<CPUDevice, int16, int64>;
} // end namespace functor
} // end namespace tensorflow

View File

@ -0,0 +1,29 @@
/* Copyright 2016 The TensorFlow Authors. All Rights Reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
==============================================================================*/
#define EIGEN_USE_THREADS
#include "tensorflow/core/kernels/tile_functor_cpu.h"
namespace tensorflow {
namespace functor {
typedef Eigen::ThreadPoolDevice CPUDevice;
template struct Tile<CPUDevice, int32, int32>;
template struct Tile<CPUDevice, int32, int64>;
} // end namespace functor
} // end namespace tensorflow

View File

@ -0,0 +1,29 @@
/* Copyright 2016 The TensorFlow Authors. All Rights Reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
==============================================================================*/
#define EIGEN_USE_THREADS
#include "tensorflow/core/kernels/tile_functor_cpu.h"
namespace tensorflow {
namespace functor {
typedef Eigen::ThreadPoolDevice CPUDevice;
template struct Tile<CPUDevice, int64, int32>;
template struct Tile<CPUDevice, int64, int64>;
} // end namespace functor
} // end namespace tensorflow

View File

@ -0,0 +1,29 @@
/* Copyright 2016 The TensorFlow Authors. All Rights Reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
==============================================================================*/
#define EIGEN_USE_THREADS
#include "tensorflow/core/kernels/tile_functor_cpu.h"
namespace tensorflow {
namespace functor {
typedef Eigen::ThreadPoolDevice CPUDevice;
template struct Tile<CPUDevice, int8, int32>;
template struct Tile<CPUDevice, int8, int64>;
} // end namespace functor
} // end namespace tensorflow

View File

@ -0,0 +1,29 @@
/* Copyright 2016 The TensorFlow Authors. All Rights Reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
==============================================================================*/
#define EIGEN_USE_THREADS
#include "tensorflow/core/kernels/tile_functor_cpu.h"
namespace tensorflow {
namespace functor {
typedef Eigen::ThreadPoolDevice CPUDevice;
template struct Tile<CPUDevice, tstring, int32>;
template struct Tile<CPUDevice, tstring, int64>;
} // end namespace functor
} // end namespace tensorflow

View File

@ -0,0 +1,29 @@
/* Copyright 2016 The TensorFlow Authors. All Rights Reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
==============================================================================*/
#define EIGEN_USE_THREADS
#include "tensorflow/core/kernels/tile_functor_cpu.h"
namespace tensorflow {
namespace functor {
typedef Eigen::ThreadPoolDevice CPUDevice;
template struct Tile<CPUDevice, uint8, int32>;
template struct Tile<CPUDevice, uint8, int64>;
} // end namespace functor
} // end namespace tensorflow

View File

@ -0,0 +1,42 @@
/* Copyright 2016 The TensorFlow Authors. All Rights Reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
==============================================================================*/
#include "tensorflow/core/framework/register_types.h"
#include "tensorflow/core/kernels/tile_functor_cpu.h"
namespace tensorflow {
namespace functor {
#ifdef TENSORFLOW_USE_SYCL
typedef Eigen::SyclDevice SYCLDevice;
#define DEFINE_TYPE(T) \
template struct Tile<SYCLDevice, T, int32>; \
template struct Tile<SYCLDevice, T, int64>;
TF_CALL_bool(DEFINE_TYPE);
TF_CALL_float(DEFINE_TYPE);
TF_CALL_bfloat16(DEFINE_TYPE);
TF_CALL_double(DEFINE_TYPE);
TF_CALL_uint8(DEFINE_TYPE);
TF_CALL_int32(DEFINE_TYPE);
TF_CALL_int16(DEFINE_TYPE);
TF_CALL_int64(DEFINE_TYPE);
#undef DEFINE_TYPE
#endif // TENSORFLOW_USE_SYCL
} // end namespace functor
} // end namespace tensorflow