Repository navigation
perf(models): gate nemotron_h Mamba2 per-mixer eval to M5 Max - #271
Merged
Merged
Conversation
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.
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.
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 M5-eval-gating sweep started in #266.
nemotron_h's Mamba2 mixer ended its Rustforwardwith an unconditionalmlxcel_core::eval(&result), the same M5 Max (Metal GPU Family 4) NaN-avoidance workaround #266 gated infalcon_h1/granitemoehybrid/plamo2. It was the last ungated instance. Now gated onhardware::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 separateneeds_chunked_evalgraph-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 makesdots.llm1lag (0.51×), so the decode gap is tracked in #268, not here.Closes #267.