Fix M5 split-K NAX dispatch cliff - #4237
Closed
PhilipJohnBasile wants to merge 1 commit into
Closed
Conversation
PhilipJohnBasile
marked this pull request as ready for review
August 13, 2026 16:56
Member
|
Thanks for the PR but currently we are only focusing on real cases happened during inference otherwise we wouldn't be able to review all the improvements, so I'm closing this PR. |
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.
Fixes #4198.
Summary
On M5, the split-K heuristic routes one-M-tile transposed QMMs in the
N=6656..8192 band to the plain Metal
qmm_t_splitkkernel. The fallbackqmmpath is NAX-capable and is faster for the measured two-way split.This change:
decision uses the exact same predicate;
applegpu_g17sM5 Max class forsingle-batch, transposed affine 4-bit/group-64 QMM with one M tile,
N=6656..8192, K divisible by 128, and a finalized split count of two;
path.
The narrow shape/device gate is intentional. Prior measurements show split-K
still wins in other regions, and this PR only changes the band demonstrated in
#4198. It composes with #4171 if that NAX small-M tiling change lands.
Validation
a8e24f202: passed.git diff --check, clang-format, Black, Python syntax: passed.test_quantized: 37 passed, 3 skipped.N/M boundaries: passed.
test_quantized: 37 passed.M5 Max performance
Apple M5 Max (
applegpu_g17s), macOS 27.0, bfloat16 activations, affine4-bit/group-64 weights. Baseline and candidate were separate clean builds from
the same
a8e24f202source. The Metal library hash was identical; only the hostlibmlxdiffered. Each cell used 64 dependent operations, warmup, and sevensamples per arm in baseline/candidate/candidate/baseline order.
Across all 33 affected M<=32 cells, speedup was 1.22–1.49x (median
1.37x). Across 24 M>=33 or N=8224 controls, the ratio was 0.992–1.012x
(median 0.999x).
The M=33/M=32 ratio at N=6656/7168/7680/8192 moved from
0.781/0.733/0.732/0.682 on the baseline to 1.005/1.002/1.000/1.007 on the
candidate, eliminating the dispatch cliff. Baseline and candidate ABBA arm
drift stayed below 1.4% and 1.9%, respectively.