Repository navigation
[OPUS] gfx1250: keep split-K off shapes its reduce cannot address - #5162
Merged
Merged
Conversation
The split-K reduce launches as dim3(ceil(N, VEC*BLOCK), M, 1) and grid.y is
capped at 65535 on this part. Past that it does not fail, it writes garbage:
at M=65536 the output is NaN, and M >= 65537 stops launching at all with
"invalid configuration argument". The cliff is exactly 2^16 -- M=65535 is
clean, and the same shape on a .co kid, which has no reduce, is exact.
Three places, since the shape can arrive by three routes:
* candidate selection rejects the two _ws families above 65535, so tuning
never proposes one. It used to: tuning these shapes took the container
down with it, which is how this was found.
* the heuristic refuses M > 65535 outright, alongside the existing >4 GiB
guard. Every kid it can return is split-K, so there is nothing to fall
back to -- the message says to tune the shape instead, which lands on a
.co kid.
* the generated launcher checks before the reduce, for a tuned CSV or an
explicit kernelId that predates any of this.
Scoped to gfx1250. gfx942 and gfx950 launch the same reduce with batch * M
on grid.y and have the same ceiling; they are untouched here.
The four shapes that prompted this (M=65536, N=64/384/1024/2048, K=7168) now
tune in 56s where they used to hang the box, all four to 4wave_wl_co with
err_ratio 0.0, and verify against an fp32 reference at 1-2 absolute -- the
bf16 output quantisation itself, with no element outside tolerance.
Co-authored-by: Cursor <[email protected]>
Contributor
🏷️ CI GuideRuns automatically on every PR:
Extended tests (opt-in via labels):
PR title tags & labels: |
The preceding commit makes opus refuse split-K where its reduce cannot
address the whole grid, so M=65536 now fails loudly instead of returning
wrong results -- but heuristic dispatch was the only thing serving those
shapes. Give them tuned rows instead.
dsv4 gains 9 shapes that had no bf16 tuned row at all:
65536x{64,384,1024,2048}x7168 plus M=1..128 of Nx32320x7168. Opus wins 5
of them, triton 4. dsv3 retunes all 114 gfx1250 rows now that the .co kid
families are available, moving 113 from triton to opus.
Co-authored-by: Cursor <[email protected]>
junhaha666
previously approved these changes
Sep 2, 2026
The bf16 partial was landed as the default for the two gfx1250 _ws families (cluster_tdm/clusterlaunch_tdm) because it cleared the tuner's 5e-2 gate at half the workspace. It clears the gate, but it is not exact: every split-K row tuned that way carried err_ratio 0.008-0.017, the bf16 accumulation of the partials showing through. fp32 partials take that to 0.0. Restore fp32 as the family default -- which is just the dataclass default, so this is a deletion: the loop that forced the two tags to bf16 and the candidate filter (_drop_fp32_ws_kids, OPUS_TUNE_FP32_WS) that existed only because fp32 kids were the exception both go. Everything else keys off splitk_workspace_dtype and follows: the workspace sizes at 4 bytes, the launcher's element_size check, the reduce's read width. gfx942/950 _sk families are a different tag and keep their per-name dtypes (5 fp32, 3 bf16) untouched; fp32 is also their original default, so no static_assert moves. Re-tuned the 66 split-K rows this touches, opus vs triton in one session: * dsv3 (35 rows): all stay opus, 1.008x geomean cost. The tuner buys back most of fp32's per-shape ~13% by re-picking split_k / tile, and one shape (4096x256x7168) moves to a .co kid and gets faster. * dsv4 (31 rows): 9 stay opus, 22 flip to triton -- fp32 slows opus just enough to lose the shapes triton has a real tuned config for, which is the same (N,K) split seen when these were first tuned. err_ratio for every gfx1250 split-K row in both files is now 0.0. All 39 surviving opus split-K rows verified through dispatch: correct workspace width, 1.7e-3..3.2e-3 vs fp32 reference, no launcher complaint. kimik3's 111 split-K rows are not re-tuned here and now run the fp32 kids they reference; verified 0/111 errors through dispatch. They are correct but tuned for the old bf16 split_k, so a re-tune is left as follow-up. Co-authored-by: Cursor <[email protected]>
demonsan
dismissed stale reviews from junhaha666 and JiaoliangYu
via
September 4, 2026 10:48
2a79c50
…imit Co-authored-by: Cursor <[email protected]> # Conflicts: # aiter/configs/model_configs/dsv4_bf16_tuned_gemm.csv
junhaha666
approved these changes
Sep 9, 2026
Fyzyukk
added a commit
to Fyzyukk/aiter
that referenced
this pull request
Sep 9, 2026
Keep the exact-kid registry and caller-owned workspace interface while integrating PR ROCm#5162's FP32 partials and reducer row limit. Enforce max_m in policy, launch planning, tuning, and generated gfx1250 launchers; retain direct CO dispatch for large-M configurations. Add focused host and target-device regressions for the gfx1250 workspace contract and update source provenance for the shared OPUS dtype headers.
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.
The split-K reduce launches as dim3(ceil(N, VEC*BLOCK), M, 1) and grid.y is capped at 65535 on this part. Past that it does not fail, it writes garbage: at M=65536 the output is NaN, and M >= 65537 stops launching at all with "invalid configuration argument". The cliff is exactly 2^16 -- M=65535 is clean, and the same shape on a .co kid, which has no reduce, is exact.
Three places, since the shape can arrive by three routes:
Scoped to gfx1250. gfx942 and gfx950 launch the same reduce with batch * M on grid.y and have the same ceiling; they are untouched here.
The four shapes that prompted this (M=65536, N=64/384/1024/2048, K=7168) now tune to 4wave_wl_co with err_ratio 0.0 where they used to hang the box, and verify against an fp32 reference with no element outside tolerance.
What the tuning commits add
The guard turns unserved split-K shapes into a hard error, so the shapes that relied on heuristic dispatch need tuned rows to land on. Two commits provide them.
1. The
_wssplit-K families move back to an fp32 partialThe bf16 split-K partial cleared the tuner's 5e-2 gate at half the workspace, but it is not exact: every split-K row tuned that way carried
err_ratio0.0000-0.0169 (median 0.0098), the bf16 accumulation of the partials showing through. fp32 partials take every one of them to 0.0.fp32 is just the dataclass default, so the code change is a deletion: the loop that forced the two
_wstags to bf16 and the candidate filter that existed only because fp32 kids were the exception both go. gfx942/950_skfamilies are a different tag and keep their per-name dtypes.The 66 split-K rows this touches were re-tuned, opus vs triton in one session:
Per-shape fp32 costs ~13%, but re-tuning buys most of it back by re-picking
split_k/tile: 1.000x geomean over all 66, 34 rows actually got faster. dsv4 loses 22 shapes to triton -- fp32 slows opus just past triton on exactly the(N,K)triton has a real tuned config for.fp32 vs bf16 partial, all 66 re-tuned split-K rows
2. Nine dsv4 shapes that had no tuned bf16 row at all
These are the shapes the guard converts to a hard error: no tuned row, so heuristic dispatch served them, and it only returns split-K kids. opus takes 5 of 9 (all
4wave_wl_co), triton keeps the bandwidth-bound small-M end of N=32320. Not affected by the fp32 change -- none of the nine picks a split-K kid.N=64, K=7168
N=384, K=7168
N=1024, K=7168
N=2048, K=7168
N=32320, K=7168
3. All 114 dsv3 gfx1250 rows re-tuned
Re-tuned because the
.cokid families landed after these rows were written; opus takes all 114. The 35 split-K rows among them are the fp32 ones from section 1.The dsv3 margin is inflated by triton config coverage. triton stores its GEMM config per
(N,K)and falls back toDEFAULT.jsonwhen there is none; all 6 dsv3(N,K)pairs fall back, so this is largely tuned-vs-untuned (2.61x geomean). The dsv4 numbers above, where triton is tuned, are the fair comparison. Adding dsv3 triton configs is the way to close it and is not attempted here. triton also failed outright on 16384x129280x7168 (us=-1).N=256, K=7168 — triton→
DEFAULT.jsonN=2112, K=7168 — triton→
DEFAULT.jsonN=3072, K=1536 — triton→
DEFAULT.jsonN=7168, K=2048 — triton→
DEFAULT.jsonN=16160, K=7168 — triton→
DEFAULT.jsonN=129280, K=7168 — triton→
DEFAULT.json