Skip to content

update: advance MLX pin to 5a48f9cc - #3517

Merged
inureyes merged 14 commits into
mainfrom
update/mlx-pin-5a48f9cc
Nov 29, 2026
Merged

inureyes merged 14 commits into
mainfrom
update/mlx-pin-5a48f9cc

Conversation

@inureyes

Copy link
Copy Markdown
Member

Advance the reproducible MLX pin from fc344c98 to 5a48f9cc, the head of upstream main on 2026-11-28 (87 commits, past v0.32.5 and the 0.33.0 version bump). Review record: docs/mlxcelverse/mlx-pin-2026-11-28.md.

Changes

Validation

On M3 Ultra: release build at 5a48f9cc, make verify-test (17374 passed, 0 failed, 515 ignored), greedy generation on gemma-3n-e2b-it-4bit and qwen3.5-4b-4bit, make verify-rocm-overlay, overlay drift check, pin parser tests, fmt.

Not validated: no CUDA or ROCm compile (no GB10 or AMD host from this machine). The GB10 build, test and the #637 cap decision are delegated to a GB10 run; see the comment below.

Move the MLX pin from fc344c98 to 5a48f9cc, the head of upstream main on 2026-11-28 (87 commits, past v0.32.5 and the 0.33.0 version bump).

- Retire the CPU quantized-matmul overlay (#2248): upstream now accumulates the fp qmm loops in float (ml-explore/mlx#4879). cpu_qmm_accum_tests now guard the upstream loops.
- Rebase 24 Metal and CUDA overlays by 3-way merge. CUDA layer_norm and row_reduce shrink to their remaining deltas now that upstream carries #4866 and #4916; SDPA threads upstream's window_size through mlxcel's deterministic and bucketed plan paths; qmm_sm80 keeps the #637 sm_120/121 cap beside #4851's 128-row tile and renames the affected JIT modules so a pre-#4851 cached PTX is not reused.
- ROCm overlay: retarget onto the pin, move the fork's fusion limits into mlx/compile/fuse.cpp after upstream split compile.cpp (#4953), define the new allocator hooks as no-ops and add NO_GPU stubs for GroupedMM and SignBit (LOCAL_FIXES 76 to 78).
- On M5, int8 activation QMM (#4802) stays on as in upstream.

Validated on M3 Ultra: release build, make verify-test (17374 passed, 0 failed), greedy generation on gemma-3n and qwen3.5, make verify-rocm-overlay, fmt. CUDA and ROCm were not compiled (no GB10 or AMD host); the GB10 build and the #637 cap decision are left to a GB10 run.
@inureyes inureyes added status:in-progress Currently being worked on type:enhancement New features, capabilities, or significant additions labels Nov 28, 2026
@inureyes

Copy link
Copy Markdown
Member Author

GB10 verification and decision (handoff to the GB10 agent)

This branch was built and tested only on M3 Ultra. The CUDA overlay merges were not compiled. Please run the following on spark-101 or spark-102, under gpu-lock, and record the results here before this PR merges.

  1. Build and gate: cargo build --release --features cuda, then make verify-test-cuda and make verify-test-cuda-qmm-determinism. Fix any compile error in the overlays on this branch (most likely scaled_dot_product_attention.cpp, qmm/qmm_sm80.cu, reduce/row_reduce.cu, reduce/reduce_ops.cuh, layer_norm.cu, load.cpp).
  2. perf(cuda/quant): sm_120/sm_121-tuned quantized GEMM for Blackwell prefill #637 cap A/B. #4851 changed the 128-row qmm_sm80 kernel (pipeline depth 2, 1x4 MMA) and added its own 128-row choice (large_tiles), so the perf(cuda/quant): sm_120/sm_121-tuned quantized GEMM for Blackwell prefill #637 measurement (+38% prefill on llama-3.1-8b-4bit, +31% on qwen2.5-7b-4bit at 8192 tokens) no longer applies. Compare this branch against a local variant where mlxcel_tile_m_cap returns 64 (upstream's large_tiles ? 128 : 64): prefill tok/s at 512, 2048 and 8192 tokens on llama-3.1-8b-4bit and qwen2.5-7b-4bit, decode tok/s, and greedy parity between the two builds. Use a fresh JIT cache directory for each build.
  3. Decision. The policy for this pin is to follow upstream. Keep the cap only if it is faster at 2048 or 8192 tokens by more than the run-to-run spread with greedy output unchanged. Otherwise remove mlxcel_tile_m_cap (and the 128p2 / gather r2 tags it needs), set TILE_M_CAP_BLACKWELL in src/lib/mlxcel-core/src/autotune/ops/cuda_kernel_knobs.rs to the upstream value, and update the overlay header and docs/mlxcelverse/mlx-pin-2026-11-28.md.

Push any fix to this branch, post the numbers here, and merge once the CUDA gate passes.

inureyes pushed a commit that referenced this pull request Nov 28, 2026
…#3500)

Turbo4 K/V quantization stays on the device, and unmasked single-token decode queries read the packed CUDA cache directly through a new fused attention kernel (one block per batch element and query head, FP32 softmax partials) instead of dequantizing the cold rows first. Dense Turbo4 and the MLA latent codec share the 4-bit packing and #3497's boundary-count lookup, with the former scalar codec kept as the test reference.

Merged on the maintainer's instruction without a fresh local CUDA run: the branch was brought onto main by merging main into it, with the resulting tree set equal to a clean cherry-pick of the PR's own commit onto current main (the stacked #3497 commit is already on main as `241a59a3`), so main..head is exactly the PR's 28-file change. The upcoming MLX pin change in #3517 would force the same rebuild and revalidation again.

Closes #3272
# Conflicts:
#	CHANGELOG.md
#	src/lib/mlxcelverse/overlays/cuda/mlx/backend/cuda/device.cpp
At MLX 5a48f9cc the overlay header no longer gets int64_t through a transitive include, so the CUDA build failed at grouped_gemm.h:59 with `int64_t has not been declared`. Include <cstdint> directly and note it in the overlay header comment.

Refs #3517
Spark-X2.5 (#3516) added the "Spark" family to ModelType::metadata but not to FAMILY_ORDER, so `family_order_is_exhaustive` failed on main. Place it after PLaMo.

Refs #3516
… SDPA

The row-wise DSpark gates compare drafted tokens with classic decode token for token. On CUDA that comparison holds only under MLXCEL_SDPA_DETERMINISTIC=1: otherwise decode attention takes cuDNN stream-K, which does not reduce in a fixed order, and the engine a shape gets depends on what ran earlier in the process. At MLX 5a48f9cc the MiniCPM5 gate passed alone but failed in the lib suite after hy_v4 sink_sdpa_matches_the_written_out_softmax_at_checkpoint_geometry, flipping a near-tie on the 290-token prompt; with the flag it passes in either order.

A CUDA build now skips both gates without the flag and fails under MLXCEL_REQUIRE_MODELS=1, as scheduler_real_batch_parity_tests.rs does.

Refs #3261
Refs #3517
At MLX 5a48f9cc the 128-row qmm_sm80 tile is #4851's kernel (pipeline depth 2, 1x4 MMA) and upstream picks it by its own wave heuristic. On GB10, a build with the #637 cap against one with upstream's large_tiles ? 128 : 64 gave prefill ratios (cap / upstream, medians of three alternating runs) of 1.021, 0.996 and 0.991 at 512, 2048 and 8192 tokens on llama-3.1-8b-4bit, and 1.168, 0.966 and 1.003 on qwen2.5-7b-4bit, with byte-identical 200-token greedy output. The pin's rule keeps the cap only for a gain at 2048 or 8192 tokens beyond the run-to-run spread, so the overlay follows upstream.

mlxcel_tile_m_cap, the 128p2 tag and the gather module's r2 marker go; the #910 r2 marker on the main module and the MLXCEL_QMM_TILE_{M,N,K} overrides stay. Without the cap a 128-row tile launches only from the grouped 64_128 module, a name the previous pin never used, so no pre-#4851 cached PTX can be picked up. The autotuner's TILE_M_CAP_BLACKWELL follows the kernel to 64, or its entries would not be found at startup. The 512-token gain on qwen2.5-7b-4bit (about +10%, re-measured) is recorded in the pin doc for a later look.

Refs #637
Refs #3517
# Conflicts:
#	src/lib/mlxcelverse/overlays/rocm/LOCAL_FIXES.md
#	src/lib/mlxcelverse/overlays/rocm/README.md
@inureyes

Copy link
Copy Markdown
Member Author

GB10 (spark-102, sm_121) handoff results, on 107f769c (this branch with origin/main at a3336e2a merged in).

Build. The CUDA build failed at grouped_gemm.h:59 (int64_t not declared); the overlay now includes <cstdint> (005ee3e5). No other overlay errors (cmake --build -k).

#637 cap A/B. This branch against a build where mlxcel_tile_m_cap returns 64, three alternating runs each, 128 generated tokens, prefill ratio cap / upstream (medians):

Model 512 2048 8192
llama-3.1-8b-4bit 1.021 0.996 0.991
qwen2.5-7b-4bit 1.168 0.966 1.003

Decode within 1% except qwen at 2048 (49.6 against 51.6 tok/s, for upstream). 200-token greedy output byte-identical on both models. No gain at 2048 or 8192, so per the decision rule the cap is dropped (e6f27804): the overlay takes large_tiles ? 128 : 64, the 128p2 tag and the gather r2 marker go (the #910 r2 stays), and TILE_M_CAP_BLACKWELL moves to 64. A re-run confirmed a real +10% at 512 tokens on qwen (about 4660 against 4230 tok/s); it is recorded in the pin doc for a later look.

Gate. make verify-test-cuda-qmm-determinism: 5 passed. make verify-test-cuda: 17741 passed, 3 failed, none from this PR:

  • deepseekocr_encoder_parity (CLIP absmean 0.1306 against 0.1436): identical on main at the old pin.
  • server_graceful_shutdown::a_second_signal_during_the_drain_exits_one_at_once (exit 4 against 1, during the first CUDA kernel compile): 3 of 3 pass alone.
  • remote_service::unowned_run_entry_cannot_seed_state_before_first_prepare (Address already in use, another session was testing on the host; the test rebinds a released port): the gate's binary then passed 6 of 7 runs alone (one more failure in 0.03 s, output not captured), and the --lib build 3 of 3. The distributed code is untouched here.

Fixes found on the way.

The pin's mlx/scheduler.h calls std::atomic<int>::notify_all(), a C++20 member, and every .hip file reaches it through mlx/array.h, so the -std=c++17 that the ROCm overlay passed to hipcc failed the Windows compile-only job. The .hip command now uses -std=c++20, matching the host sources (ROCm LOCAL_FIXES.md item 80).

The device/unary_ops.cuh overlay that #3540 added was copied at the old pin fc344c98; upstream added the SignBit functor between that pin and 5a48f9cc, so the overlay now carries it and is stamped at 5a48f9cc. It is the only one of the CUDA overlay files from #3540 that upstream changed between the pins.

check_nvrtc_headers.py (static and --require-nvrtc against the new-pin build tree), make verify-rocm-overlay, the CUDA compile and jit lib tests and both real-checkpoint DSpark gates pass on spark-102.
The router WebUI Playwright harness from #3552 indexed `completed_by_handle[index][generation]` inside `for generation in 0..COMPLETING_GENERATIONS`, which `clippy::needless_range_loop` rejects under `-D warnings`. Main's clippy job did not run for that WebUI-only change, so the lint first failed on this PR. The loop now walks the row with `iter_mut().enumerate().take(COMPLETING_GENERATIONS)`; behaviour is unchanged.

`cargo clippy --lib --tests --features cuda -- -D warnings` and the module's tests pass.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

status:in-progress Currently being worked on type:enhancement New features, capabilities, or significant additions

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant