mirror of
https://github.com/Niko1221/Strata.git
synced 2026-12-03 19:03:30 +07:00
[GH-ISSUE #4157] [Engine] gfx906 prefill: native MMVQ for the dense projections of small prompt chunks #1820
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#1820
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?
Originally created by @KevinX8 on GitHub (Oct 25, 2026).
Original GitHub issue: https://github.com/Niko1221/Strata/issues/4157
Problem: on gfx906 (MI50, no matrix cores) an agent turn that adds 100-500 tokens to a cached conversation spends most of its batched prompt pass in the dense projections. Swift 1.5 GSQ-RCO IQ3_S,
STRATA_PREFILL_TIMING=1, a 170-token chunk: about 930 of 1,730 ms GPU time in hc read / gdn / qsa proj / gdn out proj. For each quantized projection the prompt path dequantizes the GGUF blocks to FP16 into the scratch and runs a rocBLAS GEMM; at small T neither is close to what the card can do.Proposed behavior (opt-in, no default change):
STRATA_PF_MMVQ=1makesGemm::nativetake chunks of up toSTRATA_PF_MMVQ_MAX_Ttokens (default 256) through decode's existing native MMVQ on the GGUF blocks, 8 token columns per call (activations FP16 -> FP32 -> Q8_1, as decode does). It declines (old path, nothing written) for beta != 0, strided X or Y, a typenative_mmvq_supported()rejects, or K not a whole number of the type's blocks. One fixed 16 MiB workspace perGemm, allocated at first use.Tradeoffs:
Gemm::native(the q36 engine for T 9..256, the MTP draft Q8_0 projections, the PLE key). Only Qwen3.8-Flash-Next was quality-checked.Numbers (MI50, Swift 1.5,
--kv int8, 20k cached context, read wall time per turn, two passes; both columns withSTRATA_HIP_PROMPT_F16=1,STRATA_PREFILL_CPU_SHARE=auto,STRATA_PREFILL_CPU_SHARE_MAX=4096,--short-read 128):STRATA_PF_MMVQ=1(<= 256)Thresholds of 512 and up slow ~480-token chunks (3.06-3.24 s); 2048 slows ~1,300-token chunks (6.73-7.61 s).
Quality (a 2,048-token prefix read by the batched path, then the
codeandagentsegments ofdata/quant_quality/v1scored through the decode windows, top-64 KL against the unchanged build): with the threshold raised to 512 so the harness's 512-token chunks take the path, mean KL 0.065, top-1 93.4%, PPL 2.869 against 2.860. The unchanged build with only--prefill 768/1024instead of 512 scores 0.052 / 0.052 (PPL -2.2% / -4.1%), so this sits at the level of a pure reordering of the prefix's sums.Asking: is an opt-in, gfx906-measured switch in
Gemm::nativeacceptable, and should it stay gfx906-only? A draft PR with the change and a parity test is ready (linked below once opened).@KevinX8 commented on GitHub (Oct 25, 2026):
Draft PR with the change and the parity test: https://github.com/Niko1221/Strata/pull/4158 (stacked on #4156, which the gfx906 build needs). Measurements of the related existing switches: https://github.com/Niko1221/Strata/issues/4159
@KevinX8 commented on GitHub (Oct 28, 2026):
Update: #4158 is rebased onto v0.2.7.1 and no longer carries the stream-priority shim; the gfx906 build needs #3986 for that. Rebuilt with #3986 applied,
pf_mmvq_paritypasses again (rel RMS 5.7e-3 to 6.1e-3).@Niko1221 commented on GitHub (Nov 5, 2026):
Thanks for taking the time to report this.
Strata has changed a lot since this was opened, and 0.2.11 is out now, so many older reports no longer apply. We're closing issues older than a week that have had no new reports in the last week. Closed here does not mean rejected.
To reopen it takes about two minutes:
/reopen. A check runs and either reopens the issue or lists what is still missing.The rules are in CONTRIBUTING.md.