Repository navigation
perf(cuda): re-measure the fused-MoE Dff bound on GB10 with a null arm - #2962
Merged
inureyes merged 3 commits intoNov 15, 2026
Merged
Conversation
Re-measure FUSED_MOE_MAX_DFF_CUDA on a DGX Spark GB10 at 28d884a (MLX pin 9f806b36) with interleaved fused / gather / null arms, one process per run: 384 measured runs over five checkpoints, the lablup#712 bench-decode command, two full-window passes and a generate prompt-length by decode-length grid. The bound stays at 8192 under the issue's decision rule. The record also shows that the llama-4-scout row earlier sweeps read as break-even at 8192 never ran the fused kernel (Llama 4 has its own gather_qmm SwitchGLU), that the fused path wins at Dff 768, ties at 1792 and 6400 and loses about 2% at 14336, and that the earlier lfm2 advantage does not reproduce. Adds the record, its rows, the driver and report scripts and the prompt fixture; replaces the stale pending-re-validation provenance comment and the environment-variable row; links the record from the two archived sections it corrects. The constant and its unit tests are unchanged. Closes lablup#2540
Both carry a shebang, and tests/test_script_executable_modes.py requires an executable Git mode for a Python entry point.
The Dff benchmark recorded failed measurements but returned success after the measured loop, allowing automation to accept an incomplete sweep. Preserve every attempt and finish the remaining arms, then return a failure status if any measured arm exhausted retries. Validated normal runs, process failures and repeated JIT-discarded runs with a focused unittest; regenerated the committed CSV summary successfully. Refs lablup#2962, lablup#2540
Member
|
Implementation hardening for PR #2962. Reviewed #2540 and the committed 450-row measurement record. Regenerated its tables from runs.csv; the runtime bound remains 8192 and the Llama 4 non-fused control is explicitly identified. Found and fixed a reliability gap: exhausted measured-run retries previously returned success. Commit 3521e75 preserves every attempt and returns failure after any exhausted arm. The regression test covers successful, failed and repeated-JIT measurements. New GPU throughput measurements were not performed. Security review found no new credential, injection or untrusted execution path. Performance review found no hot-path behavior change. Hosted checks must pass on the updated head before merge. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Re-measures the CUDA fused decode-MoE bound (
FUSED_MOE_MAX_DFF_CUDA = 8192) on a DGX Spark GB10 at28d884a5(MLX pin9f806b36) with interleaved fused / gather / null arms, as #2540 asks. The bound stays at 8192; the constant and its unit tests are unchanged. The record also corrects what the earlier sweeps rested on.Related issues
Closes #2540
Type of change
feat— new user-visible featurefix— bug fixperf— performance improvement (include before/after numbers in the PR body)refactor— internal restructuring without behavior changechore— build, CI, dependencies, release infrastructuredocs— documentation onlytest— tests onlyNo runtime behavior changes: this is a measurement, its record, and the comments and docs that cite it.
Findings
Full record:
docs/benchmark_results/fused-moe-dff-crossover-gb10-2026-11-11.md. 384 measured runs, one process each, no discarded or failed run.SwitchGLUinsrc/models/llama4.rsthat callsgather_qmmand does not readMLXCEL_FUSED_MOEorMLXCEL_FUSED_MOE_MAX_DFF. On an empty kernel cache both llama-4-scout arms compiled the same seven modules and nomoe_gateup_kernel/moe_down_kernel; the lfm2 control compiled six such files in the fused arm and none in the gather arm.llama4.rsis byte-identical at the commits of the perf(cuda/moe): backend-specific default for the fused decode-MoE Dff threshold #626 sweep and the perf(moe): re-validate the CUDA fused-MoE Dff cap sweep on MLX 0.32.1 (GB10) #712 re-validation, so "break-even at 8192" there compared a path with itself. The issue adds llama-4-scout to get a point at 8192; that point cannot come from this checkpoint.bench-decodepasses and all fourgeneratecells. In thegeneratecell that matches the 2026-10-22 record, three of four arms reproduce within 2% and the lfm2gather_qmmarm moved from 102.25 to 109.02 tok/s.generategives +23.5% to +29.9% across a 439-word / short prompt by 256 / 100 token grid, andbench-decodegives +28% to +35%. The outlier is the perf(cuda/moe): backend-specific default for the fused decode-MoE Dff threshold #626 figure (+0.4% on MLX pine9463bb).What changed
docs/benchmark_results/fused-moe-dff-crossover-gb10-2026-11-11.mdand its rows underdocs/benchmark_results/data/fused-moe-dff-crossover-gb10-2026-11-11/runs.csv(450 rows, warm-ups included and flagged).scripts/bench_fused_moe_dff.py(driver: rotating arms, quiet-host wait, JIT-notice discard) andscripts/bench_fused_moe_dff_report.py(the record's tables), plus the fixed 439-word prompt undertests/fixtures/bench/.src/models/switch_layers.rs: the provenance comment onFUSED_MOE_MAX_DFF_CUDAno longer says a re-validation is pending and states what 8192 does and does not rest on.docs/environment-variables.md: theMLXCEL_FUSED_MOE_MAX_DFFrow cites the new record.docs/benchmark_results/README.md,versions/v0.3.0.md,versions/v0.8.0.md: index entry and "Related evidence / subsequent correction" lines.Scope note: #2540 lists an addendum to
fused-moe-decode-kernel-design.mdand a corrected bullet infused-moe-jit-cache-gb10-2026-10-22.md. Both files were consolidated into the release archives by #2949, and the last committed version of the 2026-10-22 record already carries the corrected wording, so this PR links the new record from the two archived sections instead.Test plan
Run on a DGX Spark GB10 (sm_121, driver 580.178.04, CUDA 13.0), release profile.
cargo fmt --all -- --checkcargo clippy --workspace --all-targets --features metal,accelerate -- -D warnings(not run; Linux host, and the only Rust change is a doc comment)cargo test --workspace --profile test-fast --features metal,accelerate --no-fail-fast -- --test-threads=1(not run; see the issue's command below)cargo deny check(not run; no dependency change)mlx-community/Qwen3-30B-A3B-4bit,LFM2-8B-A1B-4bit,Phi-3.5-MoE-instruct-4bit,Llama-4-Scout-17B-16E-Instruct-4bit,Mixtral-8x7B-Instruct-v0.1-4bit, at the revisions listed in the record.The issue's verification commands:
cargo build --release --features cuda --bin mlxcel-bench-decode --bin mlxcel cargo test --release --features cuda --lib switch_layers -- --test-threads=1 cargo fmt --all -- --checkAll three pass on the GB10 host.
switch_layers: 58 passed, 0 failed, 1 ignored, includingfused_moe_max_dff_default_is_backend_aware_and_env_overridesandfused_moe_dff_above_cap_declines_and_at_cap_dispatches.Repository gates run locally: env-var docs, benchmark raw logs, benchmark CSV schema, binary assets, cross-repo refs, license headers.
The branch was rebased onto
6289fbe6before opening. The three commits since28d884a5touch only XLA code and another row of the env-var table, and the MLX pin is unchanged. The measurement,cargo fmtand the unit tests above ran on the tree at28d884a5; the repository gates were re-run after the rebase.Notes for reviewers
spark-d9e2, notspark-101, and the checkpoints were downloaded from the publicmlx-communityrepositories because/home/inureyes/modelsis not available to me. Only ratios are compared with earlier records, never absolute tok/s.gpu-lock. This host has no upstreamgpu-lock; a user-localflock(1)shim with the same CLI shape serialized every run. It is not a CI runner and nothing else used the GPU; the driver's quiet-host wait never triggered.gather_qmmarm since 2026-10-22; Metal, ROCm, gemma4, qwen3_next and batched decode.SwitchGLU, which would make its 8192 row meaningful.runs.csv.Checklist
feat:,fix:, etc.)docs/if user-facing behavior or supported models changed// Used by: ...comments on any shared function I modified (seedocs/code-guidelines.md) (no function modified).envfiles committed