Skip to content
Permalink
Browse files Browse the repository at this point in the history
Fix Null-pointer dereference in BuildXlaCompilationCache
If ConfigProto is not used, then use the default settings which is to allow all devices.

PiperOrigin-RevId: 420391800
Change-Id: I88161ad7042990aef678e77b597a2fb2c8f815be
  • Loading branch information
smit-hinsu authored and tensorflower-gardener committed Jan 8, 2022
1 parent 30f8e5c commit e21af68
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions tensorflow/compiler/jit/xla_platform_info.cc
Expand Up @@ -82,11 +82,13 @@ Status BuildXlaCompilationCache(DeviceBase* device, FunctionLibraryRuntime* flr,
client_options.set_intra_op_parallelism_threads(
device->tensorflow_cpu_worker_threads()->num_threads);

string allowed_gpus =
flr->config_proto()->gpu_options().visible_device_list();
TF_ASSIGN_OR_RETURN(absl::optional<std::set<int>> gpu_ids,
ParseVisibleDeviceList(allowed_gpus));
client_options.set_allowed_devices(gpu_ids);
if (flr->config_proto()) {
string allowed_gpus =
flr->config_proto()->gpu_options().visible_device_list();
TF_ASSIGN_OR_RETURN(absl::optional<std::set<int>> gpu_ids,
ParseVisibleDeviceList(allowed_gpus));
client_options.set_allowed_devices(gpu_ids);
}

auto client = xla::ClientLibrary::GetOrCreateLocalClient(client_options);
if (!client.ok()) {
Expand Down

0 comments on commit e21af68

Please sign in to comment.