Skip to content

Catch prism up with ml-explore/mlx-swift main (4 commits past 0.33.0) - #31

Merged
jeethu merged 5 commits into
prismfrom
catchup-1691
Nov 15, 2026
Merged

jeethu merged 5 commits into
prismfrom
catchup-1691

Conversation

@jeethu

@jeethu jeethu commented Nov 15, 2026

Copy link
Copy Markdown
Member

Catches prism up with ml-explore/mlx-swift main a557dd6, the four commits past 0.33.0 (numen-tech/gemma4-qat#1691). A merge, as the 0.33.0 sync was (#23). The vendored core stays at numen-tech/mlx 0676be67f and mlx-c at a26f2d5 (v0.8.0): upstream did not move either.

Upstream commits:

Conflicts and how they were resolved:

  • xcode/xcconfig/Cmlx.xcconfig: keeps MLX_VERSION="0.32.4" and takes MLX_USE_JACCL=1.
  • Tests/MLXTests/DistributedNNTests.swift: upstream wrapped each body in withRandomState; the fork's added checks in shardingEdgeCasesBody (segment validation, stream threading, frozen keys) are carried inside it unchanged.
  • Tests/MLXTests/FP8Tests.swift: keeps the fork's NaN-aware compare for E4M3 0x7F/0xFF, now #expect(... allClose(equalNaN: true) ...).
  • Tests/MLXTests/MLXFastKernelTests.swift: the fork's testFreeSDPAForceFused becomes @Test(.randomSeed(0)) func freeSDPAForceFused() with expectEqual(rtol: 1e-4, atol: 1e-5).
  • Tests/MLXTests/MLXArray+InitTests.swift: the fork's linspace endpoint: overload checks use expectEqual.
    The fork-only XCTest files (Apple6, compile cache, lock ordering, quantization, optimizer additions) stay XCTest.

What ran: xcodebuild test -scheme mlx-swift-Package -destination platform=macOS -skipPackagePluginValidation on an M3 Max: XCTest 240 executed, 5 skipped, 0 failures; Swift Testing 315 and 700 tests passed; CmlxTests 1 passed. The gemma4-qat side (repin, full NumenKit plan, NAXPolicyTests route-version assertions) runs in the dependent gemma4-qat Draft PR. Not run: Linux, iOS devices (no core or kernel change, so no device leg is needed).

aleroot and others added 5 commits October 28, 2026 13:16
…#517)

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.
* switch some tests to Swift Testing

- migrate off of xctest onto swift testing
- this is round 1
…sults (ml-explore#518)

* fix callers of mlx_vector_array_values to handle potentially empty results

- if a call to mlx_quantize fails it can produce an empty result
- but the calling code expects 2 or more valeus in the array
- if using withError to catch the error, this crashes instead

- fix by allowing callers to specify the minimum number of arrays they need
- those values are not usable, but work fine as stand-ins

- fixes ml-explore#516
…e#523)

The noMetalCmlxExcludes entry was spelled "mxl/mlx/backend/metal/cross_entropy.cpp",
  so the file was not excluded on Linux and the SwiftPM build failed with:

    mlx/backend/metal/device.h:5:10: fatal error: 'Metal/Metal.hpp' file not found

  The typo was introduced in ml-explore#508 and first shipped in 0.33.0
… prism (numen-tech/gemma4-qat#1691)

Upstream: the JACCL package trait (ml-explore#517, default on), Swift Testing for
most MLXTests suites (ml-explore#519), the empty mlx_vector_array_values guards
(ml-explore#518) and the Linux exclude typo (ml-explore#523, already fixed on prism).

Conflicts: Cmlx.xcconfig keeps MLX_VERSION 0.32.4 and takes
MLX_USE_JACCL=1; the fork's test additions in DistributedNNTests,
FP8Tests (NaN-aware E4M3 compare), MLXFastKernelTests (free SDPA
forceFused) and MLXArray+InitTests (linspace endpoint overloads) are
carried into upstream's Swift Testing / withRandomState form. The
vendored core stays at numen-tech/mlx 0676be67f.
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 15, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-15T19:39:48.133410Z d263af6 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

jeethu added a commit to numen-tech/mlx-swift-lm that referenced this pull request Nov 15, 2026
…ch/mlx-swift#31 merges

SwiftPM refuses two branch requirements for one package, so the host
(numen-tech/gemma4-qat, building against the unmerged branch heads) can pin
catchup-1691 only if this package names the same branch. Revert this commit
(back to prism) once numen-tech/mlx-swift#31 is merged, before this merges.
jeethu added a commit to numen-tech/mlx-swift-lm that referenced this pull request Nov 15, 2026
@jeethu
jeethu merged commit ae06570 into prism Nov 15, 2026
@jeethu
jeethu deleted the catchup-1691 branch November 15, 2026 19:49
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