Skip to content

Commit 16b9f8e

Browse files
committed
Document MLX JIT build patch in README
Note the MetalPerformancePrimitives SDK gap on older Xcodes (e.g. GitHub's macos-14 runner) and point to the upstream fix at ml-explore/mlx#3426 so the patches/ directory can be retired once the submodule is bumped past it.
1 parent ccc5b4c commit 16b9f8e

1 file changed

Lines changed: 17 additions & 0 deletions

File tree

README.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,23 @@ With JIT on, kernels are compiled on first invocation, so there's a
156156
small per-kernel warm-up cost at runtime; subsequent calls are cached
157157
in-process. All of Emily's test suite passes under both modes.
158158

159+
MLX's JIT branch unconditionally preprocesses NAX kernel sources,
160+
which transitively include
161+
`<MetalPerformancePrimitives/MetalPerformancePrimitives.h>` — a
162+
header that only ships with the macOS 26.2+ SDK. On older SDKs (e.g.
163+
Xcode 15.x, which is what GitHub's `macos-14` runner provides) the
164+
preprocess step fails and the JIT build can't configure. Emily works
165+
around this by applying a local patch under `patches/` to MLX before
166+
`cmake` runs: when the SDK gate fails, the patch mirrors the same
167+
guard MLX's AOT branch already uses, defines `MLX_METAL_NO_NAX` (so
168+
`is_nax_available()` returns `false` at runtime), and emits stub
169+
implementations of the NAX JIT source providers so the NIF links.
170+
The patch is applied idempotently from `mix.exs` and is a no-op on
171+
macOS 26.2+. Upstream fix proposed at
172+
[ml-explore/mlx#3426](https://github.com/ml-explore/mlx/pull/3426);
173+
once merged and the submodule is bumped past it, the `patches/`
174+
directory and the `maybe_apply_mlx_patches` plumbing can be deleted.
175+
159176
## Usage
160177

161178
Install Emily as the global Nx backend and use Nx normally:

0 commit comments

Comments
 (0)