Retune MLX transposed quant matmul on Metal#321
Closed
ry2009 wants to merge 1 commit intotrymirai:mainfrom
Closed
Conversation
eugenebokhan
approved these changes
Apr 6, 2026
Author
|
Superseded by #323, which is the same matmul change rebased onto current |
Author
|
Closing in favor of #323. |
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.
What changed
QmmTransposed64x64on the zero-point path onlyWM=4,WN=1split inqmm_implQmmTransposedfrom32x32to160x32Why
Llama-3.2-3B-Instruct-4bitprefill on Apple was still spending most of its time in transposed quant matmul. The MLX 4-bit path was taking a bad kernel family and a weak transposed tile shape for this workload.This patch keeps the change set narrow and only moves the MLX path onto the kernel shapes that benchmarked well on Apple.
Impact
Matched Apple blocker benchmark:
Llama-3.2-3B-Instruct-4bit,10049prompt tokens,32generated tokens,tiered_q4:256.tiered_q464x64familyWM=4,WN=1160x32transposed QMMNegative ablations on the same Apple box:
160x32with old2x2split192x32256x32So the main win comes from the transposed
160x32tile, with the MLX-only4x1split adding a smaller but real gain.Validation
PATH="$HOME/.rustup/toolchains/1.93.0-x86_64-apple-darwin/bin:$PATH" cargo check -p uzu --no-default-features --libcargo build -p cli --releasellama3b_4bit_tiered256_x12_long32_clean.results.jsonllama3b_4bit_wm4_r2.results.jsonllama3b_mlx_qmm_transposed_160x32_r2.jsonllama3b_mlx_qmm_transposed_160x32_2x2.jsonllama3b_mlx_qmm_transposed_192x32.jsonllama3b_mlx_qmm_transposed_256x32.json