| 214 | } |
| 215 | |
| 216 | xla::StatusOr<RefPtr<XRTTupleAllocation>> XRTMemoryManager::Lookup( |
| 217 | int64 handle) { |
| 218 | int device_ordinal = GetDeviceFromHandle(handle); |
| 219 | DeviceContext* device_context = GetDeviceContext(device_ordinal, |
| 220 | /*create_if_missing=*/false); |
| 221 | if (device_context == nullptr) { |
| 222 | return errors::NotFound("XRT memory handle not found: ", handle); |
| 223 | } |
| 224 | RefPtr<XRTTupleAllocation> tuple = device_context->Lookup(handle); |
| 225 | if (tuple == nullptr) { |
| 226 | return errors::NotFound("XRT memory handle not found: ", handle); |
| 227 | } |
| 228 | return std::move(tuple); |
| 229 | } |
| 230 | |
| 231 | Status XRTMemoryManager::Release(int64 handle) { |
| 232 | int device_ordinal = GetDeviceFromHandle(handle); |