Skip to content

gpu, placement: every family's prompt ring pass reads the ring's half through one common view, so an NVFP4 folder splits, and a plan with no host expert reserves no stream staging - #1111

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

Conversation

@juliankang4

Copy link
Copy Markdown
Collaborator

NVFP4 폴더도 expert stream의 ring pass를 쓰게 하고, host expert가 없는 계획이 staging을 잡지 않게 공용 owner 하나로 맞춘 PR입니다.

What and why

The expert stream's prompt ring pass read the card's expert stacks through a copy in each model family, and only as words. A load whose card route reads NVFP4 planes was refused by name, so the Qwen3.8 NVFP4 folder always fell back to xstream=admit. Qwen3.5/3.6's common-leg layers were refused the same way.

This change gives the ring pass one owner, card_leg::with_ring. It reads the ring's half in the card stacks' own format (words or NVFP4 planes) and hands the route GEMM its block. DeepSeek-V4.1, MiniMax-M3.1, Qwen3.8, Qwen3.5/3.6 and Muse Spark all call it, and the per-family walks and the NVFP4 refusals are gone. Around it:

  • A plan that holds every routed expert on its cards no longer reserves stream staging (workstation::plan_streams, one owner asked by the Qwen3.8 seat, the CLI and the tiered seats).
  • A folder's least part reads are one owner's read (parts::least_reads), and every seat probes them at the least context through workstation::least_part_reads.
  • An NVFP4 stream slot counts each matrix's tensor-scale plane, and a mixed layout the ring cannot read (for example NVFP4 gate/up with a Q8_0 down) is named XSTREAM_FORM and keeps its previous admit outcome when the stream rule is unset.
  • Upstream's detected-device cost pricing applies to NVFP4 files unchanged; this change only lets them reach it.

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

