SWDEV-344210 - Fixed page fault when mempool accessed from remote device

Change-Id: Ie41b0c0499f7733d4541ccd50b3d0d976c6431c9


[ROCm/clr commit: a28b22d9b4]
This commit is contained in:
Sarbojit Sarkar
2022-08-01 11:52:23 +00:00
committed by Sarbojit Sarkar
parent ce8bf4a202
commit a70f836779
6 changed files with 50 additions and 7 deletions
@@ -2045,6 +2045,22 @@ bool Device::deviceAllowAccess(void* ptr) const {
return true;
}
bool Device::allowPeerAccess(device::Memory* memory) const {
if (memory == nullptr) {
return false;
}
if (!p2pAgents().empty()) {
void* ptr = reinterpret_cast<void*>(memory->virtualAddress());
hsa_agent_t agent = getBackendDevice();
hsa_status_t stat = hsa_amd_agents_allow_access(1, &agent, nullptr, ptr);
if (stat != HSA_STATUS_SUCCESS) {
LogError("Allow p2p access failed");
return false;
}
}
return true;
}
void* Device::deviceLocalAlloc(size_t size, bool atomics) const {
const hsa_amd_memory_pool_t& pool = (atomics)? gpu_fine_grained_segment_ : gpuvm_segment_;