Skip to content

MLX v0.32.3 with JACCL for the Pico stack - #8

Open
ronaldmannak wants to merge 9 commits into
pico/0.32.3from
pico/0.32.3-jaccl
Open

ronaldmannak wants to merge 9 commits into
pico/0.32.3from
pico/0.32.3-jaccl

Conversation

@ronaldmannak

@ronaldmannak ronaldmannak commented Oct 16, 2026 •

Copy link
Copy Markdown
Owner

The mlx-swift that the Pico stack builds against: upstream mlx-swift 0.32.3 with MLX core moved to v0.32.3, plus the JACCL backend. The base branch pico/0.32.3 is upstream's 0.32.3 tag, so this PR shows only our commits.

What changed

Update MLX to v0.32.3 (2202554)

  • mlx submodule v0.32.2 → v0.32.3. This fixes the ReduceScatter::eval_cpu assertion (ml-explore/mlx#4557), which aborted sumScatter in any group larger than one. It also fixes JACCL's ring all_gather (ml-explore/mlx#4443). Upstream mlx-swift 0.32.3 still carries MLX v0.32.2.
  • mlx-c → 0.7.0 plus ml-explore/mlx-c#137. MLX v0.32.3 added a global_scale argument to gather_qmm, which broke mlx-c's generated wrapper. move to v0.18.0 of mlx ml-explore/mlx-swift#137 passes std::nullopt, so the C API stays the same. move to v0.18.0 of mlx ml-explore/mlx-swift#137 isn't merged yet, so .gitmodules points mlx-c at PicoMLX/mlx-c (pico/0.32.3) for now.
  • Regenerated mlx-generated and include-framework with tools/update-mlx.sh.
  • New MLX sources: the build now includes mlx/memory.cpp and the Metal cross_entropy.cpp / gated_delta_update.cpp. Package.swift excludes the new Metal files in builds without Metal, and the new CUDA cusolver_utils.cpp / wddm.cpp in builds without CUDA. The Xcode project's exception lists gain the new benchmarks, tests, CUDA files, Metal kernels and generated headers.
  • CMakeLists.txt fetches v0.32.3 and no longer applies cmake/mlx.patch. Both of the patch's CUDA fixes are in v0.32.3 (ml-explore/mlx#4480, #4514).

Enable JACCL (ca6971b): ml-explore/mlx-swift#502, cherry-picked unchanged.

Build MLX v0.32.3's two new precompiled Metal kernels (c4bad90)

  • Even in JIT mode, MLX v0.32.3 precompiles gather_mm_offsets and gated_delta_update. tools/fix-metal-includes.sh copies MLX's list of always-built kernels, and that copy didn't have these two. Without gather_mm_offsets, any gatherMM with sorted right-hand indices (the MoE path) stopped the process with Unable to load kernel gather_mm_offsets.
  • Both kernels are now in the list and in mlx-generated/metal.

Review fixes (4c2d2c7)

  • CMake fetches PicoMLX/mlx-c d7fbf0a, the same commit as the submodule, instead of upstream ebc88f1, which doesn't compile against v0.32.3.
  • CUDA SwiftPM builds link cusolver, which cholesky.cu and cusolver_utils.cpp call.

Build MLX with the stream fix for integer floor_divide (18032ac)

  • In MLX v0.32.3, integer floor_divide (ml-explore/mlx#4515) builds its logical_and without the caller's stream. The op lands on the calling thread's own default stream, a thread-local one. Evaluating the result on any other thread stopped the process with There is no Stream(gpu, N) in current thread. mlx-swift-lm's MoE gather sort calls floorDivide on integer indices and evaluates on its generation thread, so every MoE generation in PicoCore crashed. lldb traced the stream back to floor_divide → logical_and.
  • The mlx submodule now points at PicoMLX/mlx pico/0.32.3 (712dbd3): v0.32.3 plus that one-line fix. .gitmodules points mlx at PicoMLX/mlx, and CMake fetches the same commit.
  • MLX v0.32.4 replaces this code with a FloorDivide primitive (ml-explore/mlx#4642), so the fork commit doesn't carry forward.

Review fixes (d128827)

  • CMake's CUDA build promotes CUDA::cusolver to a public dependency of mlxc.
  • SwiftPM's Linux CUDA build excludes the Windows-only cuda/wddm.cpp.
  • GatherMMTests drops the deprecated import MLXRandom, which the Xcode project's test target can't resolve.

Review fix (2160192): the Linux CUDA CMake CI script no longer checks for the deleted cmake/mlx.patch.

Build MLX with v0.32.4's two other missing-stream fixes (544eef9)

  • PicoMLX/mlx pico/0.32.3 (f21a959) adds two cherry-picks from v0.32.4. Both fix the same class of bug as floor_divide. ml-explore/mlx#4687 covers gather_mm/gather_qmm, which cast int32 indices without the stream; MoE routing can hit it. ml-explore/mlx#4663 covers layer_norm's CPU fallback, plus SDPA's boolean-mask fallback (CUDA only).
  • CMake fetches the same commit.

Report MLX's own version, and keep it in sync on updates (a67e1aa)

  • mlx_version() reported "0.32.0", because mlx-swift hard-codes the MLX_VERSION define, which MLX's CMake reads from mlx/version.h. Package.swift and Cmlx.xcconfig now say 0.32.3.
  • tools/update-mlx.sh copies the version from mlx/version.h on every update.

Test changes

  • FP8Tests.testFromFP8DecodesE4M3Bytes: MLX v0.32.3 decodes the E4M3FN NaN bytes 0x7F and 0xFF to NaN, as the format defines (ml-explore/mlx#4376). v0.32.2 decoded them as ±480. The test's reference decoder now returns NaN for those bytes, the comparison uses equalNaN: true, and the test checks both NaNs explicitly. The old test passes on v0.32.2 and fails on v0.32.3 without this change.
  • New GatherMMTests.testGatherMMWithSortedRightIndicesMatchesMatmul: runs the grouped gather path and compares the result with a plain matmul. Without the kernel it crashes with Unable to load kernel gather_mm_offsets. The tolerance is 1e-2 because either side may run at TF32 precision on chips with neural accelerators. A wrong gather would be off by far more than that.
  • New StreamTests: each test builds an op on one thread and evaluates it on another, waiting at most 30 seconds.
    • testIntegerFloorDivideEvaluatesOnAnotherThread: without the fix, the process stops with There is no Stream(gpu, 1) in current thread.
    • testGatherMMWithInt32IndicesEvaluatesOnAnotherThread: without #4687, the process stops with the same error.
    • testLayerNormOnTheCPUEvaluatesOnAnotherThread: without #4663, the test fails with "the evaluation never returned", and then the process stops with that error.
    • With the fixes, all three pass.
  • New VersionTests.testMLXVersionMatchesTheMLXSources: expects mlx_version() to match mlx/version.h. Before a67e1aa it fails with ("0.32.0") is not equal to ("0.32.3"). At a67e1aa: 389 SwiftPM tests and 390 Xcode-project tests pass, and the iOS build succeeds.

Evidence

On this Mac (macOS 27.0.1, Xcode 27.0), at 544eef9. At d128827, xcodebuild test -project xcode/MLX.xcodeproj -scheme MLX also compiled MLXTests (that scheme executes 0 tests here):

  • xcodebuild test -scheme mlx-swift-Package -destination 'platform=macOS' -only-testing:MLXTests -skipPackagePluginValidation -skipMacroValidation → Executed 388 tests, with 2 tests skipped and 0 failures, ** TEST SUCCEEDED **. That count includes the 11 DistributedTests, GatherMMTests and the three new StreamTests cases.
  • A scratch executable built against this branch prints isAvailable(.jaccl) = true and isAvailable(.ring) = true.
  • xcodebuild build -scheme mlx-swift-Package -destination 'generic/platform=iOS' → ** BUILD SUCCEEDED **.
  • xcodebuild build -project xcode/MLX.xcodeproj -scheme MLX -destination 'platform=macOS' → ** BUILD SUCCEEDED **.
  • At 4c2d2c7, CMake (Ninja) configure fetched mlx v0.32.3 and mlx-c d7fbf0a, and all 26 mlx-c sources compiled with CMake's own generated commands. I didn't re-run CMake after the mlx fetch moved to PicoMLX/mlx f21a959. That commit is the head of the fork's pico/0.32.3 branch.
  • swift-format lint --strict on the changed Swift files: clean.
  • This fork's GitHub Actions jobs report skipping, so the local runs above are the only evidence.

Not done on purpose

  • No full CMake build on this host. Upstream MLX's non-JIT build stops on its own gated_delta_update_nax.metal under the macOS 27 Metal SDK (no matching member function for call to 'get_destination_cooperative_tensor'). That kernel only builds in MLX's non-JIT NAX branch, and SwiftPM/Xcode builds never compile it.
  • No Linux build (CPU or CUDA). There's no host for it here.
  • No move to MLX v0.32.4. It lands on a separate branch so this one stays a known-good v0.32.3.
  • The comments in Tests/MLXIntegrationTests/Generated still name 0.32.2. Regenerating them needs Python mlx.
  • New MLX ops (gated_delta_update, matrix_transpose, …) aren't wrapped, because mlx-c doesn't expose them yet.

🤖 Generated with Claude Code

ronaldmannak and others added 2 commits October 15, 2026 23:54
Moves the mlx submodule from v0.32.2 to v0.32.3, which fixes the
assertion in ReduceScatter::eval_cpu (ml-explore/mlx#4557) that aborted
sumScatter in a group larger than one, and JACCL's ring all_gather
(ml-explore/mlx#4443).

mlx-c moves to 0.7.0 plus ml-explore/mlx-c#137, which passes the
global_scale argument MLX v0.32.3 added to gather_qmm and keeps the C API
unchanged. That commit is not on ml-explore/mlx-c yet, so the submodule
points at PicoMLX/mlx-c (branch pico/0.32.3) until ml-explore#137 lands.

- Regenerated mlx-generated and include-framework with tools/update-mlx.sh.
- New MLX sources: mlx/memory.cpp and the Metal cross_entropy.cpp and
  gated_delta_update.cpp are built; Package.swift excludes the new Metal
  files without Metal and the new CUDA cusolver_utils.cpp and wddm.cpp
  without CUDA. The Xcode project's exception lists gain the new
  benchmarks, tests, CUDA files, Metal kernels and generated headers.
- CMakeLists.txt fetches v0.32.3 and no longer applies cmake/mlx.patch:
  both CUDA fixes in it are upstream in v0.32.3 (ml-explore/mlx#4480,
  ml-explore/mlx#4514).
- CODE_OF_CONDUCT.md left the mlx repository; its exclude entries go too.
- FP8Tests: v0.32.3 decodes the E4M3FN NaN bytes 0x7F and 0xFF to NaN
  (ml-explore/mlx#4376), as the format defines; the test's reference
  decoder now does too, compares with equalNaN, and checks both NaNs.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 16, 2026 •

Copy link
Copy Markdown

Codex Review Summary

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

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-19T20:16:36.836436Z a67e1aa New commits
ℹ️ 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.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: ca6971b742

ℹ️ 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".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread CMakeLists.txt Outdated
GIT_REPOSITORY "https://github.com/ml-explore/mlx.git"
GIT_TAG "v0.32.2"
PATCH_COMMAND ${mlx_patch})
GIT_TAG "v0.32.3")

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Pin CMake to the compatible mlx-c revision

When building through CMake, this pins MLX 0.32.3 while the mlx-c FetchContent block below still downloads the old official ebc88f1 revision. That wrapper predates MLX 0.32.3's required global_scale argument to gather_qmm, so its generated call no longer compiles; unlike SwiftPM, the CMake build bypasses the newly pinned PicoMLX submodule containing the compatibility fix. Update the CMake mlx-c repository and revision to the compatible fork commit as well.

Useful? React with 👍 / 👎.

Comment thread Package.swift
"mlx/mlx/backend/cuda/conv.cpp",
"mlx/mlx/backend/cuda/cublas_utils.cpp",
"mlx/mlx/backend/cuda/cudnn_utils.cpp",
"mlx/mlx/backend/cuda/cusolver_utils.cpp",

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Link cuSOLVER in CUDA SwiftPM builds

With SPM_CUDA enabled, this new cusolver_utils.cpp is included in the Cmlx target and the new cholesky.cu is compiled by the CUDA plugin, but the CUDA linkerSettings still list cuDNN, cuBLAS, NVRTC, and the CUDA runtime without cusolver. The cuSOLVER calls therefore remain unresolved when a SwiftPM CUDA executable links; add the corresponding cuSOLVER library to the CUDA linker settings.

Useful? React with 👍 / 👎.

ronaldmannak and others added 2 commits October 16, 2026 00:10
MLX v0.32.3 precompiles gather_mm_offsets and gated_delta_update even in
JIT mode (mlx/backend/metal/kernels/CMakeLists.txt), and
tools/fix-metal-includes.sh, which mirrors that list, did not have them.
Without gather_mm_offsets in the metallib, any gather_mm with sorted
right-hand indices, as MoE models run, stopped the process with
"Unable to load kernel gather_mm_offsets".

The list gains both, and mlx-generated/metal gains the two kernels.
GatherMMTests runs that path against a plain matmul; without the kernel it
crashes with that error.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…— iteration 1

- CMakeLists.txt fetched upstream mlx-c ebc88f1, whose gather_qmm wrapper
  does not compile against MLX v0.32.3. It now fetches PicoMLX/mlx-c
  d7fbf0a, the submodule's commit (0.7.0 plus ml-explore/mlx-c#137).
- CUDA SwiftPM builds now link cusolver, which MLX v0.32.3's cholesky.cu
  and cusolver_utils.cpp call.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@ronaldmannak

ronaldmannak commented Oct 16, 2026 •

Copy link
Copy Markdown
Owner Author

Two new commits on this branch, pushed as 4c2d2c7:

c4bad90 Build MLX v0.32.3's two new precompiled Metal kernels. Found while testing PicoCore against this branch. Even in JIT mode, MLX v0.32.3 precompiles gather_mm_offsets and gated_delta_update. tools/fix-metal-includes.sh copies MLX's list of always-built kernels, and that copy didn't have these two. Without gather_mm_offsets, any gatherMM with sorted right-hand indices (the MoE path) stopped the process with Unable to load kernel gather_mm_offsets. Both kernels are now in the list and in mlx-generated/metal. The new GatherMMTests runs that path and compares the result with a plain matmul. I checked that the test crashes with that error when the kernel is missing.

4c2d2c7 Fixes for both Codex findings:

  • Pin CMake to the compatible mlx-c revision (4291779110): CMake now fetches PicoMLX/mlx-c d7fbf0a, the same commit as the Source/Cmlx/mlx-c submodule (0.7.0 plus ml-explore/mlx-c#137). It no longer fetches upstream ebc88f1, whose gather_qmm doesn't compile against v0.32.3.
  • Link cuSOLVER in CUDA SwiftPM builds (4291779121): the CUDA linkerSettings now include .linkedLibrary("cusolver"). MLX v0.32.3 calls cuSOLVER from cholesky.cu and cusolver_utils.cpp.

Evidence (local; this fork's Actions jobs report skipping):

  • xcodebuild test -scheme mlx-swift-Package -destination 'platform=macOS' -only-testing:MLXTests: Executed 385 tests, with 2 tests skipped and 0 failures and ** TEST SUCCEEDED **
  • xcodebuild build -scheme mlx-swift-Package -destination 'generic/platform=iOS': ** BUILD SUCCEEDED **
  • xcodebuild build -project xcode/MLX.xcodeproj -scheme MLX -destination 'platform=macOS': ** BUILD SUCCEEDED **
  • CMake (Ninja) configure fetched mlx v0.32.3 and mlx-c d7fbf0a Fix gather_qmm compatibility with MLX 0.32.3. All 26 mlx-c sources compiled with CMake's own generated commands (26/26 mlx-c sources compiled).

Not verified: a full CMake mlxc build on this host. Upstream MLX's non-JIT CMake build stops on its own gated_delta_update_nax.metal (no matching member function for call to 'get_destination_cooperative_tensor') under the macOS 27 Metal SDK. That kernel only builds in MLX's non-JIT NAX branch, and SwiftPM/Xcode builds never compile it. I didn't build the CUDA link step either, because there's no CUDA host here.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 4c2d2c78dd

ℹ️ 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".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread CMakeLists.txt Outdated
GIT_REPOSITORY "https://github.com/ml-explore/mlx.git"
GIT_TAG "v0.32.2"
PATCH_COMMAND ${mlx_patch})
GIT_TAG "v0.32.3")

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Link cuSOLVER in the CMake CUDA path

When MLX_BUILD_CUDA=ON, updating the fetched MLX revision to v0.32.3 brings in cholesky.cu and cusolver_utils.cpp, but the CUDA dependency promotion in target_link_libraries(mlxc PUBLIC ...) still omits CUDA::cusolver. The SwiftPM path now links cusolver for these same sources, while CMake consumers that use CUDA Cholesky can encounter unresolved cuSOLVER symbols; add CUDA::cusolver to the CMake promotion list.

Useful? React with 👍 / 👎.

Comment thread Package.swift
"mlx/mlx/backend/cuda/scaled_dot_product_attention.cpp",
"mlx/mlx/backend/cuda/slicing.cpp",
"mlx/mlx/backend/cuda/utils.cpp",
"mlx/mlx/backend/cuda/wddm.cpp",

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Exclude WDDM source from Linux CUDA builds

When SPM_CUDA enables the Linux CUDA configuration, that branch does not append noCudaCmlxExcludes, so adding wddm.cpp only to this list still leaves it in the CUDA-enabled build. This is the Windows/DXGI implementation—upstream v0.32.3 CMake adds it only under WIN32—and compiling it on Linux pulls in Windows-only APIs and breaks the SwiftPM CUDA build. Exclude it alongside delayload.cpp in the Linux CUDA branch.

Useful? React with 👍 / 👎.

Comment thread Tests/MLXTests/GatherMMTests.swift Outdated

import Foundation
import MLX
import MLXRandom

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Add MLXRandom to the Xcode test target

When MLXTests is built from the checked-in xcode/MLX.xcodeproj, this new import cannot be resolved because that project defines and links only the MLX, MLXNN, and MLXOptimizers targets; it has no MLXRandom target or framework reference. The synchronized test group automatically includes this file, so the project test target now fails with no such module 'MLXRandom', even though the SwiftPM test scheme works through its package dependency graph. Either avoid MLXRandom in this test or add the corresponding Xcode target and dependency.

Useful? React with 👍 / 👎.

ronaldmannak and others added 2 commits October 16, 2026 00:31
In MLX v0.32.3, integer floor_divide (ml-explore/mlx#4515) built its
logical_and on the calling thread's own default stream. When the result
was evaluated on any other thread, the process stopped with "There is
no Stream(gpu, N) in current thread". mlx-swift-lm's MoE gather sort
calls floorDivide on integer indices and evaluates on its generation
thread, so every MoE generation in PicoCore crashed.

The mlx submodule now points at PicoMLX/mlx pico/0.32.3: v0.32.3 plus
the one-line fix that passes the stream through. CMake fetches the same
commit. v0.32.4 replaces this code with a FloorDivide primitive
(ml-explore/mlx#4642).

StreamTests.testIntegerFloorDivideEvaluatesOnAnotherThread builds an
integer floorDivide on one thread and reads it on another. Without the
fix it stops the process with that error.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ndom import — iteration 2

- CMake's CUDA build promotes CUDA::cusolver to a public dependency of
  mlxc, as it does for MLX's other private CUDA libraries. MLX v0.32.3
  links it privately for cholesky.cu and cusolver_utils.cpp.
- SwiftPM's Linux CUDA build excludes cuda/wddm.cpp. Upstream builds it
  only on Windows, and it calls Windows-only APIs.
- GatherMMTests no longer imports MLXRandom. The module is deprecated
  (MLXRandom lives in MLX), and the Xcode project's MLXTests target
  doesn't link it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@ronaldmannak

ronaldmannak commented Oct 16, 2026 •

Copy link
Copy Markdown
Owner Author

Two more commits, now at d128827:

18032ac Build MLX with the stream fix for integer floor_divide. Found by running PicoCore's suite on this branch. Every MoE generation stopped with There is no Stream(gpu, N) in current thread. lldb traced the stream to MLX v0.32.3's integer floor_divide (ml-explore/mlx#4515): its logical_and takes no stream, so it lands on the calling thread's own default stream. mlx-swift-lm's MoE gather sort calls floorDivide on one thread and evaluates on its generation thread.

  • The mlx submodule now points at PicoMLX/mlx pico/0.32.3 (712dbd3): v0.32.3 plus the one-argument fix. .gitmodules and CMake point at PicoMLX/mlx.
  • v0.32.4 replaces this code with a FloorDivide primitive (ml-explore/mlx#4642).
  • New test StreamTests.testIntegerFloorDivideEvaluatesOnAnotherThread. Without the fix it stops the process with There is no Stream(gpu, 1) in current thread. With the fix it passes.

d128827 Fixes for the three findings on 4c2d2c7:

  • Link cuSOLVER in the CMake CUDA path (4291931215): CUDA::cusolver joins the libraries promoted to public on mlxc. MLX links it privately (mlx/backend/cuda/CMakeLists.txt:299).
  • Exclude WDDM source from Linux CUDA builds (4291931219): the Linux CUDA excludes now list cuda/wddm.cpp next to delayload.cpp. Upstream builds it only under WIN32.
  • Add MLXRandom to the Xcode test target (4291931225): GatherMMTests drops import MLXRandom. That module is deprecated, the MLXRandom namespace lives in MLX, and no other test imports it.

Evidence (local, at d128827):

  • xcodebuild test -scheme mlx-swift-Package -destination 'platform=macOS' -only-testing:MLXTests … → Executed 386 tests, with 2 tests skipped and 0 failures
  • xcodebuild test -project xcode/MLX.xcodeproj -scheme MLX -destination 'platform=macOS' → exit 0. The MLXTests target now compiles GatherMMTests.swift. This scheme's run executes 0 tests on this Mac, so it proves the compile only.
  • At 18032ac: iOS (generic/platform=iOS) and Xcode-project MLX builds succeed.
  • swift-format lint --strict on the changed Swift files: clean.

Not verified: both CUDA changes. There's no CUDA host here.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: d1288278be

ℹ️ 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".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread CMakeLists.txt Outdated
GIT_TAG "v0.32.2"
PATCH_COMMAND ${mlx_patch})
GIT_REPOSITORY "https://github.com/PicoMLX/mlx.git"
GIT_TAG "712dbd34939e902f7dbb844bf3ddaf3cf4c77f20")

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Remove the deleted patch check from CUDA CI

In the linux_build_cmake_cuda job from .github/workflows/pull_request.yml, .github/scripts/build-linux-cuda-cmake.sh still runs git -C _deps/mlx-src apply --reverse --check "$PWD/../cmake/mlx.patch" and exits on failure. This change deletes that patch while replacing it with the pinned MLX revision; git apply -h documents --check as checking patch applicability, and invoking it with this deleted path returns can't open patch ... No such file or directory. Consequently every Linux CUDA CMake CI run now exits immediately after configuration, so the obsolete verification must be removed or updated.

Useful? React with 👍 / 👎.

…tion 3

build-linux-cuda-cmake.sh still checked that cmake/mlx.patch was
applied to the fetched MLX. That patch is gone, since both of its fixes
ship in v0.32.3 (ml-explore/mlx#4480, #4514), so the check failed every
Linux CUDA CMake run right after configure.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@ronaldmannak

ronaldmannak commented Oct 16, 2026 •

Copy link
Copy Markdown
Owner Author

Remove the deleted patch check from CUDA CI (4292104554): fixed in 2160192. .github/scripts/build-linux-cuda-cmake.sh no longer runs git apply --reverse --check against cmake/mlx.patch. That patch is gone because both of its fixes ship in v0.32.3 (ml-explore/mlx#4480, #4514). bash -n on the script passes. Not run: the CUDA job itself, since there's no CUDA host here and this fork's Actions jobs report skipping.

The other open threads, for whoever resolves them (this repo's hooks don't let me reply in threads):

  • 4291779110 Pin CMake to the compatible mlx-c revision: fixed in 4c2d2c7
  • 4291779121 Link cuSOLVER in CUDA SwiftPM builds: fixed in 4c2d2c7
  • 4291931215 Link cuSOLVER in the CMake CUDA path: fixed in d128827
  • 4291931219 Exclude WDDM source from Linux CUDA builds: fixed in d128827
  • 4291931225 Add MLXRandom to the Xcode test target: fixed in d128827

🤖 Addressed by Claude Code

The same class of bug as integer floor_divide: an MLX op built on the
calling thread's own default stream instead of the stream it was given.
Evaluating the result on any other thread stops the process with
"There is no Stream(gpu, N) in current thread".

PicoMLX/mlx pico/0.32.3 cherry-picks both upstream fixes from v0.32.4:

- ml-explore/mlx#4687: gather_mm and gather_qmm cast non-uint32
  indices to uint32 without the stream. MoE layers that route with
  int32 indices hit it.
- ml-explore/mlx#4663: layer_norm's CPU fallback multiplied without the
  stream, and SDPA's boolean-mask fallback (CUDA only, since Metal
  takes boolean masks directly) built its where without it.

StreamTests gains testGatherMMWithInt32IndicesEvaluatesOnAnotherThread
and testLayerNormOnTheCPUEvaluatesOnAnotherThread. Without #4687, the
gather test stops the process with that error. Without #4663, the CPU
layer_norm evaluation never returns: the test fails after 30 seconds,
and then the process stops with the same error. The floor_divide test
now shares their helper, which waits at most 30 seconds.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
MLX's version() returns the MLX_VERSION define. MLX's CMake reads it
from mlx/version.h, but mlx-swift passes it itself, in Package.swift and
Cmlx.xcconfig, and it was still "0.32.0". So this branch reported 0.32.0
while it built v0.32.3.

Both now say 0.32.3. tools/update-mlx.sh copies the version from
mlx/version.h on every update, so it can't go stale again.

VersionTests reads mlx/version.h and expects mlx_version() to match it.
Before this change it fails: ("0.32.0") is not equal to ("0.32.3").

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@ronaldmannak

Copy link
Copy Markdown
Owner Author

a67e1aa Report MLX's own version, and keep it in sync on updates

mlx_version() reported "0.32.0" on this branch, although it builds v0.32.3. MLX's version() returns the MLX_VERSION define. MLX's CMake reads it from mlx/version.h, but mlx-swift passes it itself, and the value was still "0.32.0" (set in ab924c8).

  • Package.swift and xcode/xcconfig/Cmlx.xcconfig now say 0.32.3.
  • tools/update-mlx.sh copies the version from mlx/version.h on every update. I ran those lines against copies set back to 0.32.0: they read 0.32.3, and the result is identical to the hand-edited files.
  • New VersionTests.testMLXVersionMatchesTheMLXSources: it reads mlx/version.h and expects mlx_version() to match it. Before the fix it fails with XCTAssertEqual failed: ("0.32.0") is not equal to ("0.32.3").

Evidence (local, at a67e1aa):

  • xcodebuild test -scheme mlx-swift-Package -destination 'platform=macOS' -only-testing:MLXTests … → Executed 389 tests, with 2 tests skipped and 0 failures, including VersionTests.
  • xcodebuild build -scheme mlx-swift-Package -destination 'generic/platform=iOS' → ** BUILD SUCCEEDED **.
  • xcodebuild test -project xcode/MLX.xcodeproj -scheme MLX -destination 'platform=macOS' → exit 0, 390 test cases passed, including VersionTests.

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.

1 participant