mirror of
https://github.com/Niko1221/Strata.git
synced 2026-12-03 19:03:30 +07:00
[PR #2804] [Engine] sycl: KREG small-batch mmvq kernels for Q4_K/Q5_K/Q6_K/IQ4_XS at 1-8 columns (opt-in STRATA_MMVQ_KREG=1) #4273
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#4273
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/2804
Author: @hotschmoe
Created: 10/16/2026
Status: 🔄 Open
Base:
main← Head:pr/sycl-mmvq-kreg📝 Commits (1)
0928c7asycl: KREG small-batch mmvq kernels for Q4_K/Q5_K/Q6_K/IQ4_XS at 1-8 columns (opt-in STRATA_MMVQ_KREG=1)📊 Changes
5 files changed (+774 additions, -1 deletions)
View changed files
📝
docs/INTEL.md(+55 -0)📝
sycl/CMakeLists.txt(+1 -1)📝
sycl/include/strata/kernels/native_mmvq.hpp(+1 -0)📝
sycl/src/kernels/cuda/native_mmvq.dp.cpp(+312 -0)➕
sycl/src/kernels/mmvq_kreg_parity.cpp(+405 -0)📄 Description
Problem and result
On the Arc Pro B70 the SYCL port's decode GEMVs for Q4_K, Q5_K, Q6_K and IQ4_XS (
native_mmvq, 1-8 columns) are bound by instruction issue, not memory: the wide kernels re-read every column's activations for every row. This adds an opt-in kernel family, KREG: one work-group covers a row's whole K, each lane loads its slice of every column's activations once into registers, and the group streams tiles of 2-8 rows against them.STRATA_MMVQ_KREG=1turns it on. Unset, the default path is unchanged (output identical to main, measured below).Result on 0.2.0-beta, two B70s, one stream: the verify window 39.4 / 40.0 -> 35.4 / 35.4 ms (-10% / -12%), decode 70.6 / 73.9 -> 83.2 / 91.0 tok/s. Part of the tok/s gain is the changed output drafting better on these prompts; the window time is the fair comparison. Prompt reading unchanged.
Related discussion
Feature issue #2803 (closed in the 0.2.0 tracker reset). No maintainer agreement on scope yet. Independently tested by @deriknel on two B70s with
--pipeline-windows 2and a 26-layer split (comment below, before the reset): the bench windows 8% shorter, +7% mean over five greedy prompts, flag unset matching the build without the PR, a 148K prompt, image input and a 5-minute soak with no failed request or xe reset. Thank you.Approach
sycl/src/kernels/cuda/native_mmvq.dp.cpp:native_mmvq_kreg_kernelwith traitsKregQ4K,KregQ5K,KregQ6K,KregIQ4XS(the wide kernels' lane split and dot expressions; K-quant scales decoded branch-free; IQ4_XS's codebook from a 256-entry local table), a transposed sub-group butterfly and a double-buffered local sum across sub-groups. Rows per tile and the 256-register mode per format and column count come from a sweep on the B70.try_kreg<F>()reads the latched flag first and declines n_in above 32,768 and misaligned matrices; the existing kernels then run as before. One guarded hook per entry point; the output head goes throughnative_mmvq, so it is covered.native_q6_k_mmvqnow hasq6_planar_mmvqwhere this PR adds its hook. Order kept asSTRATA_Q6_PACKED, then planar, then KREG (the same resolution @deriknel used), so a planar copy is never bypassed.sycl/src/kernels/mmvq_kreg_parity.cpp(new, in the parity loop,--selftest): KREG and the default kernels against a float64 reference over the same bytes for each format, 5 shapes and 1-8 columns; T-column KREG bitwise equal to T one-column calls; a power check.--benchtimes both on random weights.sycl/include/strata/kernels/native_mmvq.hppanddocs/INTEL.md.Left alone: other formats (Q8_0, IQ4_NL, IQ3_S, Q2_0, ...), the multi/small/wave kernels, tensors packed by
STRATA_Q6_PACKED,include/,src/, CUDA/HIP.Validation
Setup: 0.2.0-beta
maine88ee39dagainst this branch rebased on it. 2x Intel Arc Pro B70 32 GB, kernel 7.1, Compute Runtime 26.22.38646.4 at run time; built with the repository dev image (sycl/tools/Dockerfileon the currentllama-sycl-b70:stable, IGC 2.41.5; an older cached base with IGC 2.36.3 cannot build 0.2.0, see #3219), AOTbmg-g31. Model Qwen3.8-Flash-Next ISTA GSQ-RCO IQ3_XXS,--layer-split 30 --prefill 8192 --max-context 65536 --kv int8 --spec 4 --mtp <BF16 draft layer> --mtp-max-t 4 --spec-min-p 0 --stream-experts --expert-cache auto, one slot, greedy, two fixed coding prompts with 512-token replies, a fresh engine per arm, then fresh 4K and 32K prompts. Coherence check and per-card health after every stop.Passed:
mmvq_kreg_parity --selftest(0.2.0-beta + this branch, head0928c7ad, one B70):mmvq_kreg_parity: 0 failures,mmvq_kreg_parity OK.e88ee39dSTRATA_MMVQ_KREG=1Failed: none observed.
Not run: the
--benchkernel timings on 0.2.0 (kernel code unchanged by the rebase; the earlier table is indocs/INTEL.md), two streams on main (--batch-mtprefused on a layer split),--max-context 200000, CUDA/HIP builds (not touched), Arc A-series,ctestas a whole.Limits
docs/INTEL.mdsection quotes the earlier measurement on 0.1.xmain296b59d2; I can swap in the 0.2.0 numbers above.🤖 Generated with Claude Code
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.