Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 20 additions & 10 deletions nix/darwin-build-fixes.patch
Original file line number Diff line number Diff line change
Expand Up @@ -37,20 +37,30 @@ index 3f233048..5e0f8eff 100644
else()
set(MLX_METAL_VERSION 0)
diff --git a/cmake/extension.cmake b/cmake/extension.cmake
index 2f244a14..4a4e11ac 100644
index 1318eb65..f9c501d1 100644
--- a/cmake/extension.cmake
+++ b/cmake/extension.cmake
@@ -37,7 +37,7 @@ macro(mlx_build_metallib)
@@ -95,7 +95,8 @@ macro(mlx_build_metallib)
add_custom_command(
OUTPUT ${_MTLLIB_AIR_TARGET}
COMMAND
- xcrun -sdk macosx metal ${_MTLLIB_INCLUDE_OPTIONS}
+ metal -fmodules-cache-path=${CMAKE_BINARY_DIR}/metal-cache
+ ${_MTLLIB_INCLUDE_OPTIONS}
${_MTLLIB_COMPILE_OPTIONS} ${MTLLIB_COMPILE_OPTIONS} -MMD -MF
${_MTLLIB_DEPFILE} -MT ${_MTLLIB_AIR_TARGET} -c ${_MTLLIB_SOURCE} -o
${_MTLLIB_AIR_TARGET}
@@ -111,7 +112,7 @@ macro(mlx_build_metallib)
# Link the AIR files into a metallib
add_custom_command(
OUTPUT ${MTLLIB_BUILD_TARGET}
COMMAND
- xcrun -sdk macosx metal
+ metal -fmodules-cache-path=${CMAKE_BINARY_DIR}/metal-cache
"$<LIST:TRANSFORM,${MTLLIB_INCLUDE_DIRS},PREPEND,-I>"
${MTLLIB_COMPILE_OPTIONS} ${MTLLIB_SOURCES} -o ${MTLLIB_BUILD_TARGET}
DEPENDS ${MTLLIB_DEPS} ${MTLLIB_SOURCES}
- COMMAND xcrun -sdk macosx metal ${_MTLLIB_LINK_OPTIONS}
+ COMMAND metal ${_MTLLIB_LINK_OPTIONS}
${_MTLLIB_AIR_TARGETS} -o ${MTLLIB_BUILD_TARGET}
DEPENDS ${_MTLLIB_AIR_TARGETS}
COMMENT "Building ${MTLLIB_TITLE}.metallib"
diff --git a/mlx/backend/metal/kernels/CMakeLists.txt b/mlx/backend/metal/kernels/CMakeLists.txt
index 9b720334..0872c8c8 100644
index 355c763a..ec375862 100644
--- a/mlx/backend/metal/kernels/CMakeLists.txt
+++ b/mlx/backend/metal/kernels/CMakeLists.txt
@@ -30,7 +30,7 @@ function(build_kernel_base TARGET SRCFILE DEPS)
Expand All @@ -62,7 +72,7 @@ index 9b720334..0872c8c8 100644
-I${PROJECT_SOURCE_DIR} -o ${TARGET}.air
DEPENDS ${SRCFILE} ${DEPS} ${BASE_HEADERS}
OUTPUT ${TARGET}.air
@@ -202,7 +202,7 @@ endif()
@@ -204,7 +204,7 @@ endif()

add_custom_command(
OUTPUT ${MLX_METAL_PATH}/mlx.metallib
Expand Down
20 changes: 5 additions & 15 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ dev = [
build = ["nanobind"]
mlx-none = ["anyio"]
mlx = [
"mlx>=0.32.0",
"mlx>=0.32.3",
"mlx-lm",
"mlx-vlm>=0.3.11",
"mflux==0.17.5",
Expand All @@ -59,15 +59,15 @@ mlx = [
"torchvision==0.25.0; sys_platform == 'darwin'",
"torchvision==0.25.0; sys_platform == 'linux'",
]
mlx-cpu = ["exo[mlx]", "mlx-cpu==0.31.2; sys_platform == 'linux'"]
mlx-cpu = ["exo[mlx]", "mlx-cpu==0.32.4; sys_platform == 'linux'"]
mlx-cuda12 = [
"exo[mlx]",
"mlx-cuda-12==0.32.0; sys_platform == 'linux'",
"mlx-cuda-12==0.32.4; sys_platform == 'linux'",
"nvidia-ml-py>=13.595.45",
]
mlx-cuda13 = [
"exo[mlx]",
"mlx-cuda-13==0.32.0; sys_platform == 'linux'",
"mlx-cuda-13==0.32.4; sys_platform == 'linux'",
"nvidia-ml-py>=13.595.45",
]

Expand All @@ -81,17 +81,7 @@ members = ["rust/exo_rs", "bench", "tools"]
[tool.uv.sources]
exo-rs = { workspace = true }
mlx = [
{ git = "https://github.com/ml-explore/mlx.git", rev = "0e3ff3643b1c3719f78814b98e0d222afbad867c", marker = "sys_platform == 'darwin'" },
{ url = "https://github.com/rltakashige/mlx-jaccl-fix-small-recv/releases/download/mlx_cuda/mlx-0.32.0-cp313-cp313-manylinux_2_35_aarch64.whl", marker = "sys_platform == 'linux' and platform_machine == 'aarch64'" },
{ url = "https://github.com/rltakashige/mlx-jaccl-fix-small-recv/releases/download/mlx_cuda/mlx-0.32.0-cp313-cp313-manylinux_2_35_x86_64.whl", marker = "sys_platform == 'linux' and platform_machine != 'aarch64'" },
]
mlx-cuda-12 = [
{ url = "https://github.com/rltakashige/mlx-jaccl-fix-small-recv/releases/download/mlx_cuda/mlx_cuda_12-0.32.0-py3-none-manylinux_2_35_aarch64.whl", marker = "sys_platform == 'linux' and platform_machine == 'aarch64'" },
{ url = "https://github.com/rltakashige/mlx-jaccl-fix-small-recv/releases/download/mlx_cuda/mlx_cuda_12-0.32.0-py3-none-manylinux_2_35_x86_64.whl", marker = "sys_platform == 'linux' and platform_machine != 'aarch64'" },
]
mlx-cuda-13 = [
{ url = "https://github.com/rltakashige/mlx-jaccl-fix-small-recv/releases/download/mlx_cuda/mlx_cuda_13-0.32.0-py3-none-manylinux_2_35_aarch64.whl", marker = "sys_platform == 'linux' and platform_machine == 'aarch64'" },
{ url = "https://github.com/rltakashige/mlx-jaccl-fix-small-recv/releases/download/mlx_cuda/mlx_cuda_13-0.32.0-py3-none-manylinux_2_35_x86_64.whl", marker = "sys_platform == 'linux' and platform_machine != 'aarch64'" },
{ git = "https://github.com/ml-explore/mlx.git", rev = "36969c094354086e15d2a327a9c50feb20b9cf11", marker = "sys_platform == 'darwin'" },
]
mlx-lm = { git = "https://github.com/rltakashige/mlx-lm", branch = "leo/deepseek-v4" }
mflux = { git = "https://github.com/evanev7/mflux", branch = "exo2" }
Expand Down
11 changes: 10 additions & 1 deletion python/parts.nix
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,16 @@ let
'';
autoPatchelfIgnoreMissingDeps = [ "libcuda.so.1" ];
});
} // lib.optionalAttrs cudaSupport {
} // lib.optionalAttrs (isLinux && !cudaSupport) (
# The lock gives Linux torch's CUDA build, so it and its NVIDIA wheels are in
# the closure even without CUDA. Their CUDA and RDMA libraries are only needed
# on a GPU: leave them unresolved rather than failing auto-patchelf.
lib.mapAttrs
(_: pkg: pkg.overrideAttrs (_: { autoPatchelfIgnoreMissingDeps = true; }))
(lib.filterAttrs
(name: _: lib.hasPrefix "nvidia-" name || builtins.elem name [ "torch" "torchaudio" "torchvision" "triton" ])
prev)
) // lib.optionalAttrs cudaSupport {
"${libmlx_source}" = prev."${libmlx_source}".overrideAttrs (old: {
nativeBuildInputs = old.nativeBuildInputs ++ [ pkgs.autoAddDriverRunpath ];
buildInputs = old.buildInputs ++ cudaLibs;
Expand Down
Loading
Loading