mirror of
https://github.com/Niko1221/Strata.git
synced 2026-12-03 19:03:30 +07:00
[PR #622] [CLOSED] iq: gather the AVX2 codebook from the grid table (STRATA_IQ256_GATHER) #2725
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#2725
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/622
Author: @yannickloth
Created: 10/3/2026
Status: ❌ Closed
Base:
main← Head:perf/iq-gateup📝 Commits (10+)
6dd890cbench: sm_86 baseline for the A3000 tuning work, and a fixed-prompt e2e harness19242c6native head: report the cudaHostAlloc error, not just "cannot pin N MiB"c37b5cbbench: add the A3000 A/B harness7c802ddbench/a3000-tune.sh: stop/start systemd user unit, do not overwrite nix-managed engine67de86cbench/a3000-tune.sh: drop sudo prlimit, document systemd DefaultLimitMEMLOCK4d64dacbench/a3000-tune.sh: correct the memlock docs, skip A when the 0.1.18 backup is missingf78b931bench/a3000-tune.sh: 44 GiB hugepage pool (the arena is 39.97 GiB, not 34)dd63ba8bench/a3000-tune.sh: drop the A arm (the 0.1.18 backup engine is gone)0605f8aMerge upstream v0.1.38 (99f3dbd) into perf/am47f9371cfiq: gather the AVX2 codebook from the grid table (STRATA_IQ256_GATHER)📊 Changes
5 files changed (+231 additions, -5 deletions)
View changed files
➕
bench/a3000-tune.sh(+97 -0)➕
bench/e2e.sh(+49 -0)➕
bench/results/2026-09-28-am47-baseline/README.md(+60 -0)📝
src/core/native_head.cpp(+4 -2)📝
src/kernels/cpu/iq_avx2.cpp(+21 -3)📄 Description
What
Add an opt-in AVX2 gather for the two IQ3 gate/up codebooks, the mirror of the AVX-512 kernels' existing
STRATA_IQ_GATHER.STRATA_IQ256_GATHER=1replaces the scalar_mm256_set_epi32grid assembly inFmt32<18>(IQ3_XXS,iq3xxs_grid) andFmt32<21>(IQ3_S,iq3s_grid) with one_mm256_i32gather_epi32. Default off; the engine is unchanged unless the variable is set.Why
The AVX2 multi-token kernel (
iq_avx2.cpp) is the path for the non-AVX-512 CPUs this engine targets (Intel Core 12th-14th gen, Core Ultra, Zen 2/3). P4 measured i-quant gate/up as the largest CPU term, and this file documents it as codebook-lookup bound. A scratch build that substitutes a constant for the grid vector shows the grid assembly is ~half the single-core kernel:IQ3_XXS + IQ3_S are 19 of 48 layers and ~58% of the gate/up lookup work on the Swift 1.5 IQ3_XXS pack, so this is where a runtime decode change can matter.
Numbers (i7-12850HX, Alder Lake, no AVX-512; RTX A3000; engine 0.1.38)
Isolated
native_expert_parity --synthetic, one thread, pinned to a P-core, weights L2-resident, gate+up one token:Serve A/B, same binary,
bench/e2e.sh, fixed prompt, interleaved,decode_tok_sfrom/metrics(off / on): 36.4/36.8, 36.9/37.0, 36.5/36.9, 37.1/37.1, 35.9/36.9 — median 36.5/36.9, mean 36.56/36.94 (+1.0%), on ≥ off 5/5.The deterministic
--statspool is flat (gate/up off 9.756 / on 9.773 ms/round): at 15 workers the pool is not decode-bound enough for the gather to move the whole token, so this is a per-core win that compounds with other work, not a structural one.Parity
cmpclean; 7680 bytes each).native_expert_paritystays green with the switch on and off (samerel ≈ 3.1e-08against ggml'svec_dot), width invariance 0 rows.i64gathermeasured a wash (IQ2_XXS 184→185 us, IQ2_S 246→284 us), and are unchanged.Caveats
STRATA_IQ_GATHER(that one measured 3-5% slower on Zen 4). It should not be defaulted on.Full write-up with the raw runs: #616 (and the plan's P7). Model/config: Swift 1.5 IQ3_XXS pack,
--adapt-every 1 --pool-workers 15, fixed prompthit_rate 0.5509.🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.