diff --git a/xla/backends/profiler/cpu/BUILD b/xla/backends/profiler/cpu/BUILD index 5d078b7a65ca7..fcfdeb28c0188 100644 --- a/xla/backends/profiler/cpu/BUILD +++ b/xla/backends/profiler/cpu/BUILD @@ -133,9 +133,9 @@ xla_cc_test( "//xla/tsl/profiler/utils:timespan", "//xla/tsl/profiler/utils:xplane_schema", "//xla/tsl/profiler/utils:xplane_visitor", + "@com_google_absl//absl/synchronization", "@com_google_absl//absl/types:optional", "@com_google_googletest//:gtest_main", - "@tsl//tsl/platform:blocking_counter", "@tsl//tsl/platform:env", "@tsl//tsl/platform:test", "@tsl//tsl/platform:types", diff --git a/xla/backends/profiler/cpu/host_tracer_test.cc b/xla/backends/profiler/cpu/host_tracer_test.cc index 68fe3fc32c385..05667c020a26c 100644 --- a/xla/backends/profiler/cpu/host_tracer_test.cc +++ b/xla/backends/profiler/cpu/host_tracer_test.cc @@ -20,13 +20,13 @@ limitations under the License. #include #include +#include "absl/synchronization/blocking_counter.h" #include "absl/types/optional.h" #include "xla/tsl/lib/core/status_test_util.h" #include "xla/tsl/profiler/utils/tf_xplane_visitor.h" #include "xla/tsl/profiler/utils/timespan.h" #include "xla/tsl/profiler/utils/xplane_schema.h" #include "xla/tsl/profiler/utils/xplane_visitor.h" -#include "tsl/platform/blocking_counter.h" #include "tsl/platform/env.h" #include "tsl/platform/test.h" #include "tsl/platform/threadpool.h" @@ -166,7 +166,7 @@ TEST(HostTracerTest, CollectEventsFromThreadPool) { std::make_unique(/*env=*/Env::Default(), /*name=*/"HostTracerTest", /*num_threads=*/1); - tsl::BlockingCounter counter(1); + absl::BlockingCounter counter(1); auto tracer = CreateHostTracer({}); TF_EXPECT_OK(tracer->Start()); thread_pool->Schedule([&counter] { diff --git a/xla/service/cpu/BUILD b/xla/service/cpu/BUILD index d8868d2f7425f..9ddc3a1c3d4f8 100644 --- a/xla/service/cpu/BUILD +++ b/xla/service/cpu/BUILD @@ -1316,11 +1316,10 @@ cc_library( "//xla:executable_run_options", "//xla/service:custom_call_status_internal", "@com_google_absl//absl/base:core_headers", - "@com_google_absl//absl/base:dynamic_annotations", "@com_google_absl//absl/strings", "@com_google_absl//absl/strings:str_format", + "@com_google_absl//absl/synchronization", "@eigen_archive//:eigen3", - "@tsl//tsl/platform:blocking_counter", "@tsl//tsl/platform:logging", ], ) @@ -1727,8 +1726,8 @@ cc_library( ":onednn_config_proto_cc", "//xla:xla_data_proto_cc", "//xla/hlo/ir:hlo", + "@com_google_absl//absl/synchronization", "@eigen_archive//:eigen3", - "@tsl//tsl/platform:blocking_counter", "@tsl//tsl/platform:env", "@tsl//tsl/platform:platform_port", ] + mkl_deps(), @@ -1781,8 +1780,8 @@ cc_library( "//xla/hlo/ir:hlo", "@com_google_absl//absl/base:core_headers", "@com_google_absl//absl/base:dynamic_annotations", + "@com_google_absl//absl/synchronization", "@eigen_archive//:eigen3", - "@tsl//tsl/platform:blocking_counter", "@tsl//tsl/platform:env", "@tsl//tsl/platform:logging", "@tsl//tsl/platform:platform_port", @@ -1805,8 +1804,8 @@ cc_library( "//xla:shape_util", "@com_google_absl//absl/base:core_headers", "@com_google_absl//absl/base:dynamic_annotations", + "@com_google_absl//absl/synchronization", "@eigen_archive//:eigen3", - "@tsl//tsl/platform:blocking_counter", "@tsl//tsl/platform:env", "@tsl//tsl/platform:logging", "@tsl//tsl/platform:platform_port", @@ -1830,8 +1829,8 @@ cc_library( "//xla:executable_run_options", "@com_google_absl//absl/base:core_headers", "@com_google_absl//absl/base:dynamic_annotations", + "@com_google_absl//absl/synchronization", "@eigen_archive//:eigen3", - "@tsl//tsl/platform:blocking_counter", "@tsl//tsl/platform:env", "@tsl//tsl/platform:platform_port", ] + mkl_deps(), @@ -1854,8 +1853,8 @@ cc_library( "//xla:executable_run_options", "@com_google_absl//absl/base:core_headers", "@com_google_absl//absl/base:dynamic_annotations", + "@com_google_absl//absl/synchronization", "@eigen_archive//:eigen3", - "@tsl//tsl/platform:blocking_counter", "@tsl//tsl/platform:env", "@tsl//tsl/platform:platform_port", ] + mkl_deps(), @@ -1900,8 +1899,8 @@ cc_library( "//xla/service:pattern_matcher", "@com_google_absl//absl/algorithm:container", "@com_google_absl//absl/status:statusor", + "@com_google_absl//absl/synchronization", "@eigen_archive//:eigen3", - "@tsl//tsl/platform:blocking_counter", "@tsl//tsl/platform:env", "@tsl//tsl/platform:logging", "@tsl//tsl/platform:platform_port", diff --git a/xla/service/cpu/runtime_fork_join.cc b/xla/service/cpu/runtime_fork_join.cc index 50f7814e09b76..bf30ddfebd15f 100644 --- a/xla/service/cpu/runtime_fork_join.cc +++ b/xla/service/cpu/runtime_fork_join.cc @@ -24,6 +24,7 @@ limitations under the License. #include "absl/base/attributes.h" #include "absl/strings/str_cat.h" #include "absl/strings/string_view.h" +#include "absl/synchronization/blocking_counter.h" #define EIGEN_USE_THREADS @@ -32,7 +33,6 @@ limitations under the License. #include "unsupported/Eigen/CXX11/Tensor" #include "xla/executable_run_options.h" #include "xla/service/custom_call_status_internal.h" -#include "tsl/platform/blocking_counter.h" #include "tsl/platform/logging.h" using ComputeFunctionType = void (*)(void*, const void*, const void**, void**, @@ -91,7 +91,7 @@ ABSL_ATTRIBUTE_NO_SANITIZE_MEMORY void __xla_cpu_runtime_ParallelForkJoin( std::vector statuses(num_partitions); // Dispatch 'num_partitions - 1' compute functions to run in parallel. - tsl::BlockingCounter bc(num_partitions - 1); + absl::BlockingCounter bc(num_partitions - 1); for (int32_t i = 1; i < num_partitions; ++i) { const int64_t offset = i * stride; run_options->intra_op_thread_pool()->enqueueNoNotification( diff --git a/xla/service/gpu/BUILD b/xla/service/gpu/BUILD index 8ca13cee5e735..524b683bb3e69 100644 --- a/xla/service/gpu/BUILD +++ b/xla/service/gpu/BUILD @@ -1405,6 +1405,7 @@ cc_library( "@com_google_absl//absl/status:statusor", "@com_google_absl//absl/strings", "@com_google_absl//absl/strings:str_format", + "@com_google_absl//absl/synchronization", "@com_google_absl//absl/types:span", "@com_google_absl//absl/types:variant", "@llvm-project//llvm:AsmParser", @@ -1606,7 +1607,6 @@ cc_library( "//xla:util", "//xla:xla_data_proto_cc", "//xla:xla_proto_cc", - "@tsl//tsl/platform:blocking_counter", "@tsl//tsl/platform:casts", "@tsl//tsl/platform:env", "@tsl//tsl/platform:errors", diff --git a/xla/service/gpu/autotuning/BUILD b/xla/service/gpu/autotuning/BUILD index ac532524c64e7..9cb86a807a6f5 100644 --- a/xla/service/gpu/autotuning/BUILD +++ b/xla/service/gpu/autotuning/BUILD @@ -177,7 +177,6 @@ cc_library( "@com_google_absl//absl/synchronization", "@com_google_absl//absl/time", "@com_google_absl//absl/types:span", - "@tsl//tsl/platform:blocking_counter", "@tsl//tsl/platform:env", "@tsl//tsl/platform:errors", "@tsl//tsl/platform:path", diff --git a/xla/service/gpu/autotuning/gemm_fusion_autotuner.cc b/xla/service/gpu/autotuning/gemm_fusion_autotuner.cc index 5b8bc317e4e3d..2e0e49fd695ff 100644 --- a/xla/service/gpu/autotuning/gemm_fusion_autotuner.cc +++ b/xla/service/gpu/autotuning/gemm_fusion_autotuner.cc @@ -37,6 +37,7 @@ limitations under the License. #include "absl/strings/str_cat.h" #include "absl/strings/str_format.h" #include "absl/strings/string_view.h" +#include "absl/synchronization/blocking_counter.h" #include "absl/synchronization/mutex.h" #include "absl/time/time.h" #include "absl/types/span.h" @@ -99,7 +100,6 @@ limitations under the License. #include "xla/util.h" #include "xla/xla.pb.h" #include "xla/xla_data.pb.h" -#include "tsl/platform/blocking_counter.h" #include "tsl/platform/env.h" #include "tsl/platform/errors.h" #include "tsl/platform/path.h" @@ -989,7 +989,7 @@ GemmFusionAutotunerImpl::CompileAll(AutotunerCompileUtil& compile_util, << " fusions on " << thread_pool_->NumThreads() << " threads."; } - tsl::BlockingCounter counter(config_count); + absl::BlockingCounter counter(config_count); for (const auto& key_value : task) { const HloFusionInstruction* fusion = key_value.first; const std::vector& gemm_config_set = key_value.second; diff --git a/xla/service/gpu/gpu_compiler.cc b/xla/service/gpu/gpu_compiler.cc index 3c14d9c6ac3f9..0b661d645eea6 100755 --- a/xla/service/gpu/gpu_compiler.cc +++ b/xla/service/gpu/gpu_compiler.cc @@ -36,6 +36,7 @@ limitations under the License. #include "absl/strings/str_cat.h" #include "absl/strings/str_format.h" #include "absl/strings/string_view.h" +#include "absl/synchronization/blocking_counter.h" #include "absl/types/span.h" #include "absl/types/variant.h" #include "llvm/ADT/DenseMap.h" @@ -264,7 +265,6 @@ limitations under the License. #include "xla/util.h" #include "xla/xla.pb.h" #include "xla/xla_data.pb.h" -#include "tsl/platform/blocking_counter.h" #include "tsl/platform/casts.h" #include "tsl/platform/cpu_info.h" #include "tsl/platform/env.h" @@ -2146,7 +2146,7 @@ absl::StatusOr GpuCompiler::CompileAndLink( }; std::vector compile_results(llvm_modules.size()); if (thread_pool.get() != nullptr) { - tsl::BlockingCounter counter(llvm_modules.size()); + absl::BlockingCounter counter(llvm_modules.size()); for (int i = 0; i < llvm_modules.size(); ++i) { thread_pool.get_mutable()->Schedule( [&compile_results, i, &llvm_modules, &counter, this, &module_config, diff --git a/xla/service/gpu/transforms/BUILD b/xla/service/gpu/transforms/BUILD index be8d53afec73e..d62fcea21652d 100644 --- a/xla/service/gpu/transforms/BUILD +++ b/xla/service/gpu/transforms/BUILD @@ -2429,7 +2429,6 @@ cc_library( "@com_google_absl//absl/time", "@llvm-project//llvm:Support", "@llvm-project//mlir:IR", - "@tsl//tsl/platform:blocking_counter", "@tsl//tsl/platform:env", "@tsl//tsl/platform:errors", "@tsl//tsl/platform:logging", diff --git a/xla/service/gpu/transforms/priority_fusion.cc b/xla/service/gpu/transforms/priority_fusion.cc index 994bf5a852449..194f2b966936d 100644 --- a/xla/service/gpu/transforms/priority_fusion.cc +++ b/xla/service/gpu/transforms/priority_fusion.cc @@ -35,6 +35,7 @@ limitations under the License. #include "absl/strings/str_cat.h" #include "absl/strings/str_format.h" #include "absl/strings/string_view.h" +#include "absl/synchronization/blocking_counter.h" #include "absl/synchronization/mutex.h" #include "absl/time/time.h" #include "llvm/ADT/STLExtras.h" @@ -65,7 +66,6 @@ limitations under the License. #include "xla/shape_util.h" #include "xla/stream_executor/device_description.h" #include "xla/xla_data.pb.h" -#include "tsl/platform/blocking_counter.h" #include "tsl/platform/errors.h" #include "tsl/platform/logging.h" #include "tsl/platform/status.h" @@ -226,7 +226,7 @@ class PriorityFusionQueue { fn(); } }; - tsl::BlockingCounter counter(instructions.size()); + absl::BlockingCounter counter(instructions.size()); std::vector priorities(instructions.size()); for (size_t i = 0; i < instructions.size(); ++i) { diff --git a/xla/tsl/util/onednn_threadpool.h b/xla/tsl/util/onednn_threadpool.h index a191e566b0eea..b7c5ae3f18338 100644 --- a/xla/tsl/util/onednn_threadpool.h +++ b/xla/tsl/util/onednn_threadpool.h @@ -124,7 +124,7 @@ class OneDnnThreadPool : public threadpool_iface { } run_jobs(balance, njobs_to_schedule, n, njobs, fn); } else { - tsl::BlockingCounter counter(njobs); + absl::BlockingCounter counter(njobs); std::function handle_range = [=, &handle_range, &counter]( int first, int last) { while (last - first > 1) {