Repository navigation
Conversation
…ain::hybrid, chain::arch::nemotron_h); the gpu body implements HybridOps (nemotron_h::Program) and its step is the walk The hybrid trunk (Mamba-2 and NoPE attention) gets the shape qwen3moe has: HybridOps is the op list a backend implements, LayerPlan the per-layer plan read from the file's header, Walk the one order (embed, each layer's in/core/out, head) over runtime::sched. Nemotron-H's MLP layer is the family's Ffn. crates/gpu's mamba_layer and gqa_layer split into in/core/out parts; the wrappers keep their signatures, so nemotron_h_moe is unchanged. The body resolves its layers from the plans (Names::mamba_of, attn_of). NoLeg and the test header builder move to chain::noleg and chain::test_file, shared with qwen3moe. A move: the same launches in the same order. Redo of #848 on today's main (the imatrix, NVFP4 and out-gate sites of hybrid.rs carried over). 13 chain tests, each with its mutant under .mutants/nemolift-*.patch. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01CjHkkjGpdUeLi6Z7fiwRXH
There was a problem hiding this comment.
Verdict: MUST_FIX: the move is equivalent and its proof holds, but the diff ships one dead public type and the same test fixtures three times.
The move was checked against the old enqueue: sched::walk calls front per layer and end once, so embed → layers → head and the in_head flip per *_out are unchanged; the in/core/out splits keep the enqueue order; the layers are built from the plans, so kinds cannot disagree.
Must fix
1. Counts is dead production code
crates/chain/src/hybrid/plan.rs:62 pub struct Counts and Counts::of (:71) have no production caller in any crate; the only caller is a test, crates/chain/src/arch/nemotron_h/read.rs:217, whose assertion is implied by the kind-sequence assertion above it ("mpampa" ⇒ 2/2/2). .mutants/nemolift-read-counts.patch exists to guard it, pub with no production caller (R13). Cost: deleting now is three edits; later it is an API removal.
Fix: delete the Counts struct and its impl block in plan.rs, the Counts import and the assert_eq!(Counts::of(&got), …) block in the nemotron_h read test, and .mutants/nemolift-read-counts.patch; the remaining assert_eq!(got.iter().map(kind).collect::<String>(), "mpampa") pins the same fact per layer, strictly stronger.
2. The same test fixtures three times in one diff
crates/chain/src/hybrid/read.rs:168 fn mamba(), nemotron_h/read.rs:115 fn mamba() and the Mamba2 literal inside walk.rs:188 hold the same seven widths; hybrid/read.rs:279 fn gqa() and nemotron_h/read.rs:130 fn attn() hold the same Gqa literal. R14: a second copy gets a common core; a third is forbidden. The diff already adds the owner, chain::test_file. Cost: a width a test varies becomes three edits that must agree. Fix: in crates/chain/src/test_file.rs, beside decl/header (add use model::arch::models::{Gqa, Mamba2, OutGate, Rope, RopeMode};):
pub(crate) fn mamba2() -> Mamba2 {
Mamba2 {
d_inner: 512,
d_state: 128,
n_heads: 8,
head_dim: 64,
n_groups: 2,
d_conv: 4,
d_in_proj: 1544,
}
}
/// The NoPE attention the kernels take: 10 query heads over 2 key heads.
pub(crate) fn gqa() -> Gqa {
Gqa {
heads: 10,
kv_heads: 2,
head_dim: 128,
value_dim: 128,
rope: Rope { mode: RopeMode::None, dims: 0, base: 0.0, yarn: None, factors: false },
qk_norm: false,
o_norm: false,
out_gate: OutGate::None,
select: None,
window: None,
sinks: false,
value_scale: None,
}
}Each module then wraps: hybrid's mamba()/gqa() call these, nemotron_h's are layer(Mixer::Mamba2(mamba2()), none()) and layer(Mixer::Gqa(gqa()), none()), walk.rs's plan takes shape: mamba2(). About 90 lines of literals removed for ~35 added.
Non-blocking
⚠ R13 pub ahead of a caller: no_block, mamba_plan, nope_gqa_plan (crates/chain/src/hybrid/read.rs:24, :31, :118) are called only inside crates/chain, and at/layer (crates/chain/src/hybrid/walk.rs:20, :93) only inside their own module. pub(crate) (private for at/layer) until a second backend calls them.
⚠ The header is read twice at load: crates/gpu/src/arch/nemotron_h/body.rs:63 reads Hparams, then spec::read at :95 re-reads it inside and also runs roles::classify, whose tensors the body drops. Load-time only; a spec entry point taking &Hparams would read once — classify's side effect, a new named refusal of files whose tensors disagree with the arrays, is in the safe direction.
Checked
Duplicates: 12 new items checked (types, readers, NoLeg, test_file); hits are findings 1 and 2; mamba_layer/gqa_layer and Names::mamba/attn keep real callers in nemotron_h_moe (placed.rs:565, body.rs:316), so the PR's "not yet" note is accurate.
Complexity: crapper did not run; by hand the splits shrink gqa_layer and mamba_layer, and layer_plans is an even four-arm match.
Silent failure: 7 sites followed (conv_b Option, empty plans, m outside 1..=rows, wrong-kind ops, no_block, nope_fits, d_in_proj); each ends in a named error, and the new d_in_proj/classify checks refuse at load where the old path ran mixed geometry silently.
Tests: 13 new tests each with a .mutants/ patch; 5 mutants read each turn an assertion red; the A6000 e2e structure line and bit-identical eager/replay are in the body.
Gates: none moved or relaxed; ptx-scan identical on the four kernel carriers per the body.
Escape catalog: no shell in the diff; C1–C4 not matched.
Notes
dryer and crapper both failed to run (ModuleNotFoundError); duplication and complexity were read by hand. The body's card evidence names the card and base hash but lacks the nvidia-smi line, head hash and model file of CONTRIBUTING's evidence list.
Card check: needs-gpu. This pull request changes crates/gpu/src/arch/hybrid.rs, crates/gpu/src/arch/nemotron_h/body.rs, crates/gpu/src/arch/nemotron_h/mod.rs … and carries no gate run on a card (CONTRIBUTING's evidence list); a maintainer adds gpu-verified after one.
🔨 Shingler, bloomery's review bot: approves a clean pull request and requests changes on a must-fix (how it works)
|
|
||
| /// Whether `ffn` is the description's "no feed-forward block" of a Mamba-2 or attention layer. | ||
| #[must_use] | ||
| pub fn no_block(ffn: &Ffn) -> bool { |
There was a problem hiding this comment.
R13: no caller outside crates/chain — pub(crate) until a backend crate calls it.
| pub fn no_block(ffn: &Ffn) -> bool { | |
| pub(crate) fn no_block(ffn: &Ffn) -> bool { |
| /// Layer `l`'s Mamba-2 plan over a `hidden`-value row: the description's widths checked against | ||
| /// the scan's (state 128, a conv of four taps, widths that divide, an input projection of the | ||
| /// widths' columns), and the two projections' types from `file`'s header at one of `allowed`. | ||
| pub fn mamba_plan( |
There was a problem hiding this comment.
R13: called only by the nemotron_h family reader in this crate — pub(crate).
| pub fn mamba_plan( | |
| pub(crate) fn mamba_plan( |
|
|
||
| /// Layer `l`'s attention plan over a `hidden`-value row, its four sites' types from `file`'s | ||
| /// header at one of `allowed`. | ||
| pub fn nope_gqa_plan( |
There was a problem hiding this comment.
R13: called only by the nemotron_h family reader in this crate — pub(crate).
| pub fn nope_gqa_plan( | |
| pub(crate) fn nope_gqa_plan( |
Nemotron-H의 디코드 순서, 레이어 계획, 리더를
crates/chain으로 옮깁니다(#848을 오늘 main에서 다시 함). 코드만 옮겼고 커널과 launch는 그대로입니다.What and why
The Nemotron-H decode walk, its layer plans and its GGUF reader move out of
crates/gpuintocrates/chain, thebackend-neutral owner that the qwen3moe walk already uses (and that the Metal backend shares).
chain::hybridholdsthe trunk a Mamba-2 + attention model shares:
HybridOps(the op list a backend implements),LayerPlan, theheader reader and
Walk(embed, each layer's in/core/out, head, overruntime::sched).chain::arch::nemotron_hholds only its MLP layer. In
crates/gpu,mamba_layerandgqa_layersplit into in/core/out parts with theirwrappers unchanged (nemotron_h_moe still calls them), and
nemotron_h::ProgramimplementsHybridOps.NoLegand the test header builder move tochain::noleg/chain::test_file, shared with qwen3moe.Supersedes #848 (1168 commits behind, not rebasable); this redoes it on today's main and carries the imatrix,
NVFP4 and out-gate sites
hybrid.rsgained since.Release notes: internal — a second backend can run the Nemotron-H walk; no behaviour change.
Code shape
chain::hybrid::walk).Names::mamba/attn(crates/gpu/src/arch/hybrid.rs) stay fornemotron_h_moe beside the plan-driven
Names::mamba_of/attn_of. They become one when the MoE family movesto the same walk (the next round).
tools/check-comments.shrc 0.cargo fmtandcargo clippyare clean; lint^warning: 0 = the ratchet 0.Duplication found or removed: the two name resolvers above (
crates/gpu/src/arch/hybrid.rsNames::mamba/Names::mamba_of), kept until nemotron_h_moe moves.What I ran
Move proof,
just narrow bde0145efon the box (--no-jitboth sides), every kernel carrier of the change:The new
mod.rsfiles have no gate-paths row, so the list stayed full. Fixture union batch (box, both cards):gate-gpu-nemotron-e2e(real tier, A6000), this branch and main bde0145 give the same structure line and the samelogits deltas on all four prompts:
Mac:
cargo test -p bloomery-chain78 passed (13 new, each with its mutant under.mutants/nemolift-*.patch).Not run: the 38 real-tier gates the fixture batch deferred (they run in the release batch and weekly).
The implementation was written by a GLM-5.3 round and reviewed and gated by Claude Code.
🤖 Generated with Claude Code
https://claude.ai/code/session_01CjHkkjGpdUeLi6Z7fiwRXH