MCPcopy Create free account
hub / github.com/ROCm/clr / GetHandleForAddressRange

Method GetHandleForAddressRange

rocclr/device/device.cpp:1132–1147  ·  view source on GitHub ↗

=================================================================================================

Source from the content-addressed store, hash-verified

1130
1131// =================================================================================================
1132bool Device::GetHandleForAddressRange(void* dev_ptr, size_t size, void* handle) {
1133 // Check if the ptr is created through VMM APIs, if true we use different ROCr APIs.
1134 amd::Memory* amd_base_obj = amd::MemObjMap::FindVirtualMemObj(dev_ptr);
1135 bool VmmPtr = (amd_base_obj != nullptr) ? true : false;
1136
1137 // Even if it is VMM ptr, check to make sure the memory is mapped. On hipMalloc'ed ptrs,
1138 // make sure the memory is allocated.
1139 amd::Memory* amd_mem_obj = amd::MemObjMap::FindMemObj(dev_ptr);
1140 if (amd_mem_obj == nullptr) {
1141 DevLogPrintfError("Cannot retrieve amd_mem_obj for dev_ptr: 0x%x", dev_ptr);
1142 return false;
1143 }
1144
1145 device::Memory* dev_mem = amd_mem_obj->getDeviceMemory(*this);
1146 return dev_mem->GetFDHandleForMem(dev_ptr, size, VmmPtr, handle);
1147}
1148
1149// ================================================================================================
1150void Device::TrackHostcallMemory(amd::Memory* memory) {

Callers 1

Calls 2

getDeviceMemoryMethod · 0.45
GetFDHandleForMemMethod · 0.45

Tested by

no test coverage detected