SWDEV-539378 - Use agent of IPC memory owner (#570)
- Currently runtime just uses the local agent as it did not check for IPCShared() - With this fix we query hsa_amd_pointer_info and get the right agent for the memory to pass it to the HSA copy api
This commit is contained in:
committed by
GitHub
parent
81238db679
commit
46d766e4e2
@@ -603,6 +603,24 @@ bool DmaBlitManager::hsaCopy(const Memory& srcMemory, const Memory& dstMemory,
|
||||
(srcMemory.isHostMemDirectAccess()) ? dev().getCpuAgent() : dev().getBackendDevice();
|
||||
dstAgent =
|
||||
(dstMemory.isHostMemDirectAccess()) ? dev().getCpuAgent() : dev().getBackendDevice();
|
||||
|
||||
// When a memory is opened as IPCBuffer, the runtime is not aware of the agent that
|
||||
// owns the memory, thus query the pointer info here.
|
||||
if (static_cast<const amd::Memory*>(srcMemory.owner())->ipcShared()) {
|
||||
hsa_amd_pointer_info_t info = {sizeof(hsa_amd_pointer_info_t)};
|
||||
if (HSA_STATUS_SUCCESS ==
|
||||
hsa_amd_pointer_info(const_cast<address>(src), &info, nullptr, nullptr, nullptr)) {
|
||||
srcAgent = info.agentOwner;
|
||||
}
|
||||
}
|
||||
|
||||
if (static_cast<const amd::Memory*>(dstMemory.owner())->ipcShared()) {
|
||||
hsa_amd_pointer_info_t info = {sizeof(hsa_amd_pointer_info_t)};
|
||||
if (HSA_STATUS_SUCCESS ==
|
||||
hsa_amd_pointer_info(dst, &info, nullptr, nullptr, nullptr)) {
|
||||
dstAgent = info.agentOwner;
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
srcAgent = srcMemory.dev().getBackendDevice();
|
||||
|
||||
Reference in New Issue
Block a user