[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:
parent
8fc1313553
commit
31abd783e6
@ -140,7 +140,7 @@ XlaOpRegistry::~XlaOpRegistry() = default;
|
|||||||
|
|
||||||
// Lazily register the CPU and GPU JIT devices the first time
|
// Lazily register the CPU and GPU JIT devices the first time
|
||||||
// GetCompilationDevice is called.
|
// GetCompilationDevice is called.
|
||||||
{
|
static void* registration_init = [®istry]() {
|
||||||
MarkForCompilationPassFlags* flags = GetMarkForCompilationPassFlags();
|
MarkForCompilationPassFlags* flags = GetMarkForCompilationPassFlags();
|
||||||
bool cpu_global_jit = flags->tf_xla_cpu_global_jit;
|
bool cpu_global_jit = flags->tf_xla_cpu_global_jit;
|
||||||
VLOG(2) << "tf_xla_cpu_global_jit = " << cpu_global_jit;
|
VLOG(2) << "tf_xla_cpu_global_jit = " << cpu_global_jit;
|
||||||
@ -162,7 +162,9 @@ XlaOpRegistry::~XlaOpRegistry() = default;
|
|||||||
registration.autoclustering_policy =
|
registration.autoclustering_policy =
|
||||||
XlaOpRegistry::AutoclusteringPolicy::kIfEnabledGlobally;
|
XlaOpRegistry::AutoclusteringPolicy::kIfEnabledGlobally;
|
||||||
}
|
}
|
||||||
}
|
return nullptr;
|
||||||
|
}();
|
||||||
|
(void)registration_init;
|
||||||
|
|
||||||
mutex_lock lock(registry.mutex_);
|
mutex_lock lock(registry.mutex_);
|
||||||
auto it = registry.compilation_devices_.find(device_name);
|
auto it = registry.compilation_devices_.find(device_name);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user