SWDEV-555888 - Refactor Numa code (#1191)

1. Create a set of mini numa interface.
In Linux, the interface is based on system call rather than libnuma.
In Windows, the interface can also work, but the policy class is dummy.
Different from Linux, Windows doesn't provide numactl tool or numa lib to setup numa policy, thus
the default policy is followed in Windows, that is, using the closest host numa node to allocate
pinned host memory in hipHostMalloc().
To get the closest host numa node of a GPU device, you need query the new attribute
hipDeviceAttributeHostNumaId. Then you can create a thread with CPU affinity on the numa node.
For example, reference the test in hip-tests/catch/perftests/memory/hipPerfHostNumaAllocWin.cc.

2. Remove pfnSetThreadGroupAffinity and pfnGetNumaNodeProcessorMaskEx as the functions have been exposed since Win7 and Win server 2008.

3. Other minor fixes.
This commit is contained in:
MachineTom
2025-10-23 21:56:15 -04:00
committed by GitHub
parent 602ea0be1e
commit 5f76cb916d
18 changed files with 631 additions and 134 deletions
@@ -557,6 +557,8 @@ typedef enum hipDeviceAttribute_t {
///< hipHostRegister
hipDeviceAttributeMemoryPoolSupportedHandleTypes, ///< Supported handle mask for HIP Stream
///< Ordered Memory Allocator
hipDeviceAttributeHostNumaId, ///< NUMA ID of the cpu node closest to the device,
///< or -1 when NUMA isn't supported
hipDeviceAttributeCudaCompatibleEnd = 9999,
hipDeviceAttributeAmdSpecificBegin = 10000,