Explicit page table update on all devices

HMM with xnack enabled should automatically update page tables,
but currently it doesn't perform that. For now, runtime will
force page table update on all devices unconditionally.

Change-Id: Idfa6e1c145e6c114856214dce042b8a8349e5c58


[ROCm/clr commit: 7d3aaa7a39]
此提交包含在:
German Andryeyev committed 2021-01-12 23:16:46 -05:00
1 父節點 ae7ec74669
當前提交 27e6704673
2 file changed
+11 -12

No files matched your search

+11 -4
查看文件
@@ -2130,7 +2130,17 @@ bool Device::SetSvmAttributesInt(const void* dev_ptr, size_t count,
if (use_cpu) {
attr.push_back({HSA_AMD_SVM_ATTRIB_AGENT_ACCESSIBLE_IN_PLACE, getCpuAgent().handle});
} else {
attr.push_back({HSA_AMD_SVM_ATTRIB_AGENT_ACCESSIBLE_IN_PLACE, getBackendDevice().handle});
if (first_alloc) {
// Provide access to all possible devices.
//! @note: HMM should support automatic page table update with xnack enabled,
//! but currently it doesn't and runtime explicitly enables access from all devices
for (const auto dev : devices()) {
attr.push_back({HSA_AMD_SVM_ATTRIB_AGENT_ACCESSIBLE_IN_PLACE,
static_cast<Device*>(dev)->getBackendDevice().handle});
}
} else {
attr.push_back({HSA_AMD_SVM_ATTRIB_AGENT_ACCESSIBLE_IN_PLACE, getBackendDevice().handle});
}
}
break;
case amd::MemoryAdvice::UnsetAccessedBy:
@@ -2257,9 +2267,6 @@ bool Device::SvmAllocInit(void* memory, size_t size) const {
if (settings().hmmFlags_ & Settings::Hmm::EnableSystemMemory) {
advice = amd::MemoryAdvice::UnsetPreferredLocation;
SetSvmAttributesInt(memory, size, advice);
} else {
advice = amd::MemoryAdvice::SetPreferredLocation;
SetSvmAttributesInt(memory, size, advice);
}
if ((settings().hmmFlags_ & Settings::Hmm::EnableMallocPrefetch) == 0) {
-8
查看文件
@@ -745,14 +745,6 @@ bool Buffer::create() {
} else {
deviceMemory_ = owner()->getSvmPtr();
kind_ = MEMORY_KIND_PTRGIVEN;
#if AMD_HMM_SUPPORT
if (memFlags & CL_MEM_ALLOC_HOST_PTR) {
// Currently HMM requires cirtain initial calls to mark sysmem allocation as
// GPU accessible or prefetch memory into the current device
// @note: Skip any allocaiton here, since sysmem was allocated on another device.
dev().SvmAllocInit(deviceMemory_, size());
}
#endif // AMD_HMM_SUPPORT
}
if ((deviceMemory_ != nullptr) && (dev().settings().apuSystem_ || !isFineGrain)) {