Skip to content

host::xstream, placement::workstation, seats: a load that streams reserves its lane's pinned staging on the host before its plan, the lane pins at most a half of slots, and the tiered open plans on the run's machine - #1089

Merged
juliankang4 merged 9 commits into
midagedev:mainfrom
juliankang4:dgx-spark-q38-offload-nvme-floor
Nov 1, 2026

Conversation

@juliankang4

Copy link
Copy Markdown
Collaborator

호스트 메모리 계획이 expert stream의 pinned staging과 폴더의 part read를 빠뜨려 생기던 거절과 과다 계획을 고치고, NVMe tier를 쓰는 모델 계획을 공용 owner로 맞춘 PR입니다.

What and why

A load that pages experts through the NVMe tier or streams them to the card sized its host room without two terms it later needs: the pinned staging the expert stream allocates, and the least a checkpoint folder's part reads need. The folder serve of the Qwen3.8 NVFP4 checkpoint was refused at its need record because the plan's reserves held 0 B. The expert stream also pinned a fixed 64 slots, more than one layer's stream can use.

This change reserves both on the host before the plan, from one owner each (placement::workstation). The stream pins at most half of its slots, and the tiered seats plan on the machine the run chose. The NVMe tier now takes each layer's own expert count and a relu² layer's up and down parts, so the Nemotron-H MoE, MiniMax-M3, Muse Spark and Solar-Open2 plans page on it, and a checkpoint folder's paged matrices fill the arena from their shards.

Before, on the RTX 5090 below, the Qwen3.8 NVFP4 folder serve stopped with:

bloomery-serve: the host need is not this plan's: its reserves hold 0 B, under the host's named reserves 7142630080 B and the row cache 536870912 B

After, the same serve plans (need bytes=68932596416 pinned=448000704 ... cache=68484595712), loads and answers its requests (STEP-RC serve-qwen38-nvfp4 0).

Release notes: Fixed: a load that streams experts or reads a checkpoint folder in parts now reserves its pinned staging and part reads in the host plan, so the Qwen3.8 NVFP4 folder serves again and Nemotron-H MoE, MiniMax-M3, Muse Spark and Solar-Open2 can page experts on the NVMe tier.

Code shape

The review reads these first. A box left unticked needs one line of why.

  • No second copy. Logic two models (or two call sites) share has one common owner; I lifted it there instead of
    copying it (AGENTS.md "Common code first", docs/rust-quality.md R14). Where I found an existing copy, I
    named it below.
  • Model code holds only architecture facts. A model's own files carry only what its architecture forces
    (tensor shapes, the attention kind, the quant). A common owner gained no per-model branch, flag or trait method.
  • Dead code is gone. Nothing I made unused is left behind (functions, flags, gate clauses, docs).
  • No silent failure. Undefined input is a named error or panic, never a defined-looking output.
  • Comments state what is true now. No dates, issue numbers or how a bug was found (tools/check-comments.sh).
  • No relaxed gate. No band, tolerance or lint moved to make a check pass; a re-pin carries PIN(YYYY-MM-DD):
    and its reason.
  • cargo fmt and cargo clippy are clean on what I touched; the lint count did not go up.

Duplication found or removed (path:line): the three serve seats (serve_seats/hybrid.rs, minimaxm3.rs, musespark.rs) each carried the same census and nvtier record code; it now lives in CensusSpan::steps and CensusSpan::prompt (crates/gpu-gates/src/record.rs). The stream staging reserve has one owner, workstation::reserve_stream_staging, and one slot rule, place_hybrid::stream_slot_bytes. A relu² layer's expert parts and the stack runs reuse host_lock::expert_runs through nvtier::stack_runs instead of a second stride walk. The remaining pairs the duplicate scan reports are different code (each seat's own prompt call, each function's own refusal label).

What I ran

Base is 72f7f9f52 (upstream/main). Head is ca991a925. Commands run on the RTX 5090 below, with the Qwen3.8 NVFP4 folder (nvidia/Qwen3.8-Flash-Next-FP4-Local), MiniMax-M3.1 UD-Q2_K_XL, Muse Spark UD-IQ2_XXS and the Nemotron-H and Solar-Open2 checkpoints, at the card's default budget, --ctx-size 8192, greedy decoding.

Commands, each ending rc 0 (BLOOMERY_ARCH=sm_120a BLOOMERY_BOX_LOCAL=1):

just gate-gpu-nvtier
target/release/bloomery-serve --model <model> -m <file> --place a
  • just gate-gpu-nvtier with the lib and parts tests: 78 passed, parts::tests::a_paged_folder_plan_holds_its_loads_reads 1 passed, record lists 25 passed, relu² paging 10 fills of 21504000 B.
  • bloomery-serve on Solar-Open2, Lightning, Qwen3.8 NVFP4, MiniMax-M3.1, Muse Spark and Lightning at an 8 GiB room: STEP-RC serve-qwen38-nvfp4 0 and the same for each of the others.
  • bloomery-serve on Qwen3.8 GGUF at --place a: need bytes=106521636544 pinned=703591104, xstream=split xstream_half=78 xstream_staging=64, two requests answered.
  • bloomery-serve on Qwen3.5 placed with BLOOMERY_CARD_BUDGET=8G: need ... pinned=221184000, two requests answered.

