Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added MLX_C (MLX C) #9809

Merged
merged 3 commits into from
Dec 13, 2024
Merged

Added MLX_C (MLX C) #9809

merged 3 commits into from
Dec 13, 2024

Conversation

stemann
Copy link
Contributor

@stemann stemann commented Nov 18, 2024

Follow-up for #9761

Edit: Using MLX v0.20 (JLL) - and latest MLX C.

@stemann
Copy link
Contributor Author

stemann commented Nov 18, 2024

Using the current release version, v0.0.10, corresponding to MLX v0.18.0, aarch64-linux-gnu and x86_64-apple-darwin passes, but notably not aarch64-apple-darwin: https://buildkite.com/julialang/yggdrasil/builds/14769

Using the (just approved, 18 Nov 2024) Revamp MLX C API PR, corresponding to the latest MLX release v0.20.0, it's possible to have both x86_64-apple-darwin and, most importantly, aarch64-apple-darwin: https://buildkite.com/julialang/yggdrasil/builds/14771

@stemann stemann changed the title Added MLX_C (MLX-C) Added MLX_C (MLX C) Nov 18, 2024
@stemann stemann force-pushed the feature/mlx_c branch 3 times, most recently from d4f97f9 to bc175e1 Compare November 26, 2024 20:28
@stemann stemann marked this pull request as ready for review November 26, 2024 20:33
@stemann stemann marked this pull request as draft November 26, 2024 20:33
Added win32-io patch
Added cmake-win32 patch
Using dlfcn-win32 for cmake to configure on Windows
gcc v10 seems adequate
Using MLX_jll dependency
Updated after merge of mlx-c/pull/44
Updated after merge of mlx-c/pull/38
CMake using MLX from $prefix
@stemann stemann marked this pull request as ready for review November 30, 2024 13:32
@stemann stemann requested a review from eschnett December 3, 2024 22:16
This was referenced Dec 3, 2024
Comment on lines 17 to 21
apple_sdk_root=$WORKSPACE/srcdir/MacOSX14.0.sdk
sed -i "s!/opt/$bb_target/$bb_target/sys-root!$apple_sdk_root!" $CMAKE_TARGET_TOOLCHAIN
sed -i "s!/opt/$bb_target/$bb_target/sys-root!$apple_sdk_root!" /opt/bin/$bb_full_target/$target-clang++

export MACOSX_DEPLOYMENT_TARGET=13.3
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why using SDK 14.0 but saying that minimum supported target is 13.3? Why not using https://github.com/roblabla/MacOSX-SDKs/releases/tag/13.3 instead?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using a newer SDK should be fine, you can build for older deployment targets on newer SDKs.

Also, it appears there is a mismatch between the deployment target here and the one in MLX (that this depends on):

[07:36:47] ld64.lld: warning: /workspace/destdir/lib/libmlx.dylib has version 13.5.0, which is newer than target minimum of 13.3.0

Since MLX is using the Python wheel on MacOS, the setting of the compatibility target isn't used at all in that build, so we need to follow whatever the minimum target in the Python wheel is.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have been using SDK 14.0 in both MLX and this due to this is the version required by MLX upstream (even though it's likely only necessary for the Metal backend which we are not building): https://github.com/search?q=repo%3Aml-explore%2Fmlx%20sdk&type=code

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changed macOS target for aarch64-apple-darwin to 13.5

@stemann stemann requested a review from imciner2 December 13, 2024 13:37
@stemann
Copy link
Contributor Author

stemann commented Dec 13, 2024

For aarch64-apple-darwin, the linker warns that the directory /Applications/Xcode-15.0.1.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.0.sdk is not found:

[13:11:31] ld64.lld: warning: directory not found for option -F/Applications/Xcode-15.0.1.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.0.sdk/System/Library/Frameworks

This is likely stemming from:

# grep Applications $prefix/share/cmake/MLX/*
/workspace/destdir/share/cmake/MLX/MLXTargets.cmake:  INTERFACE_LINK_LIBRARIES "-framework Metal;-framework Foundation;-framework QuartzCore;/Applications/Xcode-15.0.1.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.0.sdk/System/Library/Frameworks/Accelerate.framework"

Relates to #9898 (comment)

@imciner2 imciner2 merged commit 6d05600 into JuliaPackaging:master Dec 13, 2024
33 checks passed
@stemann stemann deleted the feature/mlx_c branch December 13, 2024 16:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants