mirror of
https://github.com/Niko1221/Strata.git
synced 2026-12-03 19:03:30 +07:00
[PR #4763] [Engine] opt-in Zen 5 gather, IQ4_NL 512-bit down, and V-Cache pool #5170
Labels
No labels
needs-format
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Niko1221/Strata#5170
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/Niko1221/Strata/pull/4763
Author: @Yoshiki-Matsuda
Created: 10/30/2026
Status: 🔄 Open
Base:
main← Head:engine/opt-in-vcache-cpu-paths📝 Commits (3)
dcc20e1[Engine] keep Zen 5 gather, IQ4_NL 512-bit down, and the V-Cache pool opt-inabf2d09[Engine] query L3 only on Linux so the Metal build compilesa4ff1d0[Engine] call the AVX-512 Hadamard only on x86📊 Changes
14 files changed (+816 additions, -67 deletions)
View changed files
📝
docs/DETAILS.md(+8 -0)📝
include/strata/kernels/cpu/expert_layout.hpp(+11 -0)📝
include/strata/kernels/cpu/iq_avx512.hpp(+10 -0)📝
include/strata/kernels/cpu/pool.hpp(+5 -0)📝
include/strata/kernels/cpu/pool_plan.hpp(+78 -0)📝
src/kernels/cpu/expert_layout.cpp(+77 -0)📝
src/kernels/cpu/hadamard.cpp(+9 -0)📝
src/kernels/cpu/iq_avx512.cpp(+288 -46)📝
src/kernels/cpu/kq_cpu_bench.cpp(+93 -11)📝
src/kernels/cpu/native_expert.cpp(+44 -0)📝
src/kernels/cpu/pool.cpp(+137 -9)📝
src/kernels/cpu/pool_plan_test.cpp(+48 -0)📝
src/kernels/cpu/portable.cpp(+6 -0)📝
tools/check_isa_guard.py(+2 -1)📄 Description
Summary
STRATA_IQ_GATHER=1gathers i-quant codebooks. That is already the default on Intel CPUs where gathers are fast. On Zen 5 it also sends one token of IQ3_XXS and IQ3_S through the 512-bit exact rows, unlessSTRATA_NO_IQ512X1=1.STRATA_IQ4NL512=1uses a 512-bit IQ4_NL down kernel after a one-time check against this build's ggml dot.STRATA_VCACHE_POOL=1fuses gate and up, uses a 512-bit Hadamard rotation, aligns CPU expert tasks to 16 rows, and on a two-CCD X3D places workers on the larger L3. A one-CCD CPU keeps its usual core order.No prior issue. #4055 asks for IQ4_NL gate/up format support and is a different change.
What was measured
Decode tokens/s was not measured. The numbers below are one CPU-pool microbench on synthetic
iq3_s/iq4_nlexperts (kq_cpu_bench --pool --hadamard), not astratagenerate run.Machine: Windows, Ryzen 7 9800X3D (Zen 5, one CCD, 96 MB L3, AVX-512). Eight threads, host thread pinned to core 0. Same binary, flags off against flags on. "1 token" means one token routed to that expert. "2" and "4" mean that many tokens of a verify window share the expert, as with
--spec/ MTP. It is not the length of the reply.Weight-read rate, GB/s, off to on:
One token is not consistently slower: two of the five sizes were faster. Another run of the on side at 49 MB and one token read 41.9, 44.3, and 51.8 GB/s, so the smaller gaps sit inside run-to-run noise. Two and four tokens were faster in this sweep (+7% to +29%) and were not repeated enough to treat that as a decode result.
On this CPU the V-Cache placement does nothing: every core shares the 96 MB L3. The on side still changes fused gate/up, the 512-bit Hadamard, 16-row task edges, gather, and the IQ4_NL down kernel.
The same PC's usual IQ3_S serve is a two-GPU layer split. The fast card (170 SMs, 2.41 GHz) runs layers 0–46. The second card (82 SMs, 1.70 GHz, 6.4 GB/s host-to-device) runs layer 47 only. Startup predicted about 98% of profiled routed mass in the two caches, and long replies were about 60–110 tok/s. The CPU only computes cache misses, so a change in the table above does not move those tok/s by the same percent. That serve was not re-run with these flags.
How to turn it on
Use a build that contains this commit. A released engine from before this pull request does not have
STRATA_IQ4NL512orSTRATA_VCACHE_POOL.On the 9800X3D above, all three switches together are the whole patch.
STRATA_VCACHE_POOL=1does not move threads on that one-CCD CPU. Put them in the model config's"env"object and restart:Unset means off.
STRATA_IQ_GATHER=0forces scalar codebook loads.STRATA_NO_IQ512X1=1keeps one-token IQ3_XXS / IQ3_S on ggml's dot even when gather is on.A two-CCD X3D (7900X3D, 7950X3D, 9900X3D, 9950X3D) is the only case where
STRATA_VCACHE_POOL=1also places workers on the 96 MB CCD and the host thread on the 32 MB CCD. That placement was checked with a synthetic topology inpool_plan_test. It was not timed on a two-CCD machine.Test plan
STRATA_PORTABLE=ON) on Windows, Ryzen 7 9800X3D.pool_plan_test,pool_cores_test,pool_tasks_test(648 bitwise comparisons),q8k_quant_parity,iq512_gather_parity(gather off),iq_avx2_parity(0 failures),native_arithmetic_parity(4,866,048 comparisons).STRATA_VCACHE_POOL=1(pool_tasks_test),STRATA_VCACHE_POOL=1plusSTRATA_IQ4NL512=1(native_arithmetic_parity), andSTRATA_IQ_GATHER=1(iq512_gather_parity, types 18, 21, 22).isa_guard_checkon that portableiq_avx2_parity.exe: 4718 functions, 145 with wide instructions, 0 not allowed.cmake --build build-cuda --config Release --target strataon this PC (CMAKE_CUDA_ARCHITECTURES=native).build-cuda/Release/strata.exelinked, including the changed CPU objects.hipccis not installed) and SYCL (icpxis not installed). Intel SDE AVX2-only and AVX-VNNI-only runs were not run. End-to-end decode tokens/s was not measured.These paths stay opt-in because the CPU microbench does not justify changing the default.
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.