mirror of
https://github.com/Niko1221/Strata.git
synced 2026-12-03 19:03:30 +07:00
[PR #1718] [CLOSED] Perf/gfx906 qsa reduce12 #3629
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#3629
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/1718
Author: @0FL01
Created: 10/9/2026
Status: ❌ Closed
Base:
main← Head:perf/gfx906-qsa-reduce12📝 Commits (3)
26f776aperf(gfx906): add guarded opt-in query LDS swizzle for batched QSA1f555dedocs(gfx906): record 200K and API qualification for the combined candidate08a844dgfx906: add opt-in reduce12 QSA score reduction📊 Changes
7 files changed (+1203 additions, -4 deletions)
View changed files
📝
CMakeLists.txt(+5 -0)➕
bench/gfx906_qsa_query_swizzle_probe.cpp(+284 -0)➕
bench/results/2026-10-08-gfx906-qsa-query-swizzle/README.md(+127 -0)➕
bench/results/2026-10-08-gfx906-qsa-query-swizzle/results.json(+519 -0)➕
bench/results/2026-10-08-gfx906-qsa-query-swizzle/service-qualification.json(+1 -0)➕
bench/test_gfx906_qsa_query_swizzle_guard.py(+130 -0)📝
src/kernels/cuda/qsa_decode_attn.cu(+137 -4)📄 Description
gfx906: add opt-in QSA reduce12 score reduction
Summary
Depends on #1661, at
1f555de86254cc01ec06882c70f9584c1f09ec39. This follow-on changes score reduction in its INT8 query-swizzled batched QSA path: twelve warp sums become one reduce-scatter with the same butterfly pairings, reducing score shuffles from 60 to 16. Softmax, value accumulation, merge and the published pre75/DPP implementation are unchanged.This adapts the existing
reduce12<DPP>reduce-scatter and head-of-lane mapping in main to gfx906. The algorithm already exists in the pre75 implementation; its normal HIP build guard excludes gfx906. That implementation is untouched.Default-off. Set
STRATA_GFX906_ATTN_QUERY_SWIZZLE=1andSTRATA_GFX906_ATTN_REDUCE12=1, with lane-cell scoring disabled. The new flag requires exactly1. Dispatch retains #1661's current-device gfx906/wave64 guard and INT8 restriction.STRATA_GFX906_ATTN_REDUCE12_TRACE=1reports actual selection once per host thread. Cached environment settings require separate processes for A/B.Public-source component validation
The exact public QSA translation unit and unchanged
bench/gfx906_qsa_query_swizzle_probe.cppwere compiled and linked against the frozen support archive, with its old QSA object removed. Symbol/link-map checks confirm the new object supplies QSA; the original archive is unchanged. This is an isolated component build, not a full public-tree build.n_q=32, context 65,536, 50 timed repetitions per process, A1/B1/B2/A2: GPU 0 mean process medians 1.0384395 → 0.7608800 ms, 26.728519% lower latency; GPU 1 1.0323620 → 0.7586825 ms, 26.510032% lower latency. These are component latency reductions, not model TPS gains.n_q=1/context=4and masked-pagen_q=33/context=4096also pass full-output parity. The probe checks finite/written outputs, guards and first/final invocation equality. Separate trace smokes confirm actual reduce12 selection; timing arms have trace disabled.ec0a11258848d6e2bf6ca0bbe463f06eada460a72be10ff5bb4dce065abe3ab0. Probe binary:eff7174652dccc4129ab719e4425c288f93379fd43f3bc59faa758236ecd5f28.Tests use two gfx906 wave64 GPUs, pinned build image
sha256:bccb7ee7e7a78274519db9a43ba63c34ddd2e74bb60f8764a8f50aaee1f2c646, patched AMD Clang23.0.0git, and-O3 -DNDEBUG -std=c++20 --offload-arch=gfx906. The stable API was restored healthy with the same executable; no configuration change or production promotion occurred.Frozen-stack model evidence
Whole-model 65,536-token prompt / 1,024-output A/B/B/A: PP 625.033728 → 646.536120 tok/s (+3.440197%); TG 52.280242 → 53.106939 tok/s (+1.581280%). Individual pairs: PP +3.43809% / +3.44230%, TG +1.61839% / +1.54418%. All 1,024 output IDs match across the four arms.
These model results toggle only reduce12 on the frozen qualified8900 experimental stack: base
f152172332693c933b8a3104ce193d8a4315c2b4plus HC, J32/grouped-MMQ, dequantization, query swizzle, empty-PCIe and primary-commit changes. Both arms retainSTRATA_PRIMARY_COMMIT_OVERLAP=1; trace is off. Those host optimizations are measurement context, excluded from this implementation patch. This is separate from the public component build above.That frozen reduce12 candidate also passed a 4,096-token / 1,024-output pair (+3.070518% PP, +1.328129% TG, all IDs exact), 200,000-token / 256-output capacity/parity (616.858242 PP, 45.537017 TG, exact archived-reference IDs), and targeted tools, two vision trials, cache restoration, auth/UI and disconnect/cancel checks. The 200K run has no fresh performance control. Earlier raw-score micro parity remains diagnostic evidence; no score-only kernel or test macro is added to production.
Archived report and receipts document the frozen qualification. No full-model run on the public port, full-tree build, upstream CI pass or general-workload speedup is claimed.
Reproduce the component check
The unchanged CMake target is
gfx906_qsa_query_swizzle_probe; it needs the gfx906 HIP backend. The measured build used the isolated object/archive link described above. With the resulting binary inPROBE, run each GPU separately:Use nonconflicting device-visibility settings. Before timing, run a separate flag-on process with
STRATA_GFX906_ATTN_REDUCE12_TRACE=1and requireselected=1. For edge parity, repeat off/on with arguments1 4 20 output.binand33 4096 20 output.bin --masked-pages. Compare complete dumps. Average the two A process medians and the two B process medians; latency reduction is100*(A_mean-B_mean)/A_mean.Integration
This is a stacked follow-on: until #1661 merges, the comparison against upstream
mainalso contains its inherited seven-file, two-commit change. The incremental reduce12 commit alone changes the QSA source by +74/−3 lines. #1661's body and implementation history are preserved.Production changes are confined to
src/kernels/cuda/qsa_decode_attn.cu, with current fixedG=12. Unmerged #1402 uses the third kernel template argument forG; #1661 uses it forQUERY_SWIZZLE, and this addsREDUCE12fourth. Integration needs explicit template/dispatch reconciliation and must retain aG=12gate until other geometries are separately qualified.🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.