You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
fix: zero-pad XQ to padded weight K for all a8w8 bpreshuffle backends - #6456
shuffle_weight(..., pad_k_to=K_w) preshuffles WQ in blocks laid out over the padded K_w. Every a8w8 bpreshuffle kernel takes a single K for both operands, but only the FlyDSL path zero-padded XQ to K_w. CK, CKTile and the untuned fallbacks therefore read the shuffled weight with the wrong K and returned wrong results.
Technical Details
aiter/ops/gemm_op_a8w8.py: zero-pad XQ to w_k once before config dispatch, so every backend runs at K_w. This replaces the two FlyDSL-only pads. Zero padding leaves the dot product unchanged.
Tuned-config lookup is unchanged: it still tries logical K first, then falls back to K_w.
op_tests/test_gemm_a8w8_bpreshuffle_pad_k.py:
The mock dispatch tests now expect the padded XQ shape and a zero tail.
New end-to-end reference cases cover untuned, CK, split-K CK, CKTile and FlyDSL. They hit both the logical-K and the padded-K config rows.
Each case asserts that dispatch still picks the expected backend.
The cases compare against an fp32 reference with assertAllclose (rtol=atol=1e-2, catastrophic_check=True). Split-K uses atol=1.0 because it adds up bf16 partial sums.
They are skipped unless the device is a full 256-CU gfx950, because the rows come from the gfx950 cu_num=256 tuned tables.
The reference cases are an aiter op test (@benchmark sweep + main()), so the default CI runner (python3 <file>) now executes them; pytest still runs them via a parametrized wrapper.
Test Plan
pytest op_tests/test_gemm_a8w8_bpreshuffle_pad_k.py and python op_tests/test_gemm_a8w8_bpreshuffle_pad_k.py (prints a markdown summary table of us/TFLOPS/TB/s/err and the dispatched backend per shape; -s m,n,k,w_k to pick shapes) on gfx950 (MI355X), with and without the dispatch fix.
Test Result
With the fix: 17 passed.
Without the fix: 7 of the 8 new reference cases fail. The FlyDSL case passes because that path already padded XQ.
- K-padded WQ is preshuffled over K_w and every kernel takes a single K for both operands
- Only FlyDSL padded XQ; CK, CKTile and untuned fallbacks read the shuffled weight with the wrong K
- Pad XQ once before dispatch so all backends run at K_w; zero padding leaves the result unchanged
- Update mock tests to expect padded XQ and add end-to-end reference checks for CK, CKTile, FlyDSL and untuned shapes
Co-authored-by: Copilot <[email protected]>
ATOM accuracy suite for PR and main models from ATOM models_accuracy.json
ci:vllm
vLLM benchmark: DeepSeek-V4-Pro, MiniMax-M3-MXFP4
ci:all
All standard extended tests (excludes ci:atom_full)
Only add ci:atom_full for FlyDSL or Triton upgrades.
Add labels via the sidebar or gh pr edit 6456 --add-label <label>
One backend per PR:
A PR changes one kernel backend: [Triton/Gluon] (Triton and Gluon count as one), [HIP], [ASM], [CK], [OPUS] or [FlyDSL]. If the title ends up with two backend tags, split the PR -- as stacked pull requests when one part cannot merge without the other.
PR title tags & labels:
Component tags ([Triton/Gluon], [HIP], [CK], [ASM], ...) are added to the PR title and as PR labels automatically from the changed files and re-synced on every push — change-type tags like [fix]/[Perf], op tags like [MLA], and human labels (ci:*) are left untouched. Add the no-auto-title label to stop the title rewrites; labels stay in sync either way.
…ertAllclose
- Skip every reference row unless get_gfx() is gfx950, since dispatch keys the tuned CSV with get_gfx()
- Replace the max-relative-error check with assertAllclose(rtol=atol=1e-2, catastrophic_check=True)
- Loosen atol to 1.0 for the split-K row only, where bf16 partial sums add ~1 ulp on small outputs
These cases are tied to tuned rows with cu_num=256, but this gate also admits partitioned gfx950 devices with a different CU count. On those devices _padded_k_backend() cannot find the expected tuned rows and the test fails before exercising the kernel. Gate on both gfx950 and 256 CUs (or provide rows for each supported partition).
- Tuned lookup keys on (gfx, cu_num) and every gfx950 bpreshuffle row has cu_num=256
- A partitioned gfx950 finds no row, so the backend assertion would fail before running the kernel; skip instead
Re Copilot "Gate test on gfx950 devices with 256 CUs": valid, since the tuned lookup keys on (gfx, cu_num) and every gfx950 bpreshuffle row has cu_num=256. Fixed in db3c999: the reference cases now skip unless (get_gfx(), get_cu_num()) == ("gfx950", 256). Verified with 17 passed on a 256-CU MI355X, and all 8 reference cases skipped under CU_NUM=80.
… test
- Move the end-to-end case body into a @benchmark sweep fn with a candidate dict, run_perftest and checkAllclose
- Report us, TFLOPS, TB/s and err per candidate plus the dispatched backend and gfx in a markdown summary table
- Split the fp32 dequant reference into an untimed run_torch helper
- Add main() with a gfx942/gfx950 allow-list, -d/--dtype and -s/--mnk (m,n,k,w_k) argparse and itertools.product sweep
- Add a __main__ guard so `python op_tests/test_gemm_a8w8_bpreshuffle_pad_k.py` (the CI runner) executes the sweep
- Keep the pytest wrapper with the gfx950 cu_num=256 skip and expected-backend assertion on top of the sweep fn
- Key the end-to-end case table by the (gfx, cu_num) tuned table each row was picked from
- Add gfx942 cu_num=80 rows that reach the CK and CKTile logical-K and padded-K fallback rows
- Run the untuned CKTile-fallback rows on 304-CU gfx942, whose tuned table has no fp8 rows
- Default main() shapes to the current device's table instead of the gfx950 rows
The reason will be displayed to describe this comment to others. Learn more.
🔵 Needs a closer look
Cross-backend GPU validation, particularly for the new gfx942 cases, remains necessary before approval.
No open issues 🎉
1 previously missed issue
In code that hasn't changed since last review
Validate expected backend for known benchmark shapes
op_tests/test_gemm_a8w8_bpreshuffle_pad_k.py:395
The default CI invocation (python3 <file>) calls the benchmark helper here, bypassing the expected-backend assertion in the pytest wrapper. If a tuned row changes backend or disappears, the script can still pass numerically while losing the intended CK, CKTile, split-K, or FlyDSL coverage. Check the expected backend for each known shape in the selected device's case table before benchmarking, while leaving arbitrary -s shapes unrestricted.
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
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
shuffle_weight(..., pad_k_to=K_w)preshuffles WQ in blocks laid out over the paddedK_w. Every a8w8 bpreshuffle kernel takes a single K for both operands, but only the FlyDSL path zero-padded XQ toK_w. CK, CKTile and the untuned fallbacks therefore read the shuffled weight with the wrong K and returned wrong results.Technical Details
aiter/ops/gemm_op_a8w8.py: zero-pad XQ tow_konce before config dispatch, so every backend runs atK_w. This replaces the two FlyDSL-only pads. Zero padding leaves the dot product unchanged.K_w.op_tests/test_gemm_a8w8_bpreshuffle_pad_k.py:assertAllclose(rtol=atol=1e-2,catastrophic_check=True). Split-K usesatol=1.0because it adds up bf16 partial sums.cu_num=256tuned tables.@benchmarksweep +main()), so the default CI runner (python3 <file>) now executes them; pytest still runs them via a parametrized wrapper.Test Plan
pytest op_tests/test_gemm_a8w8_bpreshuffle_pad_k.pyandpython op_tests/test_gemm_a8w8_bpreshuffle_pad_k.py(prints a markdown summary table of us/TFLOPS/TB/s/err and the dispatched backend per shape;-s m,n,k,w_kto pick shapes) on gfx950 (MI355X), with and without the dispatch fix.Test Result
Submission Checklist