[Triton/Gluon] [gfx950] add an optimized prefill fp8_mqa_logits for H64D128 - #5048
Dewei-Wang-sh wants to merge 2 commits into
Conversation
Dispatched on gfx950 + seq_len >= 4096 Bench shows ~15% perf lift on 4Kx4K seqlen and dsv4 8K seqlen Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
🏷️ CI GuideRuns automatically on every PR:
Extended tests (opt-in via labels):
PR title tags: |
There was a problem hiding this comment.
Pull request overview
This PR adds a gfx950-specific optimized Gluon FP8 MQA logits kernel variant for the H=64, D=128, seq_len≥4096 regime, and wires it into the existing fp8_mqa_logits dispatch to deliver the reported long-context throughput gains.
Changes:
- Adds a new
_gluon_fp8_mqa_logits_kernel_H64D128kernel optimized aroundBLOCK_M=4and triple buffering. - Extends the head-reduction planning logic to support an additional leading “row” axis needed by the tiled M dimension.
- Updates the Python wrapper dispatch to select the new kernel on gfx950 when the required features and shape constraints are met.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
aiter/ops/triton/attention/fp8_mqa_logits.py |
Adds import + dispatch routing to the new gfx950 H64D128 optimized Gluon kernel for seq_len≥4096. |
aiter/ops/triton/_gluon_kernels/gfx950/attention/fp8_mqa_logits.py |
Implements the new H64D128 kernel and adapts the reduction plan to handle BLOCK_M>1. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| and ASYNC_COPY_SUPPORTS_DISTRIBUTED | ||
| and num_heads == 64 | ||
| and head_size == 128 | ||
| and seq_len >= 4096 | ||
| ): |
|
|
||
| @gluon.jit | ||
| def _gluon_fp8_mqa_logits_kernel_H64D128( |
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 2 out of 2 changed files in this pull request and generated no new comments.
Suppressed comments (4)
aiter/ops/triton/_gluon_kernels/gfx950/attention/fp8_mqa_logits.py:971
- New Gluon entry kernel
_gluon_fp8_mqa_logits_kernel_H64D128is launchable but does not set a config-awarerepr. The project’s kernel checklist requiresmake_kernel_repr(...)+@gluon.jit(repr=...)so compiled variants are identifiable in traces/logs (seeaiter/ops/triton/README.md:304-305).
@gluon.jit
def _gluon_fp8_mqa_logits_kernel_H64D128(
Q_ptr, # fp8e4m3 [seq_len, NUM_HEADS, HEAD_SIZE]
aiter/ops/triton/attention/fp8_mqa_logits.py:217
# FIXME: unify laterleaves an explicitly unfinished dispatch path in a production wrapper. Please either (a) link to a tracking issue and clarify what remains to be unified, or (b) replace with a more specific TODO explaining the invariants that prevent unification today.
# gfx950 H64D128 variant:
# FIXME: unify later
if (
aiter/ops/triton/_gluon_kernels/gfx950/attention/fp8_mqa_logits.py:967
# FIXME: Unifying the two with full coverageis an unresolved note in a new kernel section. Please convert this to a TODO with a tracking issue (or remove it) so it’s clear what remaining correctness/perf gaps exist and how unification will be validated.
# Separate kernel rather than a BLOCK_M branch in the one above: the loop
# shapes genuinely differ (peeled double-buffer vs uniform triple-buffer with
# refill-at-top) and the store paths. Shares this module's reduction plan.
# FIXME: Unifying the two with full coverage
aiter/ops/triton/attention/fp8_mqa_logits.py:224
- This PR adds a new dispatch path for gfx950 H=64, D=128 with
seq_len >= 4096, but the existing unit test matrix forfp8_mqa_logitsonly coverss_q <= 1024(seeop_tests/triton_tests/attention/test_fp8_mqa_logits.py). That means the new kernel can regress correctness/perf without being exercised in CI. Please add at least one correctness smoke test that triggers this branch (e.g.,seq_len=4096,num_heads=64,head_dim=128, with a smallseq_len_kvand a narrow window to keep the reference tractable).
if (
arch == "gfx950"
and _gluon_fp8_mqa_logits_kernel_H64D128 is not None
and ASYNC_COPY_SUPPORTS_DISTRIBUTED
and num_heads == 64
and head_size == 128
and seq_len >= 4096
):
|
close since this has the same perf as #5216, yet pr5216 is more general |

Dispatched on gfx950 + seq_len >= 4096
Bench shows ~15% perf lift on 4Kx4K seqlen and dsv4 8K seqlen on mi350
1x4096x4096, ratio 14x8192, ratio 4 (dsv4)