Skip to content

build(cuda): move the CUDA images to MLX v0.32.4 - #21

Merged
mrothroc merged 9 commits into
mainfrom
fix/mlx-cuda-followups
Nov 21, 2026
Merged

mrothroc merged 9 commits into
mainfrom
fix/mlx-cuda-followups

Conversation

@mrothroc

@mrothroc mrothroc commented Nov 20, 2026 •

Copy link
Copy Markdown
Owner

Moves the CUDA images from MLX v0.32.0 to v0.32.4 and closes the follow-ups from #20.

Why

In one long go test process, 15 CUDA gpu tests failed while passing alone. MLX v0.32.0's CUDA graph cache counted every miss for the process lifetime and threw past 2×capacity, and a commit that threw left its dependency edges in the encoder, so every later commit failed with cudaGraphAddDependencies: invalid argument. v0.32.4 fixes both upstream (ml-explore/mlx#4356, ml-explore/mlx#4661).

Patch audit on v0.32.4

Patch Result
worker wait Fixed upstream (#4452); patch removed. The worker check now asserts no spin and still fails on v0.32.0.
allocator reclaim Rebased. Upstream adopted the clear_cache trim but uses make_current without restoring the device, and still does not trim on set_cache_limit.
JIT CCCL Still needed. dirs.cpp now includes common/utils.h; the source check and archive probe provide current_binary_dir().
conv-transpose grad, conv plan fallback Apply unchanged.

v0.32.4 implements Cholesky with cuSOLVER (ml-explore/mlx#4208), so every libmlx link line adds -lcusolver. The app image now rejects a base not built from v0.32.4.

Follow-ups

  • Bridge errors keep MLX's original cache-thrash text; Go appends the batching hint (pure function, unit-tested).
  • Strict-FP32 reference tests: the grid PyTorch, HGRN2/mLSTM, and TTT-MLP split-continuation tests compare strict-FP32 values but CUDA allows TF32 by default; they missed by 3e-4 to 6.5e-4 and pass with TF32 off. A shared internal/strictfp32test helper reruns them in a child process with MLX_ENABLE_TF32=0.
  • Build diagnostics: the worker probe prints its output on failure and the addarch base checks run under set -x. Each failed once on Cloud Build without saying why, and neither reproduced.

Opportunistic

  • TestSWAWindow128Smoke skips without the gitignored example shards instead of failing.
  • The three Metal-only local-learner MLX tests skip on other backends instead of failing.

Verification

  • Local (Metal, Homebrew MLX 0.32.4): make lint 0 issues; portable suite passes; full MLX suite passes.
  • Cloud Build: base golf-mlx-cuda-base:mlx-0.32.4-go1.27.4 and arch golf-mlx-cuda:mlx-0.32.4-go1.27.4 built. All patch checks pass before and after, and the NVRTC probe reports libmlx CCCL fallback /usr/local/include/cccl compiles cuda::std::rint; toolkit-only control fails as expected. The validation app build succeeded.
  • NVIDIA L4:
    • Full gpu suite in one process, default TF32, fresh PTX cache: exit 0, 173 top-level passes, no thrash or cudaGraphAddDependencies errors.
    • arch + train: exit 0 at e4cf45e (train 2052s, run with -timeout 60m because the suite exceeds go test's 10m default on an L4).
    • QAT via a relocated binary: int8 4.2727→4.2593, int6 4.2727→4.2469.
  • golf-mlx-cuda:latest promoted to the v0.32.4 image; the previous image stays tagged mlx-0.32.0-go1.27.4-jitcccl. The first check-mixlab-images run predates the promotion and was rejected by the new version guard, as intended.

MLX v0.32.0's CUDA graph cache counted every miss for the life of the
process and threw once it passed twice the capacity, and a commit that
threw left its dependency edges in the encoder, so every later commit
failed with cudaGraphAddDependencies: invalid argument. A long go test
process crossed the limit without real thrashing and 15 gpu tests then
failed in one run while passing alone. v0.32.4 fixes both upstream
(#4356 resets the encoder after a failed commit, #4661 counts only
consecutive misses).

Patches against v0.32.4:
- worker wait: fixed upstream (#4452). The patch is removed; the worker
  check now asserts the pinned source does not spin (it fails on v0.32.0).
- allocator reclaim: rebased. Upstream adopted the clear_cache trim but
  switches devices with make_current and never restores the caller's
  device, and still does not trim on set_cache_limit; keep ours.
- JIT CCCL: dirs.cpp now includes common/utils.h for current_binary_dir();
  the source check and archive probe supply a stand-in for that function.
- conv-transpose grad and conv plan fallback apply unchanged.

The app image now requires a base built from v0.32.4, since the encoder
fixes come from the release itself rather than a marker-carrying patch.
The bridge replaced MLX's cache-thrash message with its own tuning hint,
which hid the original error while diagnosing the CUDA graph cascade.
The bridge now records MLX's text verbatim and Go appends the batching
settings in effect when it reads the error, as a pure function that is
tested without CGO.
The fixtures are strict FP32, but CUDA allows TF32 by default and the
policy is frozen per process, so dilated convolutions missed them by
TF32 rounding (~3e-4 absolute). The test now reruns itself in a child
process with TF32 disabled, keeping the original tolerance.
data/example is gitignored, so a fresh checkout failed the test instead of skipping it as the repository convention requires.
The base build failed the worker check with only a CalledProcessError, hiding whether callbacks stopped arriving or the idle loop spun.
A failed marker or commit check stopped the build with only the whole RUN line, not which test failed.
v0.32.4 implements Cholesky with cuSOLVER (ml-explore/mlx#4208), so static libmlx now references cusolverDn*; the gpu test binary failed to link on a CUDA host.
On CUDA, HGRN2/mLSTM full-block fixtures and TTT-MLP split continuation missed their 2e-4 bounds under default TF32 (2.9e-4 to 6.5e-4) and passed with TF32 off. The child now starts with MLX_ENABLE_TF32=0, because Go does not see the bridge's setenv and config-driven precision would otherwise conflict.
NewLocalLearnerSession rejects non-Metal backends by design, so on CUDA these tests failed instead of skipping.
@mrothroc
mrothroc merged commit 5aaf22e into main Nov 21, 2026
13 checks passed
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