Skip to content

perf(models): gate nemotron_h Mamba2 per-mixer eval to M5 Max - #271

Merged
inureyes merged 1 commit into
mainfrom
perf/issue-267-nemotron-ssm-eval-m5-gate
Jun 13, 2026
Merged

inureyes merged 1 commit into
mainfrom
perf/issue-267-nemotron-ssm-eval-m5-gate

Conversation

@inureyes

Copy link
Copy Markdown
Member

Summary

Completes the M5-eval-gating sweep started in #266. nemotron_h's Mamba2 mixer ended its Rust forward with an unconditional mlxcel_core::eval(&result), the same M5 Max (Metal GPU Family 4) NaN-avoidance workaround #266 gated in falcon_h1 / granitemoehybrid / plamo2. It was the last ungated instance. Now gated on hardware::is_m5_neural_accelerator().

Scope (important nuance)

Unlike the other three hybrids, nemotron_h single-token decode does not run the Rust mixer body — it dispatches to a fully-fused C++ path (forward_fused → fused_mamba2_forward) with no per-layer eval. So this eval only ever ran on the prefill / fallback path. Validated on M1 Ultra (nemotron-h-30b-4bit, 24-token prompt): prefill 188 → 197 tok/s, decode unchanged (55.1 → 54.9, fused), greedy temp-0 output coherent and unchanged. M5 Max behaviour unchanged (gate returns true there; prefill keeps its separate needs_chunked_eval graph-bounding).

The real decode gap is MoE-bound → #268

nemotron-h-30b decodes at 55 vs mlx-lm 92 tok/s (0.60×). Block profiling (MLXCEL_PROFILE_BLOCKS=1) shows the 23 MoE layers are ~60% of decode, Mamba ~33% (already fused), attention ~7%. This is the same MoE decode path that makes dots.llm1 lag (0.51×), so the decode gap is tracked in #268, not here.

Closes #267.

Completes the M5-eval-gating sweep started in #266. nemotron_h's Mamba2 mixer ended its Rust `forward` with an unconditional `mlxcel_core::eval(&result)`, the same M5 Max (Metal GPU Family 4) NaN-avoidance workaround that #266 gated in falcon_h1 / granitemoehybrid / plamo2. It was the last ungated instance. Gate it on `hardware::is_m5_neural_accelerator()`.

Scope note (important): unlike the other three hybrids, nemotron_h's single-token decode does NOT run the Rust mixer body. It dispatches to a fully-fused C++ path (`forward_fused` -> `fused_mamba2_forward`) that has no per-layer eval, so this eval was only ever on the prefill / fallback path. Measured on M1 Ultra (nemotron-h-30b-4bit, 24-token prompt): prefill 188 -> 197 tok/s, decode unchanged (55.1 -> 54.9, fused). Greedy temp-0 output coherent and unchanged. M5 Max behaviour unchanged (gate returns true there; prefill also keeps its separate `needs_chunked_eval` materialization).

The real nemotron decode gap vs mlx-lm (55 vs 92 tok/s, 0.60x) is MoE-bound: block profiling shows the 23 MoE layers are ~60% of decode time, Mamba ~33% (fused), attention ~7%. That is the same MoE decode path that makes dots.llm1 lag, so it is tracked in #268, not here.

Closes #267.
@inureyes inureyes added type:performance Performance improvements area:models Model architectures, weights, loading, metadata priority:medium Medium priority status:review Under review status:done Completed and removed status:review Under review labels Jun 13, 2026
@inureyes
inureyes merged commit 0884dde into main Jun 13, 2026
4 checks passed
@inureyes
inureyes deleted the perf/issue-267-nemotron-ssm-eval-m5-gate branch June 13, 2026 16:10
@inureyes inureyes added this to the 0.3 milestone Jun 21, 2026
@inureyes inureyes self-assigned this Aug 31, 2026
be-free-snowboy pushed a commit to freestylejs/snowbrain-mlxcel that referenced this pull request Oct 27, 2026
…#271)

Completes the M5-eval-gating sweep started in lablup#266. nemotron_h's Mamba2 mixer ended its Rust `forward` with an unconditional `mlxcel_core::eval(&result)`, the same M5 Max (Metal GPU Family 4) NaN-avoidance workaround that lablup#266 gated in falcon_h1 / granitemoehybrid / plamo2. It was the last ungated instance. Gate it on `hardware::is_m5_neural_accelerator()`.

Scope note (important): unlike the other three hybrids, nemotron_h's single-token decode does NOT run the Rust mixer body. It dispatches to a fully-fused C++ path (`forward_fused` -> `fused_mamba2_forward`) that has no per-layer eval, so this eval was only ever on the prefill / fallback path. Measured on M1 Ultra (nemotron-h-30b-4bit, 24-token prompt): prefill 188 -> 197 tok/s, decode unchanged (55.1 -> 54.9, fused). Greedy temp-0 output coherent and unchanged. M5 Max behaviour unchanged (gate returns true there; prefill also keeps its separate `needs_chunked_eval` materialization).

The real nemotron decode gap vs mlx-lm (55 vs 92 tok/s, 0.60x) is MoE-bound: block profiling shows the 23 MoE layers are ~60% of decode time, Mamba ~33% (fused), attention ~7%. That is the same MoE decode path that makes dots.llm1 lag, so it is tracked in lablup#268, not here.

Closes lablup#267.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:models Model architectures, weights, loading, metadata priority:medium Medium priority status:done Completed type:performance Performance improvements

Projects

None yet

Development

Successfully merging this pull request may close these issues.

perf(models): gate nemotron_h Mamba2 per-mixer eval to M5 Max (follow-up to #266)

1 participant