MCPcopy Create free account
hub / github.com/DeepRec-AI/DeepRec / GetDeviceContext

Method GetDeviceContext

tensorflow/compiler/xrt/xrt_memory_manager.cc:296–311  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

294}
295
296XRTMemoryManager::DeviceContext* XRTMemoryManager::GetDeviceContext(
297 int device_ordinal, bool create_if_missing) {
298 mutex_lock lock(lock_);
299 if (device_ordinal >= device_contexts_.size()) {
300 if (!create_if_missing) {
301 return nullptr;
302 }
303 device_contexts_.resize(device_ordinal + 1);
304 }
305 DeviceContext* device_context = device_contexts_[device_ordinal].get();
306 if (device_context == nullptr && create_if_missing) {
307 device_contexts_[device_ordinal] = absl::make_unique<DeviceContext>();
308 device_context = device_contexts_[device_ordinal].get();
309 }
310 return device_context;
311}
312
313Status XRTMemoryManager::TryFreeMemoryStep(MemoryReclaimContext* mrctx,
314 const Status& status) {

Callers

nothing calls this directly

Calls 3

sizeMethod · 0.45
resizeMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected