diff --git a/runtime/hsa-runtime/core/runtime/runtime.cpp b/runtime/hsa-runtime/core/runtime/runtime.cpp index 5940a51af1..763efcdade 100644 --- a/runtime/hsa-runtime/core/runtime/runtime.cpp +++ b/runtime/hsa-runtime/core/runtime/runtime.cpp @@ -758,7 +758,13 @@ hsa_status_t Runtime::PtrInfo(void* ptr, hsa_amd_pointer_info_t* info, void* (*a { // memory_lock protects access to the NMappedNodes array and fragment user data since these may // change with calls to memory APIs. ScopedAcquire lock(&memory_lock_); - hsaKmtQueryPointerInfo(ptr, &thunkInfo); + + // We don't care if this returns an error code. + // The type will be HSA_EXT_POINTER_TYPE_UNKNOWN if so. + auto err = hsaKmtQueryPointerInfo(ptr, &thunkInfo); + assert(((err == HSAKMT_STATUS_SUCCESS) || (thunkInfo.Type == HSA_POINTER_UNKNOWN)) && + "Thunk ptr info error and not type HSA_POINTER_UNKNOWN."); + if (returnListData) { assert(thunkInfo.NMappedNodes <= agents_by_node_.size() && "PointerInfo: Thunk returned more than all agents in NMappedNodes."); @@ -798,8 +804,8 @@ hsa_status_t Runtime::PtrInfo(void* ptr, hsa_amd_pointer_info_t* info, void* (*a retInfo.size = Min(info->size, sizeof(hsa_amd_pointer_info_t)); - // Temp: workaround thunk bug, IPC memory has garbage in Node. - // retInfo.agentOwner = agents_by_node_[thunkInfo.Node][0]->public_handle(); + // IPC and Graphics memory may come from a node that does not have an agent in this process. + // Ex. ROCR_VISIBLE_DEVICES or peer GPU is not supported by ROCm. auto nodeAgents = agents_by_node_.find(thunkInfo.Node); if (nodeAgents != agents_by_node_.end()) retInfo.agentOwner = nodeAgents->second[0]->public_handle();