The MiniMax-M3.1 load reserves its stream staging and the lane pins half of its slots: base need bytes=125290266624 pinned=0, head need bytes=124765323264 pinned=1566572544 (xstream_staging=47). Storage reads per request on the same card, same round, same file (/proc/<pid> read_bytes):

Metric Base Head Difference
Request 1 reads (276 ids) 7,306,682,368 B 7,451,238,400 B +144,556,032 B
Request 2 reads (276 ids) 415,203,328 B 520,265,728 B +105,062,400 B
Request 3 reads (3,136 ids) 3,563,937,792 B 2,407,112,704 B -1,156,825,088 B

Unit tests on the changed owners, each also run with its production line removed to see the test fail:

cargo test -p bloomery-placement --lib                                            225 passed
cargo test -p bloomery-model --lib -- minimaxm3::place musespark::place place_hybrid qwen35moe::place   66 passed
cargo test -p bloomery-levers --lib -- residency38_unset_follows_the_plan        1 passed
bash tools/gate.sh --oxide -p bloomery-gpu-gates --release --features <serve features> --bin bloomery-serve -- tiered::tests::   2 passed

Hardware (if the change is for a machine)

NVIDIA GeForce RTX 5090, driver 595.99.02, 32607 MiB, power limit 400 W.

AI help

AI 코딩 에이전트가 코드를 작성한 후 설명을 썼고, 테스트를 마쳤습니다. diff 리뷰와 PR 초안 리뷰는 제가 직접 했습니다.

…ed matrices fill the NVMe arena from their shards, the block scales moved after the codes

A stack a checkpoint folder locates reads each expert's matrix into the arena where the folder keeps it: its codes and its block scales are two runs, each in any shard, read O_DIRECT into a window each, and the fill moves the scales to follow the codes, the one run the host's planes and the residency source read. The arena's floor counts a part at a window a run (arena_part_bytes), so a stack of NVFP4 rows takes its two planes' windows. The file_backed refusal holds for every shard a run lies in. The residency source reads a paged planes matrix from its slot, so the tier no longer refuses a folder and the unset word no longer turns off beside it.
…ough the NVMe arena, two parts an expert

A paged layer holds two routed stack rows (a relu² expert's up and down) or three (a gated expert's gate, up and down). The arena carves a slot of the layer's own windows and fills only the parts the layer holds; the leg's [gate, up, down] names a relu² layer's up in the gate slot again, which note_parts maps to the up's row, refusing a leg that leaves one of the plan's rows unnamed. The relu² refusal at the host leg's entries is gone. The card leg over the arena keeps the host leg for a relu² layer, since no gate·up kernel runs relu(up·x)². gate_nvtier's relu2 clause pages the real file's ups and downs as relu² experts and holds the tier's sums to the mapping's bits.
…lan pages the host experts the room cannot hold on the NVMe tier

The hybrid plan inputs now read the host's room and the arena's given bytes (PlanInputs::new) and run the shared expert_nvme_tier split after every arm, so a Bolt or Lightning plan whose host need passes the room pages the rest on the tier its placed body already attaches. The NVMe arena carves each paged layer over its own expert count (ModelTensors::layer_experts; Bolt's layers hold 240 to 496), its stacks' runs read where the host reads them (host_lock::expert_runs). The nemotron seat prints the nvtier record at load and after each prompt call through record::eprint_nvtier, the one stderr printer of it, which the ds41, glm and qwen38 seats now call too; HostTier::nvme_tier reads the tier from the host run.
… tier their bodies already serve, and the seats print its nvtier record

The three bodies attach the tier through the shared hosted_hybrid assembly, but their plan inputs never opted into it, so a host room under the need was refused as NoNvmeTier. Their describe now calls with_nvme_tier, as Flint's does; MiMo's host run attaches no tier and keeps the refusal. The minimaxm3, musespark and hybrid seats print the nvtier record at load and after each prompt call.
…est the host and the NVMe tier read in place

A checkpoint folder's plan that pages routed experts splits a stack between the card, the host and the NVMe tier, and the tier's arena now fills from the located stack where the folder stores it. OnCard refused every such split ("on Card(0) and Host and Nvme"), and a stack the host and the tier hold whole, so no folder load could page; it now takes the card's share and skips the off-card rest of a stack the located header holds in place, and still refuses one the part source makes.
…he PLE table reads it from the NVMe tier

The row source followed only whether the split was a header alone, so a located folder (Qwen3.8 NVFP4, whose PLE table the part source assembles from its value and block-scale planes) planned the table on the host whenever the room held it, and its load refused the host placement by name. The source is now the part source's whenever the split does not hold the table as one file run.
…s and the expert stream's, and the hybrid seats print it a prompt

The census needed an NVMe tier, so an all-RAM split printed no record of where its routed picks were served. It now reads a host run's picks with or without a tier (the arena's terms 0 without one) and counts, of the card's, the prompt slots the expert stream copied over the link. The record and its span are one owner (record::census_record, record::CensusSpan) for gate_nvtier and the Qwen3.8 seat; the MiniMax-M3, Muse Spark and hybrid seats print the steps since the last prompt and each prompt.

