mirror of
https://github.com/Niko1221/Strata.git
synced 2026-12-03 19:03:30 +07:00
[PR #5498] [Engine] prefill: STRATA_IQ4_W4A8 on sm_75 (Turing): MMQ bits, prompt reads -2 % on 2x CMP 50HX #5471
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#5471
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/5498
Author: @xrip
Created: 11/7/2026
Status: 🔄 Open
Base:
main← Head:pr/iq4-w4a8-sm75📝 Commits (1)
dbc14f9prefill: STRATA_IQ4_W4A8 on sm_75 (Turing): register-staged K steps, m16n8k32 as four m8n8k16; MMQ's bits📊 Changes
5 files changed (+86 additions, -15 deletions)
View changed files
📝
CMakeLists.txt(+1 -1)📝
docs/DETAILS.md(+1 -1)📝
src/prefill/moe_iq4_w4a8.cu(+79 -8)📝
src/prefill/moe_mmq.cu(+2 -2)📝
tests/cuda/prefill_iq4_w4a8_test.cu(+3 -3)📄 Description
Problem and result
STRATA_IQ4_W4A8(the opt-in int8 kernel for the prompt's IQ4_XS / IQ4_NL expert products, from #4871) runs only on sm_80..sm_88 and sm_120, because it usescp.asyncand them16n8k32s8 MMA. Turing (sm_75) has neither, so there every product stays on MMQ. Turing does haveldmatrixand them8n8k16s8 MMA, which is enough for the same tile.With this change the kernel also runs on sm_75. It still gives MMQ's bits, and it is still opt-in. On 2x CMP 50HX (sm_75) with Swift 1.5 IQ3_S, whose IQ4_NL down products cover 39 of 48 layers,
STRATA_IQ4_W4A8=2reads prompts about 2 % faster: a 64K cold read takes 29.81 -> 29.19 s, a 172K read 68.91 -> 67.61 s. The answers are the same.Related discussion
#4871, where the kernel came from (it went into main through
7bf5ec4e). Not a default change: unsetSTRATA_IQ4_W4A8behaves as before on every card.Approach
Only the sm_75 path is new, under
#if __CUDA_ARCH__ >= 750 && < 800inmoe_iq4_w4a8.cu:cp.async, so the next K step's weight and activation pieces are read into registers before this step's MMAs, then stored to the other shared-memory stage after them. The two stages and one barrier per step stay as before (STAGES == 2is asserted).m16n8k32becomes fourm8n8k16MMAs from the same C. Rows g / g + 8 come from a0 / a1 and a2 / a3, against b0 (k 0..15) and b1 (k 16..31). The int32 sums are exact, so the C words are the same, and with them the existing epilogues (the EPI 1 magic-number trick included).arch_ok()takes 7.5. The test's arch check, the DETAILS.md row and two comments now name sm_75.The sm_80+ source is unchanged, with only
#iflines around it. The SASS of all 8 kernels for sm_86 and for sm_120 is identical to before (cuobjdump; kernel names normalized, since the anonymous namespace carries the file name; nvcc gives the same sm_86 SASS for the same file three times).Validation
Passed:
Hardware: 2x NVIDIA CMP 50HX (TU102, sm_75, 20 GB, 170 W limit, SM clock locked at 2,100 MHz), PCIe 2.0 x16, driver 610.43.03, CUDA 13.3.73, GCC 14.2, Ubuntu 24.04.4 (kernel 7.2.9-cmp50hx), 2x Xeon E5-2670 v2 (AVX only). Build:
-DSTRATA_ENABLE_CUDA=ON -DCMAKE_CUDA_ARCHITECTURES=75 -DSTRATA_ISA_FLOOR=avx. Revision: this commit's file on 0.2.12 (146df3c4); the box runs it inside a fork with other patches that do not touch these five files.CUDA_VISIBLE_DEVICES=0 prefill_iq4_w4a8_testwith no flags,--full,--tokens 97,--tokens 2049,--tokens 8191and--wide: "all identical on NVIDIA CMP 50HX (sm_75)" for every one. That is 3 routings each, 0 words differ, and the kernel ran gate/up and down products in every case (for example 15,360 tokens uniform: 589,824,000 words, kernel 32 + 32 products).prefill_iq4_w4a8_test --full --bench, MMQ time over the kernel's, 3 routings, bySTRATA_W4A8_CFG:ptxas for sm_75: 255 registers, 12-28 bytes of spill stores a thread.
Engine A/B,
--serve, 2 cards on--layer-split auto,--prefill auto:16384, Swift-1.5-Qwen3.8-Flash-Next-GSQ-RCO IQ3_S. Each start had the page cache dropped, then a warm-up, a 64K cold prompt, a 172K cold prompt (another first line), and 6 x 512 greedy tokens at ~8K. Arms interleaved N W W N, where N = 0.2.12 and W = N +STRATA_IQ4_W4A8=2; every other setting the same:Both W runs read faster than both N runs at both lengths. Exit counter: "ran 0 IQ4_XS and 20288 IQ4_NL products; declined ... MMQ would split K 128". Decode does not use this path; I saw 81.1 (N) and 83.2 (W) tok/s, which I count as noise between two binaries, not as a result.
Exactness in the engine (
STRATA_PREFILL_CPU_SHARE=0,--adapt-swaps 0,--pcie-frac 0.17): three greedy 200-token answers after 2K / 20K / 70K-token prompts. N against N (the control) and W against N give the same texts.SASS:
nvcc -arch=sm_86and-arch=sm_120 -cubinofmoe_iq4_w4a8.cubefore and after,cuobjdump -sass: 8 of 8 kernels identical on both.Failed:
Not run:
Limits
=2).=1passed the bit test but was not run in the engine.🤖 Generated with Claude Code
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.