Repository navigation
qwen27 metal: opt-in one-buffer MTP absorb with a GPU draft pick - #4570
Merged
Merged
Conversation
Owner
Author
ashhart
force-pushed
the
lead/q27-mtp-gpu-pick
branch
2 times, most recently
from
November 23, 2026 21:30
af16274 to
ac6eccc
Compare
With --mtp-drafts, each MTP absorb runs as three command buffers with two blocking waits between them, and each draft pick scans the whole vocabulary on one CPU thread. TF_Q27_MTP_GPU_PICK=1 runs the absorb on one command buffer and picks each draft with the existing exact BF16 top-k kernel at k=1. Ties go to the lowest token, as in the CPU pick, and a nonfinite row fails the same way. Passes over 16 logits rows keep the CPU pick. The draft chance stays a CPU sum in the same order, with each BF16 value's term computed once, so its bits match the CPU pick. Drafting is always greedy here, so there is no sampled draw to carry over. The switch is off by default. Off, the absorb keeps its three command buffers and the CPU pick.
The coverage check in "valid forms remain raw numbers" wants every common-scope row in the valid table; the new switch had none, so test-environment-host failed. Found in @AIFlowML's PR sweep. Co-authored-by: AIFlowML <[email protected]>
ashhart
force-pushed
the
lead/q27-mtp-gpu-pick
branch
from
November 24, 2026 04:40
ac6eccc to
148216c
Compare
Owner
Author
|
Thank you @AIFlowML. This is merged into main with your commits under your own name, so you're credited as a TensorFold contributor. |
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 this changes
With
--mtp-drafts, each MTP absorb ran as three command buffers with two blocking waits, and each draft token was picked by a CPU loop over the whole vocabulary. WithTF_Q27_MTP_GPU_PICK=1the absorb runs gather, head, pick and save in one command buffer, and the pick uses the existingtf_bf16_topkkernel at k=1 (no new shader). Draft picks only choose which rows the target verifies, so outputs are unchanged; the GPU pick is required to choose the same token as the CPU pick, ties included, and the A/B checks drafted and accepted counts match.Checks
Still to run
Not run on a GPU yet. M3 Ultra with
--mtp-drafts: drafted and accepted counts equal with the switch off and on, tokens equal to a draft-off run, then one-stream prose and code timing (kill under +3%).