perf(tensilelite): group A2AGemm token blocks by contiguous runs and pick the group count per shape #16608
All Vouch review confidence checks passed
Residual risk 0.38 = Change Risk (0.66) × (1 − Review Confidence (0.43)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.66 · 376 lines diff across 4 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.02 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size
diff_size
0.355
Shallow Review Depth
shallow_review_depth
0.344
Sensitive Paths
sensitive_paths
0.066
Real PR Conversation Timeline
1 comments
"Review active on #16608"
general
weight: 0.35
yzhang93
JIRA ID : ROCM-27524
Motivation
A2AGemm is the TensileLite GEMM kernel that gathers matrix B's K slices from the other GPUs while it multiplies (#14168, #15352). With W GPUs, W−1 SDMA copy queues deliver the slices, and each token block (a set of output rows) reads them in a rotated order so the queues serve different blocks at once. Blocks with the same order form a peer group and read the same part of matrix A at the same time, so they can share it in the L2 cache. The groups interleaved the blocks across each batch, which spread a group's reads of A, and the number of groups was fixed by a formula even though the best count differs by shape.
Stacked on #16606. It also carries the commit of #16607, whose SGPR-hazard scanner the A2AGemm test uses.
Technical Details
countblocks now forms ceil(count / ceil(count / (W−1))) groups instead of min(W−1, count), so 8 blocks at W = 8 form 4 groups of 2 instead of 7. The SDMA enqueuer issues one ATOMIC packet per non-empty group.A2APeerGroups(0–7, valid only with A2AGemm), caps the number of groups: 0 uses the default above and k ≥ 1 uses at most k groups. A non-zero value addsAAPG<k>to the kernel name, so existing kernel names do not change.v_readfirstlanewrote them, which gfx950 does not allow. Both reads now follow two unrelated scalar instructions, at no extra cost.A2APeerGroups3. A non-zeroA2APeerGroupswas kept only where it won every one of 10 interleaved timing rounds.adr/0039-record-a2apeergroups-parameter.mdrecords them for the bulk-snapshot check.Test Plan
comm/gfx950/a2a_gemm_loop.yamladds batch sizes that stress the grouping and anA2APeerGroups1/2/7 group.test_a2a_gemm_loop_char.pyruns the emitted group arithmetic on worlds 2 to 8 and batches of 1 to 70 blocks, and checks every kernel for SGPR hazards. On MI355X the A2AGemm comm config was also run before and after the enqueuer fix on integer inputs from a fixed seed, using a test client that prints a hash of every output.Test Result
All 12,796 outputs of
a2a_gemm_loop.yamlare bitwise identical before and after the enqueuer fix, and a repeated run gives the same bits. The unit suite shows only the failures that develop shows in the same environment. On 8 MI355X GPUs, the comm configs pass with full validation at every world from 2 to 8, the hipBLASLt fused tests pass, andhipblaslt-bench-a2a --verifypasses and selects the solution in the logic for each shape.Submission Checklist