perf(k3.1): fuse decode AttnRes mixes into the collectives on gfx950 #3493
All Vouch review confidence checks passed
Residual risk 0.17 = Change Risk (0.43) × (1 − Review Confidence (0.60)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.43 · 390 lines diff across 4 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.17 · 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.357
Shallow Review Depth
shallow_review_depth
0.289
Real PR Conversation Timeline
1 comments
"Review active on #3493"
general
weight: 0.35
Yu-Zhewen
Summary
Three changes to Kimi-K3.1 decode on gfx950, up to 32 rows. Each removes a launch or a wait between a layer's attention, its MoE and the next layer's input, and all keep the outputs bit-exact.
attnres_combinereduced the attention partial with a Lamport all-reduce and ran the row epilogue in a second launch. One Lamport two-shot now does both: seven programs per row exchange the row's column tiles, and one more waits for the gathered row and runs the epilogue.attnres_combineread the MoE tail's output back to mix its attention input. The tail now gathers each row, writes it, and runs the single-term merge and out-norm inattnres_combine's order, so the next layer skips its combine. Layers whose tail declines the mix, or that run the fused AttnRes graph, are unchanged.Results
Kernel times at Kimi K3.1 TP8 shapes, CUDA graph, µs per call:
| Change | 8 rows | 16 rows | 32 rows |
|---|---:|---:|---:|
| All-reduce + AttnRes epilogue (8x MI350X) | 9.07 → 7.20 | 9.44 → 7.44 | 10.45 → 8.29 |
| Next mix in the MoE gather tail (8x MI350X) | 14.66 → 11.69 | 14.83 → 12.25 | 15.40 → 13.16 |
| Self-sorted routing, with the shared down (one gfx950 GPU) | 9.58 → 7.77 | 9.69 → 7.96 | 10.01 → 8.47 |
InferenceX AgentX at concurrency 1 on 8x MI355X, each change against its parent, averaged over same-node pairs (each pair runs both builds for an hour on one node):
| Change | Pairs | Throughput | Interactivity |
|---|---:|---:|---:|
| All-reduce + AttnRes epilogue | 2 | +0.6% | +1.1% |
| Next mix in the MoE gather tail | 2 | +0.8% | +1.6% |
| Self-sorted routing | 1 | +1.1% | +0.9% |
Runs of one build agree within about 0.6% in interactivity.
At concurrency 4 the next mix in the MoE gather tail raised interactivity by 2.8% and lowered throughput by 3.6% on average over two pairs, inside that concurrency's run-to-run throughput spread of up to 7%.
Test Plan
On gfx950:
test_iris_communication.pychecks the fused two-shot against the Lamport all-reduce plus epilogue and the push one-shot, andtest_iris_moe_gather_tail.pychecks the tail's rows and mixed rows against the tail without a mix andattnres_combine, all bit for bit.test_kimi3_sorted_routing_gfx950.pyadds 8, 13 and 33 rows and checks that each launch leaves the next launch's arrival masks zeroed.test_kimi_k3_attn_res.pyfor handing the mix to the tail. Ten FlashInfer sampling cases fail on main as well; FlashInfer has no ROCm kernels.