Conversation
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.
Overview
Adds a disabled-by-default direct cooperative-operand Q2_0/PQ2_0 matrix path for comparison on M5. Set
GGML_METAL_Q2_DIRECT_MAX=16; the minimum width defaults to 8. Enabling it requires macOS 27, M5, TensorOps, embedded Metal sources, and a successful Metal 4.1 compiler probe. The shader is excluded and existing dispatch retained when the gate is off.Draft: this is slower than the current branch's PQ2_0 few-row path from #284/#286 and is not recommended for default selection. The earlier staged-kernel baseline has been superseded. The candidate preserves the activation operand type and also covers Q2_0 and generic matrix batch strides; these differences need further evaluation before deciding whether to retain the implementation.
Validation
git diff --checkpassed. Changed C++/Metal ranges formatted; Objective-C retained local style because the repository formatter excludes that language.Usage and limitations:
docs/development/metal-direct-q2.md.Follow-up findings
Four-way K splitting passed the backend oracle and reduced the candidate cost, but still measured 1.331x/1.345x current-default latency at widths 8/16. Two independent variants of that split also lost: half activation conversion (1.531x/1.555x) and original-type packed-word sharing (1.511x/1.462x). Each used three alternating pairs with three repetitions. Rejected follow-up variants were removed; no extra knobs added.
The unchanged existing kernel under Metal 4.0 versus 4.1 differed by less than 0.2%, ruling out a meaningful compiler-language benefit in this screen. This remains a draft comparison path, not a proposed default replacement.
Requirements