[TF/XLA] Remove an accidentally introduced race condition

cl/288939060 has introduced a race condition: previously, the lambda was only run once. This is the intend of the code.

Thanks to hyeontaek@ for discovering the bug.

PiperOrigin-RevId: 289163903
Change-Id: I35939dd84e5e789c5b72da0a8f2f28a0eaec0891
This commit is contained in:
George Karpenkov 2020-01-10 14:17:19 -08:00 committed by TensorFlower Gardener
parent 8fc1313553
commit 31abd783e6

View File

@ -140,7 +140,7 @@ XlaOpRegistry::~XlaOpRegistry() = default;
// Lazily register the CPU and GPU JIT devices the first time
// GetCompilationDevice is called.
{
static void* registration_init = [&registry]() {
MarkForCompilationPassFlags* flags = GetMarkForCompilationPassFlags();
bool cpu_global_jit = flags->tf_xla_cpu_global_jit;
VLOG(2) << "tf_xla_cpu_global_jit = " << cpu_global_jit;
@ -162,7 +162,9 @@ XlaOpRegistry::~XlaOpRegistry() = default;
registration.autoclustering_policy =
XlaOpRegistry::AutoclusteringPolicy::kIfEnabledGlobally;
}
}
return nullptr;
}();
(void)registration_init;
mutex_lock lock(registry.mutex_);
auto it = registry.compilation_devices_.find(device_name);