Repository navigation
Enable JACCL - #502
Merged
Merged
Enable JACCL#502
Conversation
This was referenced Oct 16, 2026
davidkoski
approved these changes
Oct 16, 2026
davidkoski
left a comment
Member
There was a problem hiding this comment.
Change looks good, thank you!
eejd
pushed a commit
to eejd/mlx-swift
that referenced
this pull request
Oct 18, 2026
Brings in ml-explore#501 (leak when _updateInternal replaces an array with siblings), ml-explore#502 (enable JACCL) and ml-explore#486 (asArray crash on zero-size arrays). No conflicts. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
8 of 9 tasks
aleroot
added a commit
to aleroot/mlx-swift
that referenced
this pull request
Oct 28, 2026
Since ml-explore#502 every macOS build whose SDK ships <infiniband/verbs.h> links the JACCL distributed backend (RDMA over Thunderbolt 5), and dead stripping cannot remove it: `distributed::init("any")` reaches `jaccl::init`, and `MLXDistributed.Group` and the sharded MLXNN layers keep that path alive. An app that never forms a Thunderbolt cluster has no way to opt out. On a minimal MLX + MLXNN executable (release, stripped) the backend costs 1,065,280 bytes, 841 KB of them `__text`. Add a `JACCL` package trait, enabled by default, so an app can leave it out with `traits: []`: - `Package.swift` declares the trait and defines `MLX_USE_JACCL` for Cmlx when it is enabled. SwiftPM passes traits to Swift targets only, so C++ needs the explicit define. - `jaccl_conditional.cpp` requires `MLX_USE_JACCL` and compiles the `no_jaccl.cpp` stub otherwise. - `Cmlx.xcconfig` always defines `MLX_USE_JACCL`, so the Xcode project and its xcframeworks build as before. - `testUnavailableBackendsReportFalse` also asserts that `.jaccl` is unavailable on macOS when the trait is disabled. - `install.md` documents the trait and that SwiftPM enables the union of the traits that dependents request. The define follows the `MLX_USE_ACCELERATE` naming. Default on keeps the behaviour of ml-explore#502. The define states only the choice; platform and SDK gating stay in `jaccl_conditional.cpp`, so iOS, tvOS and visionOS keep building the stub whatever the trait. The CMake build keeps mlx's own JACCL gating.
4 tasks done
aleroot
added a commit
to aleroot/mlx-swift
that referenced
this pull request
Oct 28, 2026
Since ml-explore#502 every macOS build whose SDK ships <infiniband/verbs.h> links the JACCL distributed backend (RDMA over Thunderbolt 5), and dead stripping cannot remove it: `distributed::init("any")` reaches `jaccl::init`, and `MLXDistributed.Group` and the sharded MLXNN layers keep that path alive. An app that never forms a Thunderbolt cluster has no way to opt out. On a minimal MLX + MLXNN executable (release, stripped) the backend costs 1,065,280 bytes, 841 KB of them `__text`. Add a `JACCL` package trait, enabled by default, so an app can leave it out with `traits: []`: - `Package.swift` declares the trait and defines `MLX_USE_JACCL` for Cmlx when it is enabled. SwiftPM passes traits to Swift targets only, so C++ needs the explicit define. - `jaccl_conditional.cpp` requires `MLX_USE_JACCL` and compiles the `no_jaccl.cpp` stub otherwise. - `Cmlx.xcconfig` always defines `MLX_USE_JACCL`, so the Xcode project and its xcframeworks build as before. - `install.md` documents the trait and that SwiftPM enables the union of the traits that dependents request. The define follows the `MLX_USE_ACCELERATE` naming. Default on keeps the behaviour of ml-explore#502. The define states only the choice; platform and SDK gating stay in `jaccl_conditional.cpp`, so iOS, tvOS and visionOS keep building the stub whatever the trait. The CMake build keeps mlx's own JACCL gating.
davidkoski
pushed a commit
that referenced
this pull request
Oct 28, 2026
Since #502 every macOS build whose SDK ships <infiniband/verbs.h> links the JACCL distributed backend (RDMA over Thunderbolt 5), and dead stripping cannot remove it: `distributed::init("any")` reaches `jaccl::init`, and `MLXDistributed.Group` and the sharded MLXNN layers keep that path alive. An app that never forms a Thunderbolt cluster has no way to opt out. On a minimal MLX + MLXNN executable (release, stripped) the backend costs 1,065,280 bytes, 841 KB of them `__text`. Add a `JACCL` package trait, enabled by default, so an app can leave it out with `traits: []`: - `Package.swift` declares the trait and defines `MLX_USE_JACCL` for Cmlx when it is enabled. SwiftPM passes traits to Swift targets only, so C++ needs the explicit define. - `jaccl_conditional.cpp` requires `MLX_USE_JACCL` and compiles the `no_jaccl.cpp` stub otherwise. - `Cmlx.xcconfig` always defines `MLX_USE_JACCL`, so the Xcode project and its xcframeworks build as before. - `install.md` documents the trait and that SwiftPM enables the union of the traits that dependents request. The define follows the `MLX_USE_ACCELERATE` naming. Default on keeps the behaviour of #502. The define states only the choice; platform and SDK gating stay in `jaccl_conditional.cpp`, so iOS, tvOS and visionOS keep building the stub whatever the trait. The CMake build keeps mlx's own JACCL gating.
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.
Proposed changes
Builds MLX's JACCL backend (RDMA over Thunderbolt 5) on macOS. Until now
mlx-swift always built the
no_jaccl.cppstub, soMLXDistributed.Backend.jacclcould never form a group.
What changed
Source/Cmlx/mlx-conditional/jaccl_conditional.cppcompiles the JACCLbackend and its library when the SDK has
<infiniband/verbs.h>(macOS 26.2SDK and later), and the
no_jaccl.cppstub otherwise. iOS, visionOS, tvOS,Mac Catalyst and older SDKs keep the stub. Linux doesn't build
mlx-conditionaland is unchanged.Package.swiftand the Xcode project stop compilingno_jaccl.cppdirectly(the wrapper includes it) and add
jaccl/libto the header search paths.testUnavailableBackendsReportFalseno longer checks JACCL on macOS, whereavailability now depends on the SDK and the macOS version.
The deployment target is unchanged. Unlike MLX's CMake, this doesn't require a
26.2 deployment target: JACCL loads
librdma.dylibat runtime, so on macOSbefore 26.2
isAvailable(.jaccl)returns false.Notes
com.apple.security.temporary-exception.iokit-user-client-classset toIORDMAFamilyUCNext steps
ReduceScatter::eval_cpu(chore: Fix assertion in ReduceScatter::eval_cpu mlx#4557) that makessumScatteraborton the CPU in a group larger than one
Checklist
pre-commit run --all-filesto format my code / installed pre-commit prior to committing changes