-
Notifications
You must be signed in to change notification settings - Fork 39
Description
umfMemspaceHighestBandwidthGet does not allocate from HBM on SapphireRapids+HBM
Environment Information
- UMF version (hash commit or a tag): v0.10
$ git log
commit 5d37cac662736b7d63d1e232b513c3fb6ed3e842 (HEAD -> main, origin/main, origin/HEAD)
[...]
- OS(es) version(s):
- kernel version(s):
$ uname -a
Linux sap4 5.14.21-150400.24.81-default #1 SMP PREEMPT_DYNAMIC Tue Aug 8 14:10:43 UTC 2023 (90a74a8) x86_64 x86_64 x86_64 GNU/Linux
- Compiler
$ icx -v
Intel(R) oneAPI DPC++/C++ Compiler 2025.0.4 (2025.0.4.20241205)
- Other relevant libraries
numactl-2.0.14
hwloc/2.11.1
- System: SapphireRapids + HBM in SNC4 mode
$ lscpu
Architecture: x86_64
CPU op-mode(s): 32-bit, 64-bit
Address sizes: 46 bits physical, 57 bits virtual
Byte Order: Little Endian
CPU(s): 192
On-line CPU(s) list: 0-191
Vendor ID: GenuineIntel
Model name: Intel(R) Xeon(R) CPU Max 9468
CPU family: 6
Model: 143
Thread(s) per core: 2
Core(s) per socket: 48
Socket(s): 2
Stepping: 8
Frequency boost: enabled
CPU max MHz: 2101,0000
CPU min MHz: 800,0000
BogoMIPS: 4200.00
Flags: fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc art arch_perfmon pebs bt
s rep_good nopl xtopology nonstop_tsc cpuid aperfmperf tsc_known_freq pni pclmulqdq dtes64 monitor ds_cpl vmx smx est tm2 ssse3 sdbg fma cx16 xtpr pdcm pcid dca sse4_1 sse4_2 x2apic movb
e popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm abm 3dnowprefetch cpuid_fault epb cat_l3 cat_l2 cdp_l3 invpcid_single intel_ppin cdp_l2 ssbd mba ibrs ibpb stibp ibrs_enhanc
ed tpr_shadow vnmi flexpriority ept vpid ept_ad fsgsbase tsc_adjust bmi1 hle avx2 smep bmi2 erms invpcid rtm cqm rdt_a avx512f avx512dq rdseed adx smap avx512ifma clflushopt clwb intel_p
t avx512cd sha_ni avx512bw avx512vl xsaveopt xsavec xgetbv1 xsaves cqm_llc cqm_occup_llc cqm_mbm_total cqm_mbm_local split_lock_detect avx_vnni avx512_bf16 wbnoinvd dtherm ida arat pln p
ts avx512vbmi umip pku ospke waitpkg avx512_vbmi2 gfni vaes vpclmulqdq avx512_vnni avx512_bitalg tme avx512_vpopcntdq la57 rdpid bus_lock_detect cldemote movdiri movdir64b enqcmd fsrm md
_clear serialize tsxldtrk pconfig arch_lbr avx512_fp16 amx_tile flush_l1d arch_capabilities
Virtualization features:
Virtualization: VT-x
Caches (sum of all):
L1d: 4,5 MiB (96 instances)
L1i: 3 MiB (96 instances)
L2: 192 MiB (96 instances)
L3: 210 MiB (2 instances)
NUMA:
NUMA node(s): 16
NUMA node0 CPU(s): 0-11,96-107
NUMA node1 CPU(s): 12-23,108-119
NUMA node2 CPU(s): 24-35,120-131
NUMA node3 CPU(s): 36-47,132-143
NUMA node4 CPU(s): 48-59,144-155
NUMA node5 CPU(s): 60-71,156-167
NUMA node6 CPU(s): 72-83,168-179
NUMA node7 CPU(s): 84-95,180-191
NUMA node8 CPU(s):
NUMA node9 CPU(s):
NUMA node10 CPU(s):
NUMA node11 CPU(s):
NUMA node12 CPU(s):
NUMA node13 CPU(s):
NUMA node14 CPU(s):
NUMA node15 CPU(s):
Vulnerabilities:
Gather data sampling: Not affected
Itlb multihit: Not affected
L1tf: Not affected
Mds: Not affected
Meltdown: Not affected
Mmio stale data: Not affected
Retbleed: Not affected
Spec rstack overflow: Not affected
Spec store bypass: Mitigation; Speculative Store Bypass disabled via prctl and seccomp
Spectre v1: Mitigation; usercopy/swapgs barriers and __user pointer sanitization
Spectre v2: Mitigation; Enhanced IBRS, IBPB conditional, RSB filling, PBRSB-eIBRS SW sequence
Srbds: Not affected
Tsx async abort: Not affected
HMAT is also enabled:
$ grep CONFIG_ACPI_HMAT /boot/config-$(uname -r)
CONFIG_ACPI_HMAT=y
Please provide a reproduction of the bug:
$ taskset -c 0 ./build/examples/umf_example_memspace_hmat
Allocated memory at 0x14c0c165a000 from the highest bandwidth node: 1
Allocated memory at 0x14c0c165a000 from the lowest latency node: 0
How often bug is revealed:
always
Actual behavior:
umfMemspaceHighestBandwidthGet
allocates memory from NUMA node 1 (DDR).
Expected behavior:
umfMemspaceHighestBandwidthGet
allocates memory from (local) HBM NUMA node.
Details
Since this CPU has HBM connected, it is a semantical error if umfMemspaceHighestBandwidthGet
allocates from DDR instead of HBM. Allocating from NUMA node 1 when running on CPU 0 with taskset -c 0
is even worse than allocating from NUMA node 0, which is also DDR, but closer to CPU 0.
The desired behavior would be to allocate from the closest proximity HBM NUMA node. This would be NUMA node 8 on this CPU. See the output of numactl -H
:
$ numactl -H
available: 16 nodes (0-15)
node 0 cpus: 0 1 2 3 4 5 6 7 8 9 10 11 96 97 98 99 100 101 102 103 104 105 106 107
node 0 size: 64132 MB
node 0 free: 61658 MB
node 1 cpus: 12 13 14 15 16 17 18 19 20 21 22 23 108 109 110 111 112 113 114 115 116 117 118 119
node 1 size: 64505 MB
node 1 free: 61513 MB
node 2 cpus: 24 25 26 27 28 29 30 31 32 33 34 35 120 121 122 123 124 125 126 127 128 129 130 131
node 2 size: 64505 MB
node 2 free: 63757 MB
node 3 cpus: 36 37 38 39 40 41 42 43 44 45 46 47 132 133 134 135 136 137 138 139 140 141 142 143
node 3 size: 64505 MB
node 3 free: 62177 MB
node 4 cpus: 48 49 50 51 52 53 54 55 56 57 58 59 144 145 146 147 148 149 150 151 152 153 154 155
node 4 size: 64505 MB
node 4 free: 63986 MB
node 5 cpus: 60 61 62 63 64 65 66 67 68 69 70 71 156 157 158 159 160 161 162 163 164 165 166 167
node 5 size: 64459 MB
node 5 free: 63834 MB
node 6 cpus: 72 73 74 75 76 77 78 79 80 81 82 83 168 169 170 171 172 173 174 175 176 177 178 179
node 6 size: 64505 MB
node 6 free: 62546 MB
node 7 cpus: 84 85 86 87 88 89 90 91 92 93 94 95 180 181 182 183 184 185 186 187 188 189 190 191
node 7 size: 64456 MB
node 7 free: 63130 MB
node 8 cpus:
node 8 size: 16384 MB
node 8 free: 16280 MB
node 9 cpus:
node 9 size: 16384 MB
node 9 free: 16377 MB
node 10 cpus:
node 10 size: 16384 MB
node 10 free: 16330 MB
node 11 cpus:
node 11 size: 16384 MB
node 11 free: 16316 MB
node 12 cpus:
node 12 size: 16384 MB
node 12 free: 16330 MB
node 13 cpus:
node 13 size: 16384 MB
node 13 free: 16346 MB
node 14 cpus:
node 14 size: 16384 MB
node 14 free: 16356 MB
node 15 cpus:
node 15 size: 16384 MB
node 15 free: 16362 MB
node distances:
node 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
0: 10 12 12 12 21 21 21 21 13 14 14 14 23 23 23 23
1: 12 10 12 12 21 21 21 21 14 13 14 14 23 23 23 23
2: 12 12 10 12 21 21 21 21 14 14 13 14 23 23 23 23
3: 12 12 12 10 21 21 21 21 14 14 14 13 23 23 23 23
4: 21 21 21 21 10 12 12 12 23 23 23 23 13 14 14 14
5: 21 21 21 21 12 10 12 12 23 23 23 23 14 13 14 14
6: 21 21 21 21 12 12 10 12 23 23 23 23 14 14 13 14
7: 21 21 21 21 12 12 12 10 23 23 23 23 14 14 14 13
8: 13 14 14 14 23 23 23 23 10 14 14 14 23 23 23 23
9: 14 13 14 14 23 23 23 23 14 10 14 14 23 23 23 23
10: 14 14 13 14 23 23 23 23 14 14 10 14 23 23 23 23
11: 14 14 14 13 23 23 23 23 14 14 14 10 23 23 23 23
12: 23 23 23 23 13 14 14 14 23 23 23 23 10 14 14 14
13: 23 23 23 23 14 13 14 14 23 23 23 23 14 10 14 14
14: 23 23 23 23 14 14 13 14 23 23 23 23 14 14 10 14
15: 23 23 23 23 14 14 14 13 23 23 23 23 14 14 14 10
- hwloc reads the HMAT table and reports higher bandwidths correctly (output of
lstopo
is truncated, note that hwloc uses a different NUMA node numbering compared tonumactl
):
$ lstopo -v
[...]
Relative latency matrix (name NUMALatency kind 5) between 16 NUMANodes (depth -3) by logical indexes:
index 0 2 4 6 8 10 12 14 1 3 5 7 9 11 13 15
0 10 12 12 12 21 21 21 21 13 14 14 14 23 23 23 23
2 12 10 12 12 21 21 21 21 14 13 14 14 23 23 23 23
4 12 12 10 12 21 21 21 21 14 14 13 14 23 23 23 23
6 12 12 12 10 21 21 21 21 14 14 14 13 23 23 23 23
8 21 21 21 21 10 12 12 12 23 23 23 23 13 14 14 14
10 21 21 21 21 12 10 12 12 23 23 23 23 14 13 14 14
12 21 21 21 21 12 12 10 12 23 23 23 23 14 14 13 14
14 21 21 21 21 12 12 12 10 23 23 23 23 14 14 14 13
1 13 14 14 14 23 23 23 23 10 14 14 14 23 23 23 23
3 14 13 14 14 23 23 23 23 14 10 14 14 23 23 23 23
5 14 14 13 14 23 23 23 23 14 14 10 14 23 23 23 23
7 14 14 14 13 23 23 23 23 14 14 14 10 23 23 23 23
9 23 23 23 23 13 14 14 14 23 23 23 23 10 14 14 14
11 23 23 23 23 14 13 14 14 23 23 23 23 14 10 14 14
13 23 23 23 23 14 14 13 14 23 23 23 23 14 14 10 14
15 23 23 23 23 14 14 14 13 23 23 23 23 14 14 14 10
Memory attribute #2 name `Bandwidth' flags 5
NUMANode L#0 = 219100 from cpuset 0x00000fff,,,0x00000fff (Group0 L#0)
NUMANode L#2 = 219100 from cpuset 0x00fff000,,,0x00fff000 (Group0 L#1)
NUMANode L#4 = 219100 from cpuset 0x0000000f,0xff000000,,0x0000000f,0xff000000 (Group0 L#2)
NUMANode L#6 = 219100 from cpuset 0x0000fff0,,,0x0000fff0,0x0 (Group0 L#3)
NUMANode L#8 = 219100 from cpuset 0x0fff0000,,,0x0fff0000,0x0 (Group0 L#4)
NUMANode L#10 = 219100 from cpuset 0x000000ff,0xf0000000,,0x000000ff,0xf0000000,0x0 (Group0 L#5)
NUMANode L#12 = 219100 from cpuset 0x000fff00,,,0x000fff00,,0x0 (Group0 L#6)
NUMANode L#14 = 219100 from cpuset 0xfff00000,,,0xfff00000,,0x0 (Group0 L#7)
NUMANode L#1 = 743650 from cpuset 0x00000fff,,,0x00000fff (Group0 L#0)
NUMANode L#3 = 743650 from cpuset 0x00fff000,,,0x00fff000 (Group0 L#1)
NUMANode L#5 = 743650 from cpuset 0x0000000f,0xff000000,,0x0000000f,0xff000000 (Group0 L#2)
NUMANode L#7 = 743650 from cpuset 0x0000fff0,,,0x0000fff0,0x0 (Group0 L#3)
NUMANode L#9 = 743650 from cpuset 0x0fff0000,,,0x0fff0000,0x0 (Group0 L#4)
NUMANode L#11 = 743650 from cpuset 0x000000ff,0xf0000000,,0x000000ff,0xf0000000,0x0 (Group0 L#5)
NUMANode L#13 = 743650 from cpuset 0x000fff00,,,0x000fff00,,0x0 (Group0 L#6)
NUMANode L#15 = 743650 from cpuset 0xfff00000,,,0xfff00000,,0x0 (Group0 L#7)
[...]
Additional information about Priority and Help Requested:
Are you willing to submit a pull request with a proposed change? (Perhaps)
Requested priority: (Showstopper if you want to use this library function to allocate memory from HBM on this CPU)
- It also does not work as expected in the (discontinued)
Memkind
library:
$ memkind-hbw-nodes
0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15
This should report 8,9,10,11,12,13,14,15
instead.
- Intel Compiler's, LLVM's and GCC's OpenMP implementations of the high bandwidth memory allocator rely on
Memkind
they do not work correct, too.