xstream=admit (unset: the ring pass does not read the card's stacks: XStream ring form: split on a load whose card route reads NVFP4 planes: the ring pass reads a matrix the ring holds as words)

After, the same serve:

xstream=split xstream_half=128 xstream_staging=64 xstream_lane_gbs=12.46 xstream_priced_gbs=12.46 xstream_m_min=5472 xstream_costs=2.159,51.098,1.815,0.0652 xstream_lane_source=measured xstream_union_source=measured (unset: --place a with a residency)

Release notes: Changed: an NVFP4 Qwen3.8 folder and the common-leg layers of Qwen3.5/3.6 now stream experts through the prompt ring like other formats, and a load that keeps every routed expert on its card no longer reserves stream staging.

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 per-family ring walks (RingStacks, with_ring_windows, XSTREAM_FORM in host/xstream.rs; ffn_ring, slot_site in wide.rs; SiteWeight::Words in site.rs) are replaced by card_leg::with_ring. The mapped-row window is one private with_row in host/xstream.rs. The staging decision is workstation::plan_streams, and part reads are parts::least_reads and workstation::least_part_reads. The two pairs the duplicate scan reports are different code: serve_seats/folder.rs least_reads is a pair of builds with and without the checkpoint feature, and with_union and with_map are one-line accessors over with_row.

What I ran

Base is fa38e3a1fc61ed5fcf9ba4860f35a20f4de14128 (upstream/main). Head is 3b62cc53e217b7ee6d75e57877350e0d1f7e1fea.

$ nvidia-smi
Mon Nov  2 01:59:18 2026       
+-----------------------------------------------------------------------------------------+
| NVIDIA-SMI 595.99.02              Driver Version: 595.99.02      CUDA Version: 13.2     |
+-----------------------------------------+------------------------+----------------------+
| GPU  Name                 Persistence-M | Bus-Id          Disp.A | Volatile Uncorr. ECC |
| Fan  Temp   Perf          Pwr:Usage/Cap |           Memory-Usage | GPU-Util  Compute M. |
|                                         |                        |               MIG M. |
|=========================================+========================+======================|
|   0  NVIDIA GeForce RTX 5090        Off |   00000000:01:00.0 Off |                  N/A |
|  0%   41C    P8             12W /  400W |       2MiB /  32607MiB |      0%      Default |
|                                         |                        |                  N/A |
+-----------------------------------------+------------------------+----------------------+

+-----------------------------------------------------------------------------------------+
| Processes:                                                                              |
|  GPU   GI   CI              PID   Type   Process name                        GPU Memory |
|        ID   ID                                                               Usage      |
|=========================================================================================|
|  No running processes found                                                             |
+-----------------------------------------------------------------------------------------+

Models (greedy decoding, --ctx-size 8192): nvidia/Qwen3.8-Flash-Next-NVFP4 at fc694b54fb0174e0913e6adf86691ef85a4ead47; Qwen3.8-Flash-Next-UD-Q4_K_XL-00001-of-00004.gguf; unsloth/MiniMax-M3.1-Flash-GGUF at b17b7f5459c0b8f127ea12ee774409b282521d6a, UD-Q2_K_XL/MiniMax-M3.1-Flash-UD-Q2_K_XL-00001-of-00004.gguf; unsloth/Muse-Spark-Open-816B-A42B-GGUF at c00670568b6ce5e56a247f67091247984df2a01e, UD-IQ2_XXS/Muse-Spark-Open-816B-A42B-UD-IQ2_XXS-00001-of-00006.gguf; nvidia/NVIDIA-Nemotron-3.5-Lightning-30B-A3B-NVFP4 at bee7596271d1495f6992ae224aefde4410e816b8; the Qwen3.8 fixture qwen38-fixture-00001-of-00001.gguf.

Card gates, run with BLOOMERY_ARCH=sm_120a BLOOMERY_BOX_LOCAL=1 BLOOMERY_GATE_CARD=any on the head tree:

just gate-gpu-xstream
gate_xstream: PASS
just gate-gpu-nvtier
gate_nvtier: every clause passed
BLOOMERY_MODEL=qwen35moe ./tools/box.sh 'cargo oxide build --arch sm_120a -- -p bloomery-gpu-gates --features gpu --release --bin gate_qwen35moe_e2e && bash tools/gpu-gate.sh gate_qwen35moe_e2e --residency-only'
split: xstream=split xstream_half=140 xstream_staging=64 ...
gate_qwen35moe_e2e --residency-only: PASS
BLOOMERY_TIER=fixture BLOOMERY_FIXTURE_ROOT=<Muse Spark fixture dir> just gate-gpu-musespark-prefill
PASSED: gate_musespark_prefill arm whole ...
prefill_stream_streamed: 68 calls, 60 of them streamed, 415 experts streamed in all; the records, the ring passes and the host's left-out slots agree ok

The same Qwen3.6 residency gate and the Muse Spark stream arm also ran on upstream/main: 21 and 121 clause lines, 20 and 120 equal with timings masked; the one differing line in each is the measured versus stored lane rate and its source.

Card tests of the changed modules (--include-ignored, two passes):

bash tools/gate.sh --gpu --oxide -p bloomery-gpu --release --lib -- --include-ignored --skip hw_held_ card_leg::tests::hw_ card_experts::tests::hw_ host::xstream::tests::hw_ wide38::tests::hw_
test result: ok. 17 passed; 0 failed
bash tools/gate.sh --gpu --oxide -p bloomery-gpu --release --lib -- --include-ignored hw_held_
test result: ok. 10 passed; 0 failed

bloomery-serve (--model <seat> -m <file> --port 18451 --ctx-size 8192, greedy /completion requests of 128 and 16 ids), head against upstream/main:

  • Qwen3.8 NVFP4 folder, xstream: base admit (ring refused), head split xstream_half=128 xstream_staging=64.
  • Qwen3.8 fixture with every routed expert on the card, need ... pinned=: base 282579552, head 26989152.
  • generate_qwen3moe on the fixture (--place a), need ... pinned=: base 255590400, head 0.
  • Qwen3.8 UD-Q4_K_XL, xstream: split xstream_half=78 xstream_staging=64 on both.
  • Nemotron-3.5 Lightning, tiered seat at BLOOMERY_CARD_BUDGET=8G BLOOMERY_HOST_ROOM=8G: equal plan lines, ids equal for 16 of 16/16 (all equal).

Qwen3.8 UD-Q4_K_XL answered three requests with equal first-id top-5 probabilities and ids equal for 128 of 128/128, 128 of 128/128 and 16 of 16/16. MiniMax-M3.1 UD-Q2_K_XL loads and answers on both sides with xstream_half=47 xstream_staging=47.

Unit tests on the changed owners (bash tools/gate.sh --oxide ... or cargo test), all test result: ok:

bash tools/gate.sh --oxide -p bloomery-gpu --release --lib -- qwen3moe:: host::swap_source::tests host::nvtier::tests host::xstream::tests musespark::body:: parts::tests card_leg::tests card_experts site::tests    134 passed
bash tools/gate.sh --oxide -p bloomery-gpu-gates --release --features glm5next,clef,mimo2,solar2,minimaxm3,flint,gemma-embedding2,hf,checkpoint --bin bloomery-serve -- qwen38::tests tiered::tests nemotron::tests folder::tests    11 passed
bash tools/gate.sh --oxide -p bloomery-gpu-gates --release --features gpu --bin generate_qwen3moe    7 passed
cargo test -q -p bloomery-placement --lib    227 passed
cargo test -q -p bloomery-model --lib -- qwen35moe::place musespark::place minimaxm3::place place_hybrid    66 passed

Three boundary tests, each run with its production line reverted (fails) and with it restored (passes):

serve_seats::qwen38::tests::a_streaming_placement_reserves_its_staging
  reverted: test result: FAILED. 0 passed; 1 failed    restored: test result: ok. 1 passed; 0 failed
host::xstream::tests::a_layout_refusal_is_distinct_from_invalid_parts
  reverted: test result: FAILED. 0 passed; 1 failed    restored: test result: ok. 1 passed; 0 failed
arch::qwen35moe::place::tests::a_stream_slot_is_the_widest_routed_expert
  reverted: left: 108 ... test result: FAILED. 0 passed; 1 failed    restored: test result: ok. 1 passed; 0 failed

Lint: bash tools/mac-check.sh lint gave lint rc 0 (^warning: 0, the ratchet 0 in tools/lint-ratchet.txt).

Hardware (if the change is for a machine)

NVIDIA GeForce RTX 5090, driver 595.99.02, CUDA 13.2, 32607 MiB, power limit 400 W. The card gates, card tests and bloomery-serve runs above ran on it.

AI help

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

…ing pass reads the ring's half through the common view, NVFP4 planes included

Qwen3.8, Qwen3.5/3.6 and Muse Spark walked the expert stream's ring with
their own windows (with_ring_windows), which held the half as K-quant
words only: a Qwen3.8 load whose card route reads NVFP4 planes refused
split by name (XSTREAM_FORM) and fell to admit, and a Qwen3.5 placed load
with a common-leg layer refused it too. DeepSeek-V4.1 and MiniMax already
read the half through card_leg::with_ring.

- card_leg::with_ring hands the half to every family as one RouteBlock in
  the card stacks' forms (LegStacks::block), and RingLayer::with_union
  lends the union row: CardExperts::enqueue_rows_ring, Qwen3.8's card
  route (wide38), the Qwen3.5 placed ring pass (dispatch and common-leg
  layers) and Muse Spark's prompt ring pass all take it. Muse's block
  takes the file's types, not a fixed IQ2_XXS.
- with_ring_windows, RingStacks, XSTREAM_FORM, wide::ffn_ring and the
  SiteWeight::Words arm go; the Qwen3.8 and Qwen3.5 refusals of NVFP4 and
  common-leg layers go with them, and qwen35moe::PlanInputs::stream_slot
  counts an NVFP4 planes stack's slot. An NVFP4 file's split is priced as
  every file's is, from the detected card and the expert's shape and
  bytes (host::costs).
…on its cards keeps no stream staging, one owner asked by the Qwen3.8 seat, the CLI and the tiered seats

The Qwen3.8 serve seat and generate_qwen3moe reserved the lane's pinned
staging (up to 64 ring slots, 255.7 MB on UD-Q4_K_XL) before the plan
whenever the stream rule asked for split, even where the plan then held
every expert on the card and nothing could stream; the tiered seats asked
the same question inline (plain.plan.host.experts > 0).

- workstation::plan_streams is the one answer: the plan leaves a routed
  expert on no card. The tiered seats' ringed choice reads it.
- The Qwen3.8 seat's Place38::machine_read, every machine of its
  placement, plans without the staging where the staged plan streams
  nothing; generate_qwen3moe's machine38 asks the plan its callers make
  (plan38, with the draft where one runs) the same way.
… one part source's read, and every seat probes them through one owner at the least context

The least host bytes a folder's load reads were asked two ways: a
bloomery_gpu::folder::Folder through its part source's read at no room,
and parts::least_reads over a source and an InPlace the tiered seat and
the gates' folder wrapper each built from the header. The probe walk
(plan at PART_READ_CONTEXT, read the parts) was written out in the
tiered, Nemotron and Qwen3.8 seats, and the placement test that guards
the short-context probe rewrote it rather than calling it.

- parts::least_reads takes the source and its header and asks a
  PlacedSource's read at no room, the read Folder::least_reads asks; the
  gates' folder::least_reads takes the header and the source, and the
  tiered seat calls it.
- workstation::least_part_reads plans at PART_READ_CONTEXT and reads the
  plan's parts, None where the plan is refused; the three seats and the
  placement test take it.
… its arena slot

FileSwap::matrix reads a located matrix from the NVMe arena's slot when
the lane's open read finds the id filled, else where the folder keeps
it. The located-stack test in host::nvtier checked the slot's bytes
without going through FileSwap, so a source that always read the mapping
stayed green: both hold the same bytes.

The new test fills one id, changes the folder's bytes under the mapping,
and reads both ids' codes and block scales through FileSwap::source: the
filled id reads what the fill wrote, the unfilled one the folder's new
bytes. The nvtier test's tier is one helper both tests build.
@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 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: No must-fix finding survives validation.

Non-blocking

⚠ Supply the move proof: crates/gpu/src/arch/qwen3moe/placed.rs:2486. The dispatch ring now calls RouteBlock::enqueue. The PR evidence lacks the identical ptx-scan or successful canon-check output required by the base AGENTS.md move class. Attach it and the preserved host-dispatch structural counts to establish that the shared implementation preserves this path.

Checked

Validated both cited lines against the diff, followed the routed block's quantization calls, and checked the base move-class contract and axis E. No escape-catalog pattern or ledger lesson changes the retained item's classification. This is a full review; revert, mirror and incremental exclusions do not apply.

Notes

The PR contains RTX 5090 gate output. Builds and hardware tests were not rerun during validation.

Card check: gpu-evidence. This pull request changes crates/gpu-gates/src/bin/generate_qwen3moe.rs, crates/gpu-gates/src/bin/shared/minimaxm3_seat.rs, crates/gpu-gates/src/bin/shared/serve_seats/folder.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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant