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
This commit is contained in:
@@ -89,6 +89,7 @@ class MemoryRegion : public Checked<0x9C961F19EE175BB3> {
|
||||
AllocateDoubleMap = (1 << 2), // Map twice VA allocation to backing store
|
||||
AllocateDirect = (1 << 3), // Bypass fragment cache.
|
||||
AllocateIPC = (1 << 4), // System memory that can be IPC-shared
|
||||
AllocatePCIeRW = (1 << 5), // Enforce pseudo fine grain/RW memory
|
||||
};
|
||||
|
||||
typedef uint32_t AllocateFlags;
|
||||
|
||||
@@ -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()) {
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user