diff --git a/runtime/hsa-runtime/core/inc/amd_memory_region.h b/runtime/hsa-runtime/core/inc/amd_memory_region.h index 8ff7844b34..51df2c4f81 100644 --- a/runtime/hsa-runtime/core/inc/amd_memory_region.h +++ b/runtime/hsa-runtime/core/inc/amd_memory_region.h @@ -193,7 +193,7 @@ class MemoryRegion : public core::MemoryRegion { // fragments of the block routing to the same MemoryRegion. mutable KernelMutex access_lock_; - static const size_t kPageSize_ = 4096; + static size_t kPageSize_; // Determine access type allowed to requesting device hsa_amd_memory_pool_access_t GetAccessInfo(const core::Agent& agent, diff --git a/runtime/hsa-runtime/core/runtime/amd_memory_region.cpp b/runtime/hsa-runtime/core/runtime/amd_memory_region.cpp index b564773eed..d9a16f19d3 100644 --- a/runtime/hsa-runtime/core/runtime/amd_memory_region.cpp +++ b/runtime/hsa-runtime/core/runtime/amd_memory_region.cpp @@ -50,12 +50,14 @@ #include "core/inc/amd_gpu_agent.h" #include "core/util/utils.h" #include "core/inc/exceptions.h" +#include namespace rocr { namespace AMD { // Tracks aggregate size of system memory available on platform size_t MemoryRegion::max_sysmem_alloc_size_ = 0; +size_t MemoryRegion::kPageSize_ = sysconf(_SC_PAGESIZE); void* MemoryRegion::AllocateKfdMemory(const HsaMemFlags& flag, HSAuint32 node_id, size_t size) { @@ -137,7 +139,7 @@ MemoryRegion::MemoryRegion(bool fine_grain, bool kernarg, bool full_profile, virtual_size_ = kGpuVmSize; } else if (IsSystem()) { - mem_flag_.ui32.PageSize = HSA_PAGE_SIZE_4KB; + mem_flag_.ui32.PageSize = MemoryRegion::kPageSize_; mem_flag_.ui32.NoSubstitute = 0; mem_flag_.ui32.HostAccess = 1; mem_flag_.ui32.CachePolicy = HSA_CACHING_CACHED;