Repository navigation
Conversation
For the quadrant schedule (one wave per SIMD on 128x256 and 256x256 tiles): - Move the next K-tile's fence and its first K-step operand loads (scales, B left half, A top half) into the current K-tile's last K-step, into carry registers, and split that barrier around the third quadrant (signal before, wait after) so its WMMAs absorb the arrival skew between waves. - Interleave LDS loads with the WMMAs through scheduling group barriers (A-bottom/B-right loads over the first quadrant, the next K-tile's operands over the last) and compute their LDS addresses before each interleaved run, so expert scheduling pays one depctr_va_vdst wait per run instead of draining the WMMAs at every load. - Keep the pipeline under cluster launch: a multicast TDM load writes only the LDS of workgroups that issued it, after their own fence, so the workgroup barrier still guards every buffer reuse. - Broadcast the E8M0 block scales with v_perm_b32 (full rate) instead of a quarter-rate multiply by 0x01010101. - Set SCHED_MODE.DISABLE_XDL_ARB_STALL: with one wave per SIMD nothing else can use the cycles the arbiter holds after each WMMA. Results are bit-identical to the previous schedule. Signed-off-by: Jin Pan <jin.pan@amd.com>
select_gemm_a8w8_prefill_config(M, N, K, is_bsc) returns the tile, buffers and cluster dims for M > 256: 256x256 tiles with a 2x2 cluster, whose TDM multicast halves the L2-to-LDS tile traffic that bounds these GEMMs, or, for blockscale grids that 256x256 tiles leave idle, 128x256 tiles when they still fit in one wave of workgroups; cluster_n is 1 for an odd N-tile count. Per-token/per-channel grids that 256x256 tiles do not fill raise ValueError, as do M <= 256, N % 256 != 0, K % 128 != 0 and K < 512, so callers keep their own config. Tests cover both tiles, the odd N-tile count, ragged M and the rejected shapes. Signed-off-by: Jin Pan <jin.pan@amd.com>
…very config The comment justified the bit for one wave per SIMD only. The call is unconditional because the decode configs, which run several waves per SIMD, measured no slower with it. Signed-off-by: Jin Pan <jin.pan@amd.com>
Every quadrant config takes compute_ktile_quad_xt, so compute_ktile_quad and the compute_ktile dispatch were dead. Name the VALU scheduling masks, pass is_bsc in the per-token/per-channel selector test, and add type hints and a GPU-free test of the selector's configs. The generated code is unchanged. Signed-off-by: Jin Pan <jin.pan@amd.com>
A multicast load returns data only to the workgroups that requested it (CDNA5 ISA section 10.7), which is why the pipeline needs no extra fence under cluster launch. Signed-off-by: Jin Pan <jin.pan@amd.com>
This was referenced Oct 7, 2026
jhinpan
marked this pull request as draft
October 7, 2026 03:28
Collaborator
Author
|
Closing together with #1228, which this PR is stacked on. On our gfx1250 box, AITER's compute kernel with the fused split-K ran 1.7–1.9x faster than the #1228 kernel at M = 512 (#1228 (comment)). We did not measure the head of this PR against AITER. |
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.
Summary
Large FP8 GEMMs (prefill, M > 256) on gfx1250 wait for the L2-to-LDS tile traffic. This PR pipelines the K-loop across K-tiles and adds a prefill config selector that uses 2x2 clusters. On 59 blockscale prefill rows, the selected configs are 1.19x faster in geomean (1.045-1.348x) than the best upstream-tested config, and every row is faster. On the 5 per-token/per-channel rows that the selector takes, they are 1.19-1.26x faster. Outputs are bit-identical.
Stacked on #1228. The diff against the #1228 branch shows only this PR's changes. After #1228 merges, this PR will be retargeted to main.
Motivation
Changes
v_perm_b32at the full VALU rate, instead of a quarter-rate multiply by0x01010101.SCHED_MODE.DISABLE_XDL_ARB_STALL(bit 2, CDNA5 ISA §5.7.2.1) is set at kernel start, so a wave can issue other work while its WMMAs run. In an ablation, it gave 0.9-1.2% on 17 rows (blockscale 128x256 and per-token/per-channel 256x256, one wave per SIMD). It was neutral on the blockscale 256x256 rows and on the decode configs, which run several waves per SIMD.select_gemm_a8w8_prefill_config(M, N, K, is_bsc=True, num_cus=256)returns(tile_m, tile_n, tile_k, m_warp, n_warp, num_buffers, cluster_m, cluster_n)forlaunch_gemm_a8w8:cluster_n = 1for an odd N-tile count);ValueErrorfor per-token/per-channel grids that 256x256 tiles do not fill, and for M <= 256, N % 256 != 0, K % 128 != 0, and K < 512. Callers keep their own config there.Resources
VGPRs go up on the quadrant configs (compile-only, gfx1250). No config spills.
The per-token/per-channel 128x256 config drops to one wave per SIMD. #1228's decode selector returns it for per-token/per-channel rows with N >= 16384 and 16 < M <= 128. Those grids have one workgroup per CU at N <= 65536; larger N with this config was not measured.
Performance (gfx1250, MI450-class, 256 CUs)
Before: the best upstream-tested config per row, without a cluster. After: the selected config. Hot device time, median of 20 interleaved samples.
These numbers were measured before the rebase onto #1228's review fixes. The rebase does not change the generated code of the selected configs (LLVM IR and ISA compared).
Testing
Dependencies
Breaking Changes
None. Callers opt in through the selector.
launch_gemm_a8w8andlaunch_gemm_a8w8_splitkkeep their signatures.Related PRs
v_perm_b32change. It also changes this launcher, so the two PRs conflict. They have not been compared on the same rows.