| 190 | } |
| 191 | |
| 192 | XlaDevice::XlaDevice(const SessionOptions& session_options, |
| 193 | const Options& options) |
| 194 | : LocalDevice(session_options, |
| 195 | BuildXlaDeviceAttributes(options.device_name_prefix, |
| 196 | options.device_name, |
| 197 | options.device_ordinal)), |
| 198 | xla_metadata_(options.device_ordinal, options.platform, |
| 199 | DeviceType(options.compilation_device_name), |
| 200 | options.shape_representation_fn, |
| 201 | options.padded_shape_fn ? options.padded_shape_fn |
| 202 | : DefaultPaddedShapeFn, |
| 203 | options.use_multiple_streams), |
| 204 | device_ordinal_(options.device_ordinal), |
| 205 | jit_device_name_(options.compilation_device_name), |
| 206 | platform_(options.platform), |
| 207 | intra_op_parallelism_threads_( |
| 208 | session_options.config.intra_op_parallelism_threads()), |
| 209 | use_multiple_streams_(options.use_multiple_streams), |
| 210 | shape_representation_fn_(options.shape_representation_fn), |
| 211 | allowed_devices_(options.allowed_devices) { |
| 212 | VLOG(1) << "Created XLA device " << options.compilation_device_name << " " |
| 213 | << this; |
| 214 | thread_pool_.reset(new thread::ThreadPool(session_options.env, "xla_device", |
| 215 | /*num_threads=*/1)); |
| 216 | |
| 217 | // We have multiple device to device streams to allow for some concurrency |
| 218 | // between transfers. The particular value of '4' is chosen fairly |
| 219 | // arbitrarily. It may be necessary to make this tunable via |
| 220 | // XlaDevice::Options. |
| 221 | static constexpr int kNumDeviceToDeviceStreams = 4; |
| 222 | device_to_device_streams_.resize(kNumDeviceToDeviceStreams); |
| 223 | } |
| 224 | |
| 225 | XlaDevice::XlaDevice(const SessionOptions& session_options, |
| 226 | const Options& options, |
nothing calls this directly
no test coverage detected