Skip to content

nemotron_h_moe: Bolt loads placed (card experts and a host leg) when the whole model does not fit the card - #499

Closed
midagedev wants to merge 5 commits into
mainfrom
b3c
Closed

midagedev wants to merge 5 commits into
mainfrom
b3c

Conversation

@midagedev

Copy link
Copy Markdown
Owner

Nemotron-H MoE (Bolt) loads placed when the whole model does not fit the card: card experts plus a host leg. bloomery-serve -m <Bolt gguf> picks placed by itself. No flag is needed.

  • crates/gpu/src/arch/nemotron_h_moe/placed.rs: the placed body. It has the front, shadow and back, plus the host sum.
  • crates/gpu/src/host/run.rs: the common HostRun holds a sparse set of host layers, with one scratch for each feed-forward width (Bolt's layers differ in ff).
  • crates/gpu/src/watchdog.rs: a token's pass inside a guarded call now moves progress. Before this, a prompt run as steps was read as wedged.
  • serve_seats/nemotron.rs picks placed when whole-card does not fit. Place::machine_placed is in generate.rs.

Evidence before the rebase (3090 at BLOOMERY_CARD_BUDGET=12G as a stand-in for a 12 GiB card):

  • The plan is card_experts 2985 and host_experts 10839, with an 8.9 s load. Greedy output md5 equals the whole-card output (short and long prompts).
  • The gate's host arm keeps argmax with cosine ≥ 0.99985. The card arm is bit-equal.
  • gate-gpu-nemotron-h-moe-e2e and gate-gpu-nemotron-h-moe-serve rc 0.
  • FAIL-first for 4 mutants: host share dropped, host share doubled, one scratch for every layer, and pass_done disabled. Each one is red.
  • Speed (12G, 3090): tg 74 tok/s. A 4010-token prompt runs as steps in 58.7 s (whole-card 2.0 s). The prompt batch port is the next round.

The owning-gate batch after the rebase follows as a comment.

🤖 Generated with Claude Code

midagedev and others added 5 commits October 20, 2026 00:11
HostRun keeps one Option<HostLayer> per model layer, built by build_at from
the strictly ascending set of layers that carry a host share, so a body that
interleaves MoE layers with others (Nemotron 3.5 Bolt) can place routed
experts on the host. A layer with no host share is refused by name at its one
lookup (view_of); a set out of order or a view count that differs is refused
at load. model::host_run takes the set; V4.1, GLM-5.3 and placed Qwen3.8 pass
the contiguous run they had, so for them this is a move: canon-check 922/922
identical against bc4bf07, and the owning gates green (fixture tier, plus
gate-gpu-hybrid, qwen3moe-e2e and mimo2-flash on the real tier).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…rompt run as steps is not read as wedged

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…the whole model does not fit the card

The seat picks the placed load by itself, so a 12 GiB card serves Bolt with no flag.
gate_nemotron_h_moe_e2e gains host_tier_near_whole_card (card, mid, host and room12g arms).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…s names.w without a reborrow (clippy)

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@midagedev midagedev added gpu The card engine: crates/gpu*, crates/app host Host crates: qdot, threads, engram, engram-lab, runtime, sampler, levers, decision, vision, refset needs-gpu Changes code a card must check, and carries no gate run on a card labels Oct 19, 2026
@github-actions github-actions Bot added the model The CPU engine and model files: crates/model, models, hf, gguf, tokenizer, jinja label Oct 19, 2026
@midagedev
midagedev enabled auto-merge (rebase) October 19, 2026 15:36
@midagedev

Copy link
Copy Markdown
Owner Author

Owning gates after the rebase (fixture tier, box, 3090 + A6000):
DONE total=6 red=0 tier=fixture wall=716s deferred=8 no_fixture=1 real_file=2
gate-gpu-lib, gate-gpu-nemotron-h-moe-e2e (5 clauses left to the real tier), gate-gpu-nemotron-h-moe-serve rc 0. gate-gpu-hybrid, gate-gpu-qwen3moe-e2e (real-file) and gate-gpu-mimo2-flash (no fixture) are deferred to the real tier.

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verdict: MUST_FIX: the new gate can succeed after a device fault; duplicated scratch accounting and redundant API elements also need correction.

Must fix

1. Fail the gate when its reference walk faults

crates/gpu-gates/src/bin/gate_nemotron_h_moe_e2e.rs:1159 When earlier clauses pass and this reference walk raises a device fault, fresh reports it and returns None. Returning Ok(None) makes run skip the host-tier clause without clearing ok (lines 1400–1416), so the gate prints PASSED and exits successfully.
Fix this before using the clause as placement evidence. Replace the return with:

return Err(checks_failed());

2. Give scratch byte accounting one owner

crates/gpu/src/arch/nemotron_h_moe/body.rs:362 duplicates the router and six buffer terms in crates/gpu/src/arch/nemotron_h_moe/body.rs:548 (R14). These totals drive both the load's budget check and resident-byte reporting.
Sharing the existing owner now prevents later buffer additions from updating only one total. Replace:

fn resident_bytes(&self) -> usize {
    let stores: usize = self.layers.iter().map(|l| match l {
        Layer::Mamba(m) => m.store.bytes(),
        Layer::Attn(a) => a.bytes(),
        Layer::Moe(_) => 0,
    }).sum();
    stores
        + self.prompt.as_ref().map_or(0, Prompt::bytes)
        + self.scratch_bytes()
}

3. Remove redundant API elements

crates/gpu/src/arch/nemotron_h_moe/placed.rs:202 repeats the required crates/gpu/src/arch/nemotron_h_moe/placed.rs:234; the adjacent hosted_layers has no caller. crates/gpu-gates/src/bin/shared/serve_seats/nemotron.rs:195 only forwards step. crates/gpu-gates/src/generate.rs:683 accepts scratch bytes, but its sole caller passes zero.
Remove these elements before callers acquire unnecessary API contracts. Delete the two inherent accessors and prefill_bolt_placed; pass NemotronHMoeModel::step at that wrapper's caller. Remove the scratch argument from the method's documentation and change its caller to place.machine_placed()?(layers). Replace the method with:

pub fn machine_placed(self) -> Result<impl Fn(usize) -> Machine + Copy, GateError> {
    self.serves("placed load", 0)?;
    let stage = self.card_specs()?[0];
    Ok(move |layers| workstation::placed_on(stage, layers, workstation::SCRATCH))
}

Non-blocking

⚠ Supply the card proof: crates/gpu/src/arch/nemotron_h_moe/placed.rs:394 adds one latent-vector add launch per mixed layer per token and regroups the float sum. The float-sum-order class requires owning-gate output and a timed A/B. Attach the post-rebase run with the card/driver line, both hashes, model path, commands and output; the body supplies summaries only.

⚠ Cover the watchdog call site: crates/gpu/src/model.rs:1137 can be deleted while the new watchdog test remains green, because that test calls the helper directly. Add a recurrence check that exercises the prompt-as-steps path; this catches loss of the integration that prevents long prompts from being killed.

Checked

Duplicates: confirmed the repeated scratch terms and redundant accessors, wrapper and parameter above.
Complexity: the new host-tier clause combines planning, execution and comparison; load and serve add placement branches.
Silent failure: followed the reference fault through fresh, whole_card_run, run and the exit-code helper.
Tests: by inspection, the watchdog test asserts the helper's progress updates but cannot detect deletion of model.rs:1137. The PR body reports host-sum mutants as red.
Gates: no existing pins or clauses relaxed.
Escape catalog: no C1–C4 matches.

Notes

GPU gates were not executed during validation. The PR body supplies summaries rather than the required card-run output.

Card check: needs-gpu. This pull request changes crates/gpu-deepseek41/src/body.rs, crates/gpu-gates/src/bin/gate_nemotron_h_moe_e2e.rs, crates/gpu-gates/src/bin/shared/serve_seats/nemotron.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)

&case.walk,
)?
else {
return Ok(None);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A reference-walk fault must fail the gate instead of skipping the host-tier clause.

Suggested change
return Ok(None);
return Err(checks_failed());

@midagedev

Copy link
Copy Markdown
Owner Author

Superseded by #525, one train with the review fixes applied.

@midagedev midagedev closed this Oct 20, 2026
auto-merge was automatically disabled October 20, 2026 02:22

Pull request was closed

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

Labels

gpu The card engine: crates/gpu*, crates/app host Host crates: qdot, threads, engram, engram-lab, runtime, sampler, levers, decision, vision, refset model The CPU engine and model files: crates/model, models, hf, gguf, tokenizer, jinja needs-gpu Changes code a card must check, and carries no gate run on a card

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant