Enabled allocation of pseudo fine grain memory where memory ordering is per point to point connection

Atomic memory operations on these memory buffers are not guaranteed
to be visible at system scope

Change-Id: I4cccde114632071a000384502a83bc191e77e85b
Этот коммит содержится в:
skhatri authored and Jonathan Kim committed 2022-07-29 15:15:56 -04:00
1 родитель d962fc39bb
Коммит 364715cbc6
5 files changed
+31 -13

No files matched your search

+4 -8
Просмотреть файл
@@ -188,6 +188,9 @@ hsa_status_t MemoryRegion::AllocateImpl(size_t& size, AllocateFlags alloc_flags,
if (IsSystem() && (alloc_flags & AllocateIPC))
kmt_alloc_flags.ui32.NonPaged = 1;
// Allocate pseudo fine grain memory
kmt_alloc_flags.ui32.CoarseGrain = (alloc_flags & AllocatePCIeRW ? 0 : kmt_alloc_flags.ui32.CoarseGrain);
// Only allow using the suballocator for ordinary VRAM.
if (IsLocalMemory()) {
bool subAllocEnabled = !core::Runtime::runtime_singleton_->flag().disable_fragment_alloc();
@@ -451,8 +454,7 @@ hsa_amd_memory_pool_access_t MemoryRegion::GetAccessInfo(
// without regard to type of requesting device (CPU / GPU)
// Return disallowed by default if framebuffer is fine grained
// and requesting device is connected via xGMI link
// Return never allowed if framebuffer is fine grained and
// requesting device is connected via PCIe link
if (IsLocalMemory()) {
// Return disallowed by default if memory is coarse
@@ -461,12 +463,6 @@ hsa_amd_memory_pool_access_t MemoryRegion::GetAccessInfo(
return HSA_AMD_MEMORY_POOL_ACCESS_DISALLOWED_BY_DEFAULT;
}
// Determine if pool is pseudo fine-grained due to env flag
// Return disallowed by default
if (core::Runtime::runtime_singleton_->flag().fine_grain_pcie()) {
return HSA_AMD_MEMORY_POOL_ACCESS_DISALLOWED_BY_DEFAULT;
}
// Return disallowed by default if memory is fine
// grained and link type is xGMI.
if (agent.HiveId() == owner()->HiveId()) {
+6 -3
Просмотреть файл
@@ -686,7 +686,7 @@ hsa_status_t hsa_amd_memory_pool_allocate(hsa_amd_memory_pool_t memory_pool, siz
TRY;
IS_OPEN();
if (size == 0 || ptr == NULL || flags != 0) {
if (size == 0 || ptr == NULL || (flags > HSA_AMD_MEMORY_POOL_PCIE_FLAG)) {
return HSA_STATUS_ERROR_INVALID_ARGUMENT;
}
@@ -697,8 +697,11 @@ hsa_status_t hsa_amd_memory_pool_allocate(hsa_amd_memory_pool_t memory_pool, siz
return (hsa_status_t)HSA_STATUS_ERROR_INVALID_MEMORY_POOL;
}
return core::Runtime::runtime_singleton_->AllocateMemory(
mem_region, size, core::MemoryRegion::AllocateRestrict, ptr);
MemoryRegion::AllocateFlags alloc_flag = core::MemoryRegion::AllocateRestrict;
if (flags == HSA_AMD_MEMORY_POOL_PCIE_FLAG) alloc_flag |= core::MemoryRegion::AllocatePCIeRW;
return core::Runtime::runtime_singleton_->AllocateMemory(mem_region, size, alloc_flag, ptr);
CATCH;
}