From f310c7f64227cf4ab93ebee63702436b6a19073d Mon Sep 17 00:00:00 2001 From: "Sang, Tao" Date: Tue, 1 Jul 2025 00:39:47 -0400 Subject: [PATCH] SWDEV-539145 - Support extended fine grained system memory pool (#195) * Add hipHostMalloc() new flag hipHostMallocUncached which will force to allocate pinned host memory on extended fine grained system memory pool. * Add hipHostAlloc() new flag hipHostAllocUncached which will force to allocate pinned host memory on extended fine grained system memory pool. * Add hipHostRegister() new flag hipHostRegisterUncached which will force to map host memory onto extended fine grained system momory pool. --- include/hip/hip_runtime_api.h | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/include/hip/hip_runtime_api.h b/include/hip/hip_runtime_api.h index f9f9a1ac01..e96769113b 100644 --- a/include/hip/hip_runtime_api.h +++ b/include/hip/hip_runtime_api.h @@ -767,6 +767,15 @@ enum hipLimit_t { * @note This flag is the same definition as #hipHostAllocWriteCombined which is equivalent to * cudaHostAllocWriteCombined.*/ #define hipHostMallocWriteCombined 0x4 + +/** +* Host memory will be forcedly allocated on extended fine grained system memory +* pool which is with MTYPE_UC. +* @note This allocation flag is applicable on AMD devices in Linux only. +*/ +#define hipHostMallocUncached 0x10000000 +#define hipHostAllocUncached hipHostMallocUncached + /** * Host memory allocation will follow numa policy set by user. * @note This numa allocation flag is applicable on Linux, under development on Windows. @@ -822,6 +831,11 @@ enum hipLimit_t { /** Coarse Grained host memory lock.*/ #define hipExtHostRegisterCoarseGrained 0x8 +/** Map host memory onto extended fine grained access host memory pool when enabled. + * It is applicable on AMD devices in Linux only + */ +#define hipExtHostRegisterUncached 0x80000000 + /** Automatically select between Spin and Yield.*/ #define hipDeviceScheduleAuto 0x0 @@ -4207,6 +4221,8 @@ hipError_t hipMemPoolImportPointer( * - #hipHostAllocPortable Memory is considered allocated by all contexts. * - #hipHostAllocMapped Map the allocation into the address space for the current device. * - #hipHostAllocWriteCombined Allocates the memory as write-combined. + * - #hipHostAllocUncached Allocate the host memory on extended fine grained access system + * memory pool * * @return #hipSuccess, #hipErrorOutOfMemory, #hipErrorInvalidValue */ @@ -4246,7 +4262,8 @@ hipError_t hipHostGetFlags(unsigned int* flagsPtr, void* hostPtr); * one context so this is always assumed true. * - #hipHostRegisterMapped Map the allocation into the address space for the current device. * The device pointer can be obtained with #hipHostGetDevicePointer. - * + * - #hipExtHostRegisterUncached Map the host memory onto extended fine grained access system + * memory pool. * * After registering the memory, use #hipHostGetDevicePointer to obtain the mapped device pointer. * On many systems, the mapped device pointer will have a different value than the mapped host