Repository navigation
Conversation
…fill Add a BLOCK_Q Gluon specialization of fp8_mqa_logits for the gfx950 (CDNA4) DSA / lightning-indexer prefill shape (short query x long KV) under context-parallel ragged ranges, as used by GLM-5.x / DeepSeek-V3.2 sparse attention. It shares one double-buffered KV tile across 2 adjacent query rows, reusing the existing gfx950 building blocks (MQAAsyncKVLoader / _mqa_dot / _weighted_sum_fma_fold / _load / _store), so the MFMA layout and head reduction match the stock single-row path. General ragged (reads real cu_start/cu_end), handles an odd tail row, writes only the valid [start,end) span (clean_logits=False). fp8_mqa_logits() dispatches via a tuned config table keyed by (num_heads, head_dim); unsupported shapes fall back to the stock row-per-program kernel. Design note vs DeepGEMM/TileLang: those fix UMMA_N=128 (BLOCK_Q=128/num_heads) since the accumulator lives in Tensor Memory; on gfx950 the MFMA accumulator is in registers, so the fill target is one MFMA M-tile (32) and KV-share / BLOCK_KV / waves_per_eu are separate occupancy knobs - over-packing rows loses here. Validated on MI355X (Q=6156,K=49243,CP ke=1+row*8), median vs stock, all max_abs<=3e-5: (32,128) 1.35x, (16,128) 1.45x, (8,128) 1.48x, (32,64) 1.23x, (16,64) 1.33x. num_heads==64 spans 2 M-tiles (register pressure) and loses (0.92x), so it is excluded and falls back. E2E validated through the top-level fp8_mqa_logits.
Contributor
🏷️ CI GuideRuns automatically on every PR:
Extended tests (opt-in via labels):
|
4 of 5 tasks
Contributor
|
@YukioZzz Can you do a head-to-head comparison against the main aiter? The existing kernel has similar idea so I would like to see how it compares. If you notice there are cases main is not performing, I think it is better to fix the existing kernel instead of creating a specific one unless it is structurally very different. |
Contributor
|
For example, the following patch seems to resolve the gap in a cleaner way: |
1 task done
Contributor
|
No activity for 15 days, so this is now labelled |
This branch has not been deployed
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.
Motivation
Add a BLOCK_Q Gluon specialization of fp8_mqa_logits for the gfx950 (CDNA4) DSA / lightning-indexer prefill shape (short query x long KV) under context-parallel ragged ranges, as used by GLM-5.x / DeepSeek-V3.2 sparse attention. It shares one double-buffered KV tile across 2 adjacent query rows, reusing the existing gfx950 building blocks (MQAAsyncKVLoader / _mqa_dot / _weighted_sum_fma_fold / _load / _store), so the MFMA layout and head reduction match the stock single-row path. General ragged (reads real cu_start/cu_end), handles an odd tail row, writes only the valid [start,end) span (clean_logits=False).
Technical Details
fp8_mqa_logits() dispatches via a tuned config table keyed by (num_heads, head_dim); unsupported shapes fall back to the stock row-per-program kernel. Design note vs DeepGEMM/TileLang: those fix UMMA_N=128 (BLOCK_Q=128/num_heads) since the accumulator lives in Tensor Memory; on gfx950 the MFMA accumulator is in registers, so the fill target is one MFMA M-tile (32) and KV-share / BLOCK_KV / waves_per_eu are separate occupancy knobs - over-packing rows loses here.
Test Plan
Test Result
Validated on MI355X (Q=6156,K=49243,CP ke=1+row*8), median vs stock, all max_abs<=3e-5: (32,128) 1.35x, (16,128) 1.45x, (8,128) 1.48x, (32,64) 1.23x, (16,64) 1.33x. num_heads==64 spans 2 M-tiles (register pressure) and loses (0.92x), so it is excluded and falls back. E2E validated through the top-level fp8_mqa_logits.
Submission Checklist