Repository navigation
docs(benchmarks): record GB10/CUDA fused QK-norm decode result (#326) - #357
Merged
Merged
Conversation
Answer the open per-backend question left when the fused QKV+QK-norm+RoPE decode primitive (#326, #341) merged default-OFF: whether CUDA, with its different op-dispatch cost, is the per-backend win that would justify enabling it. On GB10 (SM 12.1) it is not. The fused path is slower on every wired model (qwen3-0.6b 0.96x, qwen3-8b ~1.0x, qwen3-30b-a3b 0.92x fused/graph), worst on the 48-layer MoE where the per-layer norm/transpose reorder accumulates. The primitive assembles the same MLX ops as the graph path in one C++ call, so the GPU work is identical; it only cuts FFI crossings (about 14 to 1) and norms after the head transpose. Decode is GPU/bandwidth-bound, so collapsing FFI calls buys nothing and the reorder costs a little. Same direction as M1 Ultra (1-3.4% slower) and consistent with M5 Max preferring the split decode path. Correctness holds: RMS < 5e-3 (unit test); greedy temp-0 diverges only at a near-tie argmax over long generation, and the graph path is itself non-deterministic run-to-run on CUDA while the fused path is deterministic, so the divergence stays inside the graph baseline's own envelope. Corrects the stale "byte-identical" claim and the "pending a per-backend win (e.g. CUDA)" note in the fused_qk_norm_enabled doc comment. Add docs/benchmark_results/fused-qk-norm-decode-gb10.md with the full method, on/off table, and determinism analysis. No code behavior change; the flag stays default-OFF.
5 tasks done
inureyes
added a commit
that referenced
this pull request
Jun 19, 2026
… (#372) A default `cargo build --release` on Linux omits the `cuda` feature and produces a CPU-only binary that still runs but executes MLX on the host CPU at single-digit tok/s, with only `Runtime device: CPU` as a hint. This bit a GB10 benchmarking session for #326. At startup, when the user wanted the GPU but a CPU-only binary fell back to CPU on a host that has an NVIDIA GPU (detected via `/dev/nvidiactl` or `/proc/driver/nvidia/version`, which need no CUDA linkage), print a one-line warning pointing at the `--features cuda` rebuild or the new `cargo cuda` alias. An explicit `MLXCEL_DEVICE=cpu` suppresses it, and a cuda-capable build that fell back to CPU is a genuine no-GPU host, not the footgun. The decision is a pure function with a unit test. Also adds the `cargo cuda` alias in `.cargo/config.toml` and documents the footgun in the README build section and installation.md. No behavior change on a correctly built GPU binary. Follow-up to #326 and #357.
3 tasks done
inureyes
added a commit
that referenced
this pull request
Jun 25, 2026
CUDA (GB10/SM 12.1) was the last open backend question after the M1 Ultra regression (#326, #341). The GB10 benchmark (#357) found the fused path is also slower there (qwen3-0.6b 0.96x, qwen3-8b ~1.0x, qwen3-30b-a3b 0.92x fused/graph), so there is no per-backend win on any measured backend (M1 Ultra, M5 Max, GB10/CUDA). The default stays off on all backends; no code changes. Two stale claims in the MLXCEL_FUSED_QK_NORM table row in docs/environment-variables.md are corrected: 1. The byte-identical overclaim is replaced with the canonical precision from the layers.rs doc comment: the fused path matches within RMS < 5e-3, but greedy temp-0 is not byte-identical over long generation. The determinism note is added: on CUDA the graph path is non-deterministic run-to-run from GPU FP-reduction order, while the fused path is deterministic, so its divergence from the graph stays inside the graph baseline's own envelope. 2. The CUDA-pending rationale is replaced with the settled verdict: GB10/CUDA was measured and is also slower, so the flag stays opt-in on every measured backend. CHANGELOG.md gets a Docs entry under [Unreleased] recording the decision finalization.
be-free-snowboy
pushed a commit
to freestylejs/snowbrain-mlxcel
that referenced
this pull request
Oct 27, 2026
…p#326) (lablup#357) Answer the open per-backend question left when the fused QKV+QK-norm+RoPE decode primitive (lablup#326, lablup#341) merged default-OFF: whether CUDA, with its different op-dispatch cost, is the per-backend win that would justify enabling it. On GB10 (SM 12.1) it is not. The fused path is slower on every wired model (qwen3-0.6b 0.96x, qwen3-8b ~1.0x, qwen3-30b-a3b 0.92x fused/graph), worst on the 48-layer MoE where the per-layer norm/transpose reorder accumulates. The primitive assembles the same MLX ops as the graph path in one C++ call, so the GPU work is identical; it only cuts FFI crossings (about 14 to 1) and norms after the head transpose. Decode is GPU/bandwidth-bound, so collapsing FFI calls buys nothing and the reorder costs a little. Same direction as M1 Ultra (1-3.4% slower) and consistent with M5 Max preferring the split decode path. Correctness holds: RMS < 5e-3 (unit test); greedy temp-0 diverges only at a near-tie argmax over long generation, and the graph path is itself non-deterministic run-to-run on CUDA while the fused path is deterministic, so the divergence stays inside the graph baseline's own envelope. Corrects the stale "byte-identical" claim and the "pending a per-backend win (e.g. CUDA)" note in the fused_qk_norm_enabled doc comment. Add docs/benchmark_results/fused-qk-norm-decode-gb10.md with the full method, on/off table, and determinism analysis. No code behavior change; the flag stays default-OFF.
be-free-snowboy
pushed a commit
to freestylejs/snowbrain-mlxcel
that referenced
this pull request
Oct 27, 2026
…lup#326) (lablup#372) A default `cargo build --release` on Linux omits the `cuda` feature and produces a CPU-only binary that still runs but executes MLX on the host CPU at single-digit tok/s, with only `Runtime device: CPU` as a hint. This bit a GB10 benchmarking session for lablup#326. At startup, when the user wanted the GPU but a CPU-only binary fell back to CPU on a host that has an NVIDIA GPU (detected via `/dev/nvidiactl` or `/proc/driver/nvidia/version`, which need no CUDA linkage), print a one-line warning pointing at the `--features cuda` rebuild or the new `cargo cuda` alias. An explicit `MLXCEL_DEVICE=cpu` suppresses it, and a cuda-capable build that fell back to CPU is a genuine no-GPU host, not the footgun. The decision is a pure function with a unit test. Also adds the `cargo cuda` alias in `.cargo/config.toml` and documents the footgun in the README build section and installation.md. No behavior change on a correctly built GPU binary. Follow-up to lablup#326 and lablup#357.
be-free-snowboy
pushed a commit
to freestylejs/snowbrain-mlxcel
that referenced
this pull request
Oct 27, 2026
…lablup#444) CUDA (GB10/SM 12.1) was the last open backend question after the M1 Ultra regression (lablup#326, lablup#341). The GB10 benchmark (lablup#357) found the fused path is also slower there (qwen3-0.6b 0.96x, qwen3-8b ~1.0x, qwen3-30b-a3b 0.92x fused/graph), so there is no per-backend win on any measured backend (M1 Ultra, M5 Max, GB10/CUDA). The default stays off on all backends; no code changes. Two stale claims in the MLXCEL_FUSED_QK_NORM table row in docs/environment-variables.md are corrected: 1. The byte-identical overclaim is replaced with the canonical precision from the layers.rs doc comment: the fused path matches within RMS < 5e-3, but greedy temp-0 is not byte-identical over long generation. The determinism note is added: on CUDA the graph path is non-deterministic run-to-run from GPU FP-reduction order, while the fused path is deterministic, so its divergence from the graph stays inside the graph baseline's own envelope. 2. The CUDA-pending rationale is replaced with the settled verdict: GB10/CUDA was measured and is also slower, so the flag stays opt-in on every measured backend. CHANGELOG.md gets a Docs entry under [Unreleased] recording the decision finalization.
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
Completes the deferred validation for #326 (generic fused QKV+RMSNorm+RoPE, merged in #341) by running the decode benchmark on the one backend it was never measured on: GB10 / CUDA.
The fused QK-norm decode primitive ships default-OFF. Its doc comment said it was gated off "pending a per-backend win (e.g. CUDA, where op-dispatch/FFI cost differs)". This PR answers that open question.
Result: CUDA is not a per-backend win
Same binary,
MLXCEL_FUSED_QK_NORM=1(fused) vs=0(graph/split), best-of-3, GB10 SM 12.1,--no-chat-template+ 256 tokens so decode rate resolves the small per-op effect.Slower on every wired model, worst on the 48-layer MoE. The primitive assembles the same MLX ops as the graph path in one C++ call, so the GPU work is identical; it only cuts FFI crossings and norms after the head transpose. Decode is GPU/bandwidth-bound, so that buys nothing and the reorder costs a little. Same direction as M1 Ultra (1-3.4% slower) and consistent with M5 Max preferring the split path.
The two control models (apertus is QK-norm but not wired; llama has no QK-norm) show the flag is inert: the regression-guard check that common attention is untouched.
Correctness / determinism
fused_qkv_split_norm_rope_standard_rmsnorm_matches_graphunit test.Changes
docs/benchmark_results/fused-qk-norm-decode-gb10.md(method, table, determinism analysis).fused_qk_norm_enableddoc comment: drop the stale "byte-identical" claim and the "pending a per-backend win (e.g. CUDA)" note, record the CUDA numbers.No code behavior change. The flag stays default-OFF; the graph/split path remains the decode default on every measured backend (M1 Ultra, M5 Max, GB10/CUDA).