Skip to content

docs(moe): re-validate CUDA fused-MoE Dff cap on MLX 0.32.1 - #721

Merged
inureyes merged 2 commits into
mainfrom
perf/issue-712-cuda-fused-moe-dff-revalidation
Jul 9, 2026
Merged

docs(moe): re-validate CUDA fused-MoE Dff cap on MLX 0.32.1#721
inureyes merged 2 commits into
mainfrom
perf/issue-712-cuda-fused-moe-dff-revalidation

Conversation

@inureyes

@inureyes inureyes commented Jul 9, 2026

Copy link
Copy Markdown
Member

Summary

Re-validates the CUDA fused-MoE Dff cap sweep behind FUSED_MOE_MAX_DFF_CUDA on GB10 under the current MLX 0.32.1 pin, closing the "pending re-validation" note left by issue #330 / PR #711 in docs/benchmark_results/fused-moe-decode-kernel-design.md.

Sweep table

Hardware: GB10 (DGX Spark), sm_121, CUDA 13.0. MLX pin: 57c66cac7cb3e5b1eb350488a61f1506b40d39f8 (0.32.1, #703/#704). Harness: mlxcel-bench-decode, prompt "Hello, how are you today?", 100 decode tokens after a 20-token warmup, median of 3 runs per side, MLXCEL_FUSED_MOE_MAX_DFF=1 (gather_qmm fallback) vs =20000 (fused).

Model Dff fallback tok/s fused tok/s delta
lfm2-8b-a1b (control) 1792 140.68 160.63 +14.2%
phi-3.5-moe 6400 53.85 55.80 +3.6%
llama-4-scout-17b 8192 21.64 21.32 -1.5%
mixtral-8x7b 14336 28.26 27.78 -1.7%

The ratio=1.0 crossover interpolates to ~7672 between the phi-3.5-moe and llama-4-scout points, close to the prior ~8000 measured on MLX pin e9463bb. The ~4% shift sits within run-to-run noise at this Dff point: the 2026-07-03 sweep already flagged Dff 8192 as noisy (one of its three fused runs matched the fallback), and this 2026-07-10 sweep's own llama-4-scout fallback spans 21.33-21.85 tok/s run to run, a 2.4% spread comparable to the shift.

What changed

  • FUSED_MOE_MAX_DFF_CUDA in src/models/switch_layers.rs is confirmed at 8192, not re-tuned; this PR does not touch that file.
  • Adds a 2026-07-10 addendum to docs/benchmark_results/fused-moe-decode-kernel-design.md with the sweep table, per-model findings, and the confirm-not-retune conclusion.
  • Amends the 2026-07-09 addendum's "pending" note to point at the new addendum, keeping the original text as historical provenance.
  • Updates the MLXCEL_FUSED_MOE_MAX_DFF env-var table row to state the confirmed result instead of "pending".
  • Adds the raw per-run sweep data as benchmarks/cuda_gb10_issue712_fused_moe_dff_2026-07-10.csv.

Test plan

  • cargo check --features cuda --lib --tests (pinned 1.93.1 toolchain) - clean, Finished dev profile with no errors or warnings.
  • cargo test --features cuda --lib switch_layers - 8 passed, 0 failed (unchanged since the constant was not modified).
  • Real GB10 hardware sweep: 24 mlxcel-bench-decode runs (4 models x 2 arms x 3 repeats), one process per run, rc=0 on every run.

Closes #712

Issue #330 / PR #711 left a pending re-validation note in docs/benchmark_results/fused-moe-decode-kernel-design.md because the GB10 sweep behind the CUDA FUSED_MOE_MAX_DFF_CUDA default (8192) was measured on MLX pin e9463bb, and the pin has since advanced to 0.32.1 (57c66cac, #703/#704).

Re-ran the same harness on GB10 (sm_121, CUDA 13.0) under the current 0.32.1 pin: mlxcel-bench-decode, prompt "Hello, how are you today?", 100 decode tokens after a 20-token warmup, median of 3 runs, MLXCEL_FUSED_MOE_MAX_DFF=1 (gather_qmm fallback) vs =20000 (fused) across lfm2-8b-a1b (Dff 1792), phi-3.5-moe (6400), llama-4-scout-17b (8192), mixtral-8x7b (14336).

The ratio=1.0 crossover interpolates to ~7672, close to the prior ~8000 given the run-to-run noise the 2026-07-03 sweep already flagged at the same Dff point. FUSED_MOE_MAX_DFF_CUDA in src/models/switch_layers.rs stays at 8192; this is a documentation-only change.

Adds a 2026-07-10 addendum with the new sweep table and conclusion, amends the 2026-07-09 addendum's pending note to point at it while keeping it as historical provenance, updates the env-var table row, and commits the raw per-run data as benchmarks/cuda_gb10_issue712_fused_moe_dff_2026-07-10.csv.

Refs #712
@inureyes inureyes added type:performance Performance improvements priority:low Low priority area:models Model architectures, weights, loading, metadata area:core mlxcel-core: MLX FFI, primitives, KV cache, layers status:review Under review labels Jul 9, 2026
…addendum

The 2026-07-10 re-validation addendum justified the ~4% crossover shift as within noise by citing a "21.33-21.85 run to run" fallback spread attributed to the 2026-07-03 sweep. That range is actually this sweep's own llama-4-scout fallback (21.85/21.64/21.33 in cuda_gb10_issue712_fused_moe_dff_2026-07-10.csv); the 2026-07-03 sweep's fallback at Dff 8192 was 21.23/21.23/21.28, and the noise it flagged was on the fused side (one of three fused runs matching the fallback). The clause also called the 2.4% spread "larger than the shift itself" while the shift is stated as ~4%, which is a contradiction.

Reattribute the 21.33-21.85 spread to the current sweep, keep the accurate statement that the 2026-07-03 sweep flagged this Dff point as noisy on the fused side, and change "larger than" to "comparable to" so the magnitude claim matches the ~4% shift. Conclusion is unchanged: 8192 stays confirmed. Data-only correction; no code touched.

Refs #712
@inureyes inureyes added status:done Completed and removed status:review Under review labels Jul 9, 2026
@inureyes
inureyes merged commit 576bf99 into main Jul 9, 2026
5 checks passed
@inureyes
inureyes deleted the perf/issue-712-cuda-fused-moe-dff-revalidation branch July 9, 2026 16:53
@inureyes inureyes self-assigned this Aug 31, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:core mlxcel-core: MLX FFI, primitives, KV cache, layers area:models Model architectures, weights, loading, metadata priority:low Low priority status:done Completed type:performance Performance improvements

Projects

None yet

Development

Successfully merging this pull request may close these issues.

perf(moe): re-validate the CUDA fused-MoE Dff cap sweep on MLX 0.32.1 (GB10)

1 participant