mirror of
https://github.com/Niko1221/Strata.git
synced 2026-12-03 19:03:30 +07:00
[PR #4811] [Engine] stage mode-8 expert weight tiles on sm_121 #5192
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#5192
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/4811
Author: @InB4DevOps
Created: 10/31/2026
Status: 🔄 Open
Base:
main← Head:perf/sm121-weight-tiles📝 Commits (1)
fed5ec8CUDA: stage mode-8 weight tiles on sm_121📊 Changes
1 file changed (+52 additions, -12 deletions)
View changed files
📝
src/kernels/cuda/iq_kernels.cu(+52 -12)📄 Description
Problem and result
The mode-8 fused routed-expert gate/up kernel reads the same 16 contiguous weight rows again for every entry in an active group chunk. On a GB10 this is a measurable part of the fixed-work verify window.
This change has the block copy each 16-row gate/up tile to shared memory once per up-to-four-entry chunk, then reuse it across the entries. The submitted path is selected automatically only on compute capability 12.1. It adds no setting and leaves the CUDA/HIP fallback specialization in place.
On one NVIDIA DGX Spark, a 16-run fixed-work alternating gate measured:
The machine was noisy: individual pair gains ranged from -24.97% to +50.18%. The aggregate passes the gate, but 14.23% should not be read as a stable point estimate.
Related discussion
I searched open and closed issues and pull requests before the change. The closest prior work was #242, #646, #1418, and #2058. None stages these mode-8 gate/up weight rows once per chunk pass.
Approach
native_gu_fused_kernel.int4, compute from the shared tile, and synchronize before reusing it.For TG16, TG18, TG21, TG22, and TG23, the submitted staged PTX matches the measured candidate after symbol/label normalization. The five fallback PTX instruction bodies match the clean baseline after normalizing only the template labels and dynamic-shared-memory symbol name.
Performance evidence
Environment: commit
c62d5e3aplus this focused change, Ubuntu 24.04 aarch64, NVIDIA GB10 (compute capability 12.1), driver 580.178.04, CUDA 13.0.88, Qwen3.8-Flash-Next IQ3_S. The retained stack wasSTRATA_EXP_MODE=8,STRATA_SIDE_MIXER=2,STRATA_SPEC_COST=0,STRATA_SH_FORK_LATE=0, and--suffix-draft 0.The balanced order was
ABBABAABBAABABBA. A was baseline binary SHA-2567a907ec5aaa7576ba57eb120ada478c6469d810e58b0e30cd77785cefdf7df04; B was candidate binary SHA-25661e1e7f893aca25aca5224f306f980c67537bfdd80d2945de1fee46e4b95f8d6.The T4-window aggregates were +13.8345% paired median, +12.6907% geometric mean, +6.5973% AB median, and +18.8246% BA median. An earlier four-run ABBA screen measured +5.7336% paired median, +5.7294% geometric mean, +4.7957% AB, and +6.6715% BA.
All 16 gate runs:
T1:1 T2:0 T3:0 T4:149;0:12 1:16 2:19 3:103;95d9d5e1aa6f14c1b3d570c03b3b998dafb2d9e05f974fd83ce7aa8a91e2b86a;0 of 512 emitted tokens differ from the argmax.A same-source kernel screen at 40 groups and 4 tokens measured these gate/up medians:
Applying that mix to graph 23 projected a 1.667 ms saving, or 3.61% of its 46.130 ms kernel window.
Validation
Revision/environment tested:
fb1a4dc6495740b70ad8cb0e6b66f748e5aa527a; Ubuntu 24.04 aarch64, NVIDIA GB10 (compute capability 12.1), driver 580.178.04, CUDA 13.0.88, Qwen3.8-Flash-Next IQ3_S.Passed:
fb1a4dc6495740b70ad8cb0e6b66f748e5aa527ainrocm/dev-ubuntu-24.04:10.1.0-full.cmake -S . -B build-hip -G Ninja -DCMAKE_BUILD_TYPE=Release -DSTRATA_ENABLE_HIP=ON -DSTRATA_ENABLE_CUDA=OFF -DSTRATA_BUILD_TESTS=OFF -DCMAKE_HIP_ARCHITECTURES=gfx1100configured successfully, andcmake --build build-hip --target strata -j2built and linked the HIPstrataexecutable.cmake --build build-sm121 --target native_expert_bench native_expert_parity strata -j2: built all three focused targets at the revision above.ctest --test-dir build-sm121 --output-on-failure -R '^native_expert_parity_.*$': 11/11 passed at the revision above.ctest --test-dir build-sm121 --output-on-failure -R '^check_cuda_spills_unit$': 1/1 passed.CUDA_VISIBLE_DEVICES=0 build-sm121/native_expert_bench /home/admin/.local/share/strata/Strata-data/models/IQ3_S/Qwen3.8-Flash-Next-GSQ-RCO-IQ3_S-00001-of-00002.gguf 1,7,17,47 40 4 0 8 100: zero differences. The four layer hashes were476ae862f4a8b64f,45f75025c61e9599,af8a9aa1a03ece30, andcc2ec90789bf3865.T1:1 T2:0 T3:0 T4:149, output SHA-25695d9d5e1aa6f14c1b3d570c03b3b998dafb2d9e05f974fd83ce7aa8a91e2b86a, zero argmax differences, and no OOM. The exact binary SHA-256 was2845c7e2f66c9e6268a091a8c65d3593e17ebef6ba300c806c520933c3c6b648.cuobjdump: all five staged specializations use zero stack and zero local memory.git diff --check.Failed:
ctest --test-dir build-sm121 --output-on-failure -R '^cuda_spill_guard$'fails on existing unallowlisted kernels across the build. It also names fallback TG21, whose 8-byte stack use matches the clean baseline. The five staged specializations use zero stack/local memory.cmake --build build-sm121 -j2reaches an unrelated ARM configuration failure wheremmq_nvfp4_parityreceives unsupported-mf16c. The focused targets above build.Not run:
ERR_NVGPUCTRPERMwithout administrator access.Limits
This was measured only on one DGX Spark and one fixed IQ3_S decode workload. It changes only mode 8 on sm_121. The isolated IQ4_XS gate/up microbenchmark regressed, while the measured graph mix and fixed-work end-to-end aggregate improved. Other models, group distributions, and hardware remain unmeasured.
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.