metal : request Metal 4.0 language version for the tensor API - #27461
Draft
JamesFranc wants to merge 2 commits into
Draft
metal : request Metal 4.0 language version for the tensor API#27461JamesFranc wants to merge 2 commits into
JamesFranc wants to merge 2 commits into
Conversation
|
Hi @JamesFranc, thanks for your contribution! Per our contribution guidelines, the automated PR checker found the following issue(s) that need your attention:
Please note that maintainers reserve the right to make final decisions on PRs. If you believe there is a mistake, please comment below. |
JamesFranc
force-pushed
the
metal-tensor-language-version
branch
4 times, most recently
from
August 21, 2026 06:13
aa59356 to
1b6c523
Compare
JamesFranc
force-pushed
the
metal-tensor-language-version
branch
from
August 21, 2026 06:14
1b6c523 to
4d9c2ea
Compare
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
has_tensorso unsupported hardware is untouchedhas_tensorwhen the library came from a pre-compiledmetallib.Additional information
This issue was encountered when running main on an M5 Max. During some prefill and decode benchmarks I was noticing that prefill speeds seemed curiously slow.
The prefill tests used to generate the data above build a prompt of 6,000, random, six-letter words which should prevent cache hits.
This seems to be caused by
MTLCompileOptionsdefaulting to an older Metal language version that doesn't expose tensor API headers (metal_tensor,MetalPerformancePrimitives) to the shader compiler. Both tensor API probes inggml_metal_device_init()therefore fail:The compiler error behind it (visible only with
verbose = true):As a result
has_tensoris disabled on every device, and prefill runs matmuls on general-purpose shader ALUs.This fix will only impact prefill on Apple Silicon-based hardware
Requirements