Repository navigation
Conversation
… (opt-in STRATA_HIP_WMMA, gfx12/gfx11) The S6 matrix-core prompt attention was RDNA4-only; gfx1100 kept the ordered FP32 fallback - measured at 25.6-26.9% of prefill GPU time at 32K/128K on a 7900 XTX. RDNA3 runs the same v_wmma_f32_16x16x16_f16 instruction through the unsuffixed builtin, whose wave32 fragment layout differs from the gfx12 builtin's on all three operands (AMD Matrix Instruction Calculator, rdna3 tables, hardware-confirmed by a standalone probe): A[l&15][i], B[j][l&15], D[(l>>4)+2j][l&15]. The packing sites re-index accordingly; softmax, staging, scales and the online-softmax protocol are unchanged; the K side keeps one cell per lane so the per-cell scale folds as before. Parity (upstream's hip_prompt_attn_wmma, first time it runs off gfx12): 3/3 PASS, vs FP64 3.3-4.5e-06 (old kernel 1.8-2.1e-06, same class); kernel 4.17-4.91x per chunk. Paired e2e on the 7900 XTX (production-mirrored config, 5 pairs x 1k/32k/128k, arms alternate): prefill +22.8% median @128k (5/5) and +17.9% @32k (5/5), decode flat (protection cap holds). Opt-in unchanged: STRATA_HIP_WMMA=1.
Niko1221#368 content) Carried from the pr-qsa-select-wmma-rdna3 branch (0.1.38 rebase 7e8adda) onto the current line (0.1.39 + the RDNA3 WMMA prompt-attention arm). The gfx11 kernel keeps its rename (block_scores_wmma_gfx11_kernel; the gfx12 kernel keeps the plain name), the arch dispatch inside qsa_block_scores_tc routes gfx12 -> gfx1100-under-opt-in -> false (warp fallback), and the arm prints once so no fallback can masquerade. Parity + bench re-registered in CMake.
…diagnostic The nightly SDK's newer clang no longer contracts the warp kernel's 4-product dot into any single host-emulable shape (it interleaves the four head-accumulators through v_fmac; previously the harness pinned fma-left on the 7.1.1 toolchain). The pinned-pattern check is a warp-kernel drift detector, not the WMMA arm's contract - the arm's gates are the FP64-oracle bound, selection-id agreement, the bitwise tail, the canaries and the negative controls. The pattern set grew from three to six shapes and the check prints as a WARN when no shape fits 100%.
Contributor
Author
|
Closing in favor of the refreshed |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Companion to #786: the same RDNA3 WMMA treatment for the QSA select/scorer path, which the profiler puts at ~12-14% of 128K prefill on gfx1100.
What
qsa_block_scores_wmma: a gfx11 (RDNA3) WMMA block-scorer arm. Dispatch inqsa_block_scores_tc(qsa_select.cu) tries the gfx12 WMMA kernel first, then this arm underSTRATA_SELECT_WMMA(opt-in; default unchanged). The tail block keeps the warp kernel's arithmetic (sharedblock_scores_tail_kernel, bitwise) and the+1e9dead-tail rule is exact.src/kernels/qsa_select_wmma_parity.cpp(new): ragged query/block tiles, whole tiles, an x8-magnitude FP16-headroom case, degenerate n_kv=0, one-hot lane/store-adversarial case.Arithmetic contract and parity (pre-derived before the kernel, rollout records §18): WMMA arm = FP16 inputs / FP32 accumulation; bound per entry B = 2^-9.5·S + 8·2^-24·|score| against a float64 oracle (S = the |k·q| magnitude sum, computed in f64 in the harness). Measured on the 10.2 nightly SDK: worst bound utilisation 11.0% across all cases, 0 differing selection IDs (top-k over warp vs WMMA scores, near-tie-gap guard), tail block bitwise the warp arm's, write-set canaries intact, negative control (+2.5·B perturbation) fails as required. The warp arm's host-model contraction pin (7.1.1-era: fma-left) no longer fits the nightly clang's
v_fmacinterleaving; the harness now enumerates six contraction shapes and reports the best fit as a diagnostic, with the oracle bound + selection agreement + tail check as the hard gates.Measured, paired A/B (RX 7900 XTX, 0.1.39 + #786 arm-on in BOTH arms, arms differ only in
STRATA_SELECT_WMMA; 5 pairs × 1k/32k/128k, odd pairs a-first):Mechanism: the
qsa selectphase drops 10249 ms → 1952 ms (5.25×; 11.8% → 2.4% of 128K prefill). Consistent with the earlier 0.1.33 measurement (+9.8% @128k, scorer microbench 11.6×). Decode: no regression in any tier (medians; the one 51.9 tok/s outlier in b-128k-p2 does not move the median).Opt-in only.
STRATA_SELECT_WMMA=1enables the arm; the default path and the gfx12 arm are untouched.