Repository navigation
Conversation
…eads them With a NUMA strategy (--numa distribute / isolate) the repack mul_mat uses a static row split and threads are bound to nodes, but the repacked weights were written by the loading thread, so all of them sit on one node. Each thread now moves the pages of its row slice of a weight to its own node the first time it computes that weight (move_pages, once per weight and thread count, Linux only). Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
Built on Windows (MSYS2 UCRT64 GCC 16.2, Tested with Claude Code. |
|
Thanks. It's opt-in ( A few suggestions:
|
bri-prism
left a comment
There was a problem hiding this comment.
The placed key shifts a uintptr_t by 48 bits. On 32-bit Linux this shift is undefined and Clang rejects it with -Werror=shift-count-overflow. I reproduced it with the Armv7 Linux target. Please use a key that stores the pointer and thread count as separate fields so it works on both pointer widths.
Overview
With a NUMA strategy (
--numa distributeorisolate) the repackforward_mul_matdisables dynamic chunking, so every thread always reads the same row slice of a weight, and threads are bound to nodes. The repacked weights, however, are written by the loading thread, so all of them end up on one node: half of the threads read remote memory and the whole matmul waits for them.This PR makes each thread move the pages of its row slice of a repacked weight to its own node (
move_pages) the first time it computes that weight. It runs once per weight and thread count, only on Linux, only whenggml_is_numa(). Nothing changes without--numa.Additional information
2x Xeon Gold 6262 (Cascade Lake, 24 cores per socket), Linux, GCC 14,
-DGGML_NATIVE=ON. Page placement of the repacked weights during decode (/proc/PID/numa_maps), PQ2_0: before 6.34 GiB on one node, after 3.21 / 3.14 GiB.Ternary-Bonsai-2-27B-PQ2_0.gguf, baseprism+ #245 + #246 + #249 + #250,llama-bench -ngl 0 --numa distribute -p 0 -n 64 -r 3, two rounds:numactl --interleave=allnumactl --interleave=all--numallama-completion --numa distribute -t 24: eval 4.09 -> 6.97 t/s (two runs: 6.97, 7.01). Load time grows by about 1 s (the pages move during the warmup decode); prompt eval time is unchanged.The same patch on upstream master
633733d0awithQwen3-8B-Q4_K_M(Q4_K is repacked on AVX2),--numa distribute -p 512 -n 64:numactl --interleave=allnumactl --interleave=allpp512 is unchanged (within noise) in all cases. Greedy completions are identical with and without the PR.
Limits: if prompt processing and generation use different thread counts, the pages are moved again for the second one. With
--numa numactlthreads are not bound per node by ggml, so the placement follows wherever each thread runs at its first use.Requirements
🤖 Generated with Claude Code