diff --git a/tensorflow/core/BUILD b/tensorflow/core/BUILD index 681f2ab37c4..91c0ed786db 100644 --- a/tensorflow/core/BUILD +++ b/tensorflow/core/BUILD @@ -995,6 +995,26 @@ tf_cuda_library( ], ) +# This is redundant with the "framework" target above. It's useful for +# applications that want to depend on a minimal subset of TensorFlow (e.g. XLA). +cc_library( + name = "allocator", + srcs = [ + "framework/allocator.cc", + "framework/allocator_registry.cc", + "framework/allocator_registry.h", + "framework/tracking_allocator.cc", + "framework/tracking_allocator.h", + ], + hdrs = ["framework/allocator.h"], + features = ["parse_headers"], + visibility = ["//visibility:public"], + deps = [ + ":lib", + "@com_google_absl//absl/types:optional", + ], +) + cc_library( name = "stats_calculator_portable", srcs = [ @@ -3275,6 +3295,36 @@ tf_cuda_library( alwayslink = 1, ) +# This is redundant with the "core_cpu_*" targets above. It's useful for +# applications that want to depend on a minimal subset of TensorFlow (e.g. XLA). +cc_library( + name = "bfc_allocator", + srcs = [ + "common_runtime/allocator_retry.cc", + "common_runtime/allocator_retry.h", + "common_runtime/bfc_allocator.cc", + ], + hdrs = ["common_runtime/bfc_allocator.h"], + features = ["parse_headers"], + visibility = ["//visibility:public"], + deps = [ + ":allocator", + ":lib", + ":lib_internal", + ":shared_counter", + ], +) + +cc_library( + name = "shared_counter", + hdrs = ["common_runtime/shared_counter.h"], + features = ["parse_headers"], + visibility = ["//visibility:public"], + deps = [ + ":lib", + ], +) + cc_library( name = "regexp_internal", hdrs = [ @@ -3455,6 +3505,25 @@ tf_cuda_library( ] + if_static([":gpu_runtime_impl"]), ) +# This is redundant with the "gpu_runtime_*" targets above. It's useful for +# applications that want to depend on a minimal subset of TensorFlow (e.g. XLA). +tf_cuda_library( + name = "gpu_bfc_allocator", + srcs = [ + "common_runtime/gpu/gpu_bfc_allocator.cc", + "common_runtime/gpu/gpu_id.h", + ], + hdrs = ["common_runtime/gpu/gpu_bfc_allocator.h"], + features = ["parse_headers"], + visibility = ["//visibility:public"], + deps = [ + ":bfc_allocator", + ":lib", + ":lib_internal", + ":stream_executor", + ], +) + tf_cuda_library( name = "gpu_init", hdrs = [ diff --git a/tensorflow/core/common_runtime/bfc_allocator.cc b/tensorflow/core/common_runtime/bfc_allocator.cc index ec649848e67..62461cf7fae 100644 --- a/tensorflow/core/common_runtime/bfc_allocator.cc +++ b/tensorflow/core/common_runtime/bfc_allocator.cc @@ -18,7 +18,6 @@ limitations under the License. #include #include "tensorflow/core/common_runtime/allocator_retry.h" -#include "tensorflow/core/framework/device_base.h" #include "tensorflow/core/lib/core/bits.h" #include "tensorflow/core/lib/gtl/stl_util.h" #include "tensorflow/core/lib/strings/numbers.h" diff --git a/tensorflow/core/common_runtime/bfc_allocator.h b/tensorflow/core/common_runtime/bfc_allocator.h index ea385e6a174..bfd857a5e1b 100644 --- a/tensorflow/core/common_runtime/bfc_allocator.h +++ b/tensorflow/core/common_runtime/bfc_allocator.h @@ -32,7 +32,6 @@ limitations under the License. #include "tensorflow/core/platform/mutex.h" #include "tensorflow/core/platform/thread_annotations.h" #include "tensorflow/core/platform/types.h" -#include "tensorflow/core/protobuf/config.pb.h" namespace tensorflow { diff --git a/tensorflow/core/common_runtime/gpu/gpu_bfc_allocator.cc b/tensorflow/core/common_runtime/gpu/gpu_bfc_allocator.cc index 42021e51f34..06b97073929 100644 --- a/tensorflow/core/common_runtime/gpu/gpu_bfc_allocator.cc +++ b/tensorflow/core/common_runtime/gpu/gpu_bfc_allocator.cc @@ -16,8 +16,6 @@ limitations under the License. #include "tensorflow/core/common_runtime/gpu/gpu_bfc_allocator.h" #include "tensorflow/core/common_runtime/gpu/gpu_id.h" -#include "tensorflow/core/common_runtime/gpu/gpu_id_utils.h" -#include "tensorflow/core/common_runtime/gpu/gpu_init.h" #include "tensorflow/core/lib/strings/strcat.h" namespace tensorflow { diff --git a/tensorflow/core/common_runtime/shared_counter.h b/tensorflow/core/common_runtime/shared_counter.h index 5e378524b20..12aa79cd3f4 100644 --- a/tensorflow/core/common_runtime/shared_counter.h +++ b/tensorflow/core/common_runtime/shared_counter.h @@ -15,6 +15,10 @@ limitations under the License. #ifndef TENSORFLOW_CORE_COMMON_RUNTIME_SHARED_COUNTER_H_ #define TENSORFLOW_CORE_COMMON_RUNTIME_SHARED_COUNTER_H_ +#include + +#include "tensorflow/core/platform/types.h" + namespace tensorflow { // A lightweight thread-safe monotone counter for establishing // temporal ordering. diff --git a/tensorflow/core/framework/allocator.cc b/tensorflow/core/framework/allocator.cc index fb4f890581d..7ab87d1f8a4 100644 --- a/tensorflow/core/framework/allocator.cc +++ b/tensorflow/core/framework/allocator.cc @@ -15,9 +15,11 @@ limitations under the License. #include "tensorflow/core/framework/allocator.h" +#include + #include "tensorflow/core/framework/allocator_registry.h" -#include "tensorflow/core/framework/log_memory.h" #include "tensorflow/core/framework/tracking_allocator.h" +#include "tensorflow/core/lib/strings/strcat.h" #include "tensorflow/core/lib/strings/stringprintf.h" #include "tensorflow/core/platform/mem.h" #include "tensorflow/core/platform/mutex.h" diff --git a/tensorflow/core/framework/tracking_allocator.h b/tensorflow/core/framework/tracking_allocator.h index acec847bd36..428bffd9e15 100644 --- a/tensorflow/core/framework/tracking_allocator.h +++ b/tensorflow/core/framework/tracking_allocator.h @@ -18,7 +18,6 @@ limitations under the License. #include #include "tensorflow/core/framework/allocator.h" -#include "tensorflow/core/lib/core/refcount.h" #include "tensorflow/core/lib/gtl/inlined_vector.h" #include "tensorflow/core/platform/mutex.h" #include "tensorflow/core/platform/thread_annotations.h" diff --git a/tensorflow/core/framework/typed_allocator.h b/tensorflow/core/framework/typed_allocator.h index 37532fd0dd8..7e1ea1bfae5 100644 --- a/tensorflow/core/framework/typed_allocator.h +++ b/tensorflow/core/framework/typed_allocator.h @@ -20,6 +20,7 @@ limitations under the License. #include "tensorflow/core/framework/allocator.h" #include "tensorflow/core/framework/resource_handle.h" +#include "tensorflow/core/framework/type_traits.h" #include "tensorflow/core/platform/types.h" namespace tensorflow {