Pass deployment target when linking metallib#3501
Open
dhiltgen wants to merge 1 commit intoml-explore:mainfrom
Open
Pass deployment target when linking metallib#3501dhiltgen wants to merge 1 commit intoml-explore:mainfrom
dhiltgen wants to merge 1 commit intoml-explore:mainfrom
Conversation
MLX compiles each Metal kernel AIR file with -mmacosx-version-min from CMAKE_OSX_DEPLOYMENT_TARGET, but the final metal driver invocation did not receive that deployment target. With the macOS 26 SDK and CMAKE_OSX_DEPLOYMENT_TARGET=14.0, the metal driver otherwise invokes air-lld with the SDK default platform version and can stamp mlx.metallib as macOS 26 even though the input AIR files target macOS 14. Repro: cmake -S . -B build-macos14 -DCMAKE_BUILD_TYPE=Release -DCMAKE_OSX_DEPLOYMENT_TARGET=14.0 cmake --build build-macos14 --target mlx-metallib --parallel strings -a build-macos14/mlx/backend/metal/kernels/mlx.metallib | grep -Eo 'air64[^[:space:]]*macosx[0-9.]+' | sort -u Keep using metal as the linker front-end and pass -mmacosx-version-min through the final link step. Verified with macOS SDK 26.4 that the resulting library reports air64_v26-apple-macosx14.0.0.
zcbenz
approved these changes
May 9, 2026
Collaborator
zcbenz
left a comment
There was a problem hiding this comment.
Looks good to me, thanks!
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.
MLX compiles each Metal kernel AIR file with -mmacosx-version-min from CMAKE_OSX_DEPLOYMENT_TARGET, but the final metal driver invocation did not receive that deployment target.
With the macOS 26 SDK and CMAKE_OSX_DEPLOYMENT_TARGET=14.0, the metal driver otherwise invokes air-lld with the SDK default platform version and can stamp mlx.metallib as macOS 26 even though the input AIR files target macOS 14.
Repro:
Keep using metal as the linker front-end and pass -mmacosx-version-min through the final link step. Verified with macOS SDK 26.4 that the resulting library reports air64_v26-apple-macosx14.0.0.
Proposed changes
Please include a description of the problem or feature this PR is addressing. If there is a corresponding issue, include the issue #.
Checklist
Put an
xin the boxes that apply.pre-commit run --all-filesto format my code / installed pre-commit prior to committing changes