From b1fe37760fce0010e106522885470c058bd66abe Mon Sep 17 00:00:00 2001 From: "A. Unique TensorFlower" Date: Mon, 13 Apr 2020 09:58:18 -0700 Subject: [PATCH] FlatMap seems to have poorer performance than absl::flat_hash_map. Replacing its use with the latter since lookups / deletions from the rendezvous table block globally. PiperOrigin-RevId: 306252615 Change-Id: I07e4402436ca75801804a578e3253ab5ff4ab762 --- tensorflow/core/distributed_runtime/BUILD | 1 + tensorflow/core/distributed_runtime/base_rendezvous_mgr.h | 6 +++--- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/tensorflow/core/distributed_runtime/BUILD b/tensorflow/core/distributed_runtime/BUILD index 5dd2db26512..02e8ba550a8 100644 --- a/tensorflow/core/distributed_runtime/BUILD +++ b/tensorflow/core/distributed_runtime/BUILD @@ -409,6 +409,7 @@ cc_library( "//tensorflow/core:framework_internal", "//tensorflow/core:lib", "//tensorflow/core:lib_internal", + "@com_google_absl//absl/container:flat_hash_map", ], ) diff --git a/tensorflow/core/distributed_runtime/base_rendezvous_mgr.h b/tensorflow/core/distributed_runtime/base_rendezvous_mgr.h index 4e536aa8ee1..ba6528f0494 100644 --- a/tensorflow/core/distributed_runtime/base_rendezvous_mgr.h +++ b/tensorflow/core/distributed_runtime/base_rendezvous_mgr.h @@ -17,16 +17,16 @@ limitations under the License. #define TENSORFLOW_CORE_DISTRIBUTED_RUNTIME_BASE_RENDEZVOUS_MGR_H_ #include +#include #include +#include "absl/container/flat_hash_map.h" #include "tensorflow/core/distributed_runtime/rendezvous_mgr_interface.h" #include "tensorflow/core/distributed_runtime/worker_env.h" #include "tensorflow/core/distributed_runtime/worker_session.h" #include "tensorflow/core/framework/control_flow.h" #include "tensorflow/core/framework/rendezvous.h" #include "tensorflow/core/lib/core/status.h" -#include "tensorflow/core/lib/gtl/flatmap.h" -#include "tensorflow/core/lib/gtl/flatset.h" #include "tensorflow/core/lib/hash/hash.h" #include "tensorflow/core/platform/macros.h" #include "tensorflow/core/platform/mutex.h" @@ -97,7 +97,7 @@ class BaseRendezvousMgr : public RendezvousMgrInterface { private: // Maps step_id to rendezvous. - typedef gtl::FlatMap Table; + typedef absl::flat_hash_map Table; // Not owned. const WorkerEnv* const worker_env_;