Fix metal::vec namespace and metal_stdlib include for Metal Toolchain…#3336
Open
adamSellers wants to merge 2 commits intoml-explore:mainfrom
Open
Fix metal::vec namespace and metal_stdlib include for Metal Toolchain…#3336adamSellers wants to merge 2 commits intoml-explore:mainfrom
adamSellers wants to merge 2 commits intoml-explore:mainfrom
Conversation
… 32023 (macOS 26) Metal Toolchain 32023 (Xcode 26, macOS 26 Tahoe) introduced two breaking changes: 1. vec is no longer in the global namespace - must be qualified as metal::vec 2. <metal_math> no longer transitively includes <metal_stdlib>, so bfloat (aliased as bfloat16_t in bf16.h) is not in scope without an explicit include Without this fix MLX silently falls back to CPU dispatch on macOS 26, resulting in ~50% of expected throughput despite mx.default_device() reporting Device(gpu, 0). Tested on M3 Ultra, macOS 26.4 (25E246), Metal Toolchain 32023.883: - Before: ~17 tok/sec generation, GPU 2% active - After: ~35 tok/sec generation, GPU 100% active @ 1380MHz
Author
|
No tests added for this fix — the bug manifests at Metal shader compilation time (runtime JIT), which requires macOS 26 + Metal Toolchain 32023 to reproduce. There's currently no CI runner for macOS 26, so this has been validated manually on M3 Ultra / macOS 26.4 (25E246) / Metal Toolchain 32023.883. Happy to add a test if the team can point me to where Metal compilation is exercised in the test suite. |
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.
… 32023 (macOS 26)
Metal Toolchain 32023 (Xcode 26, macOS 26 Tahoe) introduced two breaking changes:
Without this fix MLX silently falls back to CPU dispatch on macOS 26, resulting in ~50% of expected throughput despite mx.default_device() reporting Device(gpu, 0).
Tested on M3 Ultra, macOS 26.4 (25E246), Metal Toolchain 32023.883:
Proposed changes
Please include a description of the problem or feature this PR is addressing. If there is a corresponding issue, include the issue #.
Fixes #3337
Checklist
Put an
xin the boxes that apply.pre-commit run --all-filesto format my code / installed pre-commit prior to committing changes