The seats that print the nvtier record and the census (hybrid, Solar-Open2, MiniMax-M3, Muse Spark, Nemotron-H) register both (record::groups::tier) and require them at open: a line of a kind the binary did not register ends the engine thread.
…the least its card's parts read, so the NVMe split leaves them room and the load holds the plan's need
…erves its lane's pinned staging on the host before its plan, the lane pins at most a half of slots, and the tiered open plans on the run's machine

The expert stream's lane pins its staging with cuMemHostAlloc for the load's
life, and no plan counted it: MiniMax's need read pinned=0 beside 64 slots of
18.35 MB, about 1.17 GB past a plan with 1.03 GB to spare, and the page cache
fell short of the host experts by that much.

- workstation::STAGING_SLOTS (64, from host::xstream) and
  reserve_stream_staging set the slots of a ring slot aside as the host
  reserve XSTREAM_STAGING_RESERVE, which HostNeed counts beside the other
  reserves and classes as pinned (NeedTerm::StreamStaging), not inside the
  part reads' peak.
- place_hybrid::stream_slot_bytes is the one ring slot: the widest layer's
  routed expert. MiniMax and Muse Spark pass it through
  PlanInputs::streaming; qwen35moe::PlanInputs::stream_slot gives Qwen's,
  0 where a routed stack reaches the card route as NVFP4 planes, which the
  ring pass does not read.
- Every load that streams asks the common rule (xstream_rule::plans_ring)
  before its plan and reserves the staging: the tiered seats (MiniMax, Muse
  Spark) on the ringed plan's machine, the Qwen3.8 seat on every machine of
  its placement (Place38::stream), generate_qwen3moe's machine38, the MiniMax
  gates' seat under split, and the Qwen3.5 e2e gate's placed residency loads
  (PlaceQ3::streaming).
- XStream::new pins at most the ring's half of slots: one layer's stream is
  never wider, so the slots above it held nothing.
- tiered::Open takes the run's machine, side model, part reads and staging
  included, instead of four seats rebuilding it without them.
@github-actions github-actions Bot added documentation Improvements or additions to documentation 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 placement Placement planning: crates/placement tools Tools, recipes, CI and the toolchain: tools/, justfile, .github/, Cargo labels Nov 1, 2026

@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: CLEAN: The validated findings are advisory; no must-fix item remains.

Non-blocking

⚠ Measure the added drop bookkeeping: crates/gpu/src/host/nvtier.rs:2854.
For a three-part GGUF layer, each mapping-read drop planned by runs_of adds two scratch allocations and three nonempty sorts of expert ranges. At r such calls per token, that is 2r extra allocations and 3r range sorts under the drop queue lock [derived].
The PR reports storage bytes but no timed decode/prefill A/B. Dispatch changes require a same-lease A/B under AGENTS.md. Attach that comparison on the contributor's card. Resolve the immutable shard ordering at load if this work affects the step.

⚠ Show the staging-cap gate result: crates/gpu-gates/src/bin/gate_xstream.rs:389.
The new assertion requests HALF + 1 staging slots and expects HALF. The reported commands omit the owning xstream gate and FAIL-first evidence for this clause. Run just gate-gpu-xstream and show that removing the production .min(half) turns the cap assertion red.

Optimization headroom

  • C. More in flight: crates/gpu/src/host/nvtier.rs:3539. Codes and scales read sequentially within each part. Scheduling both runs on the existing reader workers, then moving scales after both finish, exposes up to six independent reads per gated two-plane expert instead of three serial pairs [derived], bounded by the worker count.

Checked

Compared the cited drop planner with the base, followed mapping-read completion through the queue lock, and inspected the staging-cap assertion and reader dispatch. Neither advisory finding meets kind A or B. No ledger lessons apply. No inline suggestions or issue candidates were supplied.

Notes

Static review only. Builds and hardware gates were not rerun.

Card check: gpu-evidence. This pull request changes crates/gpu-gates/src/bin/gate_minimaxm3_e2e.rs, crates/gpu-gates/src/bin/gate_minimaxm3_prefill.rs, crates/gpu-gates/src/bin/gate_nvtier.rs … and carries a gate run on the author's card, which counts as verified.

🔨 Shingler, bloomery's review bot: approves a clean pull request and requests changes on a must-fix (how it works)

@github-actions github-actions Bot added gpu-evidence Verified on the author's card: the pull request carries the gate run and its output and removed needs-gpu Changes code a card must check, and carries no gate run on a card labels Nov 1, 2026
@juliankang4

Copy link
Copy Markdown
Collaborator Author

The review is done and the contribution check passed, so I'm merging this.

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

Labels

documentation Improvements or additions to documentation gpu The card engine: crates/gpu*, crates/app gpu-evidence Verified on the author's card: the pull request carries the gate run and its output 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 placement Placement planning: crates/placement tools Tools, recipes, CI and the toolchain: tools/, justfile, .github/, Cargo

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant