Skip to content

gpu, gpu-gates: the NVFP4 gate's split stages host experts through the residency machine, every part checked - #1036

Merged
juliankang4 merged 2 commits into
midagedev:mainfrom
juliankang4:dgx-spark-q38-offload-host-budget
Oct 31, 2026
Merged

juliankang4 merged 2 commits into
midagedev:mainfrom
juliankang4:dgx-spark-q38-offload-host-budget

Conversation

@juliankang4

Copy link
Copy Markdown
Collaborator

Qwen3.8 NVFP4 폴더를 60G 카드 예산으로 카드와 호스트에 나눠 띄울 때 호스트 메모리 부족으로 거부되던 문제를 고쳤고, NVFP4 gate가 호스트 expert의 staging을 카드에서 모든 part까지 확인하게 했습니다.

What and why

Serving a Qwen3.8 NVFP4 checkpoint folder split between the card and the host under BLOOMERY_CARD_BUDGET=60G, with residency unset, was refused at load: the host need counted the part read-ahead and the residency churn pool together, 9,689,875,288 B over the room. A load never holds both at once, because the churn pool is read in after the card upload, when the part reads are done. The need now counts the larger of the two, and the part read plan gets the room the pool does not use.

Part of #1022. The NVFP4 gate gained a clause, (rs), that stages host experts onto the card through the residency machine on the folder split, and its transform_check now compares every part the source stages (it compared a fixed 3 of an NVFP4 stack's 9). To let that run on a folder, FileSwap::card_bytes now returns the bytes a static load uploads for a located NVFP4 plane instead of refusing it.

Release notes: Fixed: a Qwen3.8 NVFP4 checkpoint folder now loads split between the card and the host under a card budget with residency unset, instead of being refused for host room.

Code shape

  • No second copy. The peak is counted in one owner, HostNeed, which the check, the page classes and the refusal text all read; the new read_room replaces a room computed at the call site.
  • Model code holds only architecture facts. No model file changed; the common owners gained no per-model branch.
  • Dead code is gone. The fixed part-count argument of transform_check is removed from it and its three callers.
  • No silent failure. A layer the machine has rows for but the source stages no part for is refused by name instead of counting as checked.
  • Comments state what is true now.
  • No relaxed gate. No band, tolerance or lint moved; the (rs) clause and the all-part comparison add checks.
  • cargo fmt and cargo clippy are clean on what I touched; the lint count did not go up.

Duplication found or removed (path:line): none.

What I ran

Head be0462ecd on 904266cfc, on a DGX Spark (hardware below). crates/placement/src/placement/workstation.rs has a test, a_load_never_holds_its_part_reads_and_its_churn_pool_at_once, built from the byte counts of the refused load below.

Before, serving the folder (bloomery-serve-qwen38 --place a --ctx-size 4096, BLOOMERY_CARD_BUDGET=60G, BLOOMERY_DRAFT=off, residency unset), on 4e0b0411, the head of #1034 this change builds on:

bloomery-serve-qwen38: GpuModel::load_placed: the host room is 123551232000 B (MemAvailable in /proc/meminfo), under the 133241107288 B this load needs by 9689875288 B: host experts 18687283200 B + tables 0 B + ring shadows 100663296 B + reserves 835456128 B + residency churn pool 39307161600 B + part read-ahead 10171207688 B + the cards' share of the unified pool 64139335376 B

After, on be0462ecd, the same command and a 128 token greedy /completion:

residency unset residency=mid-p73-s1 why=unset: p0→p73 (host: the churn pool did not fit, raised) read=MemAvailable room=123850276864 plan_room=123313405952 mem_left=39651331248
need bytes=123234657104 pinned=298585216 anon=0 cache=58796736512 locked=0 unified=64139335376 os=0
load arch=qwen4exp resident_bytes=61601187448 ctx=4096 slots=1 slot_ctx=4096 ctx_max=262144 ctx_train=262144 verified=3001 layers=48 mode=graph store_bytes=216532688 prefill=auto ubatch=4096 place=a card_layers=48 in 30.5 s (runtime value)
tokens 128 stop limit

The gates, from the same run:

bash tools/gate.sh --gpu --oxide -p bloomery-gpu --release --lib -- --include-ignored --skip hw_ parts:: host::swap planes::
test result: ok. 29 passed; 0 failed; 0 ignored; 0 measured; 443 filtered out
just gate-gpu-swap
gate_swap: PASS
env BLOOMERY_CARD_ALL_EXPERTS=1 BLOOMERY_REF_MODEL=<nvidia Qwen3.8-Flash-Next-NVFP4 folder> BLOOMERY_GATE_BOUND=2400 just gate-gpu-qwen4exp-nvfp4
(s) plan card_budget=73734243024 host_experts=3066 card_experts=21510 layers split between the card and the host: 48
(s) the split load: the plan splits true, the oracle's band held true; last argmax 11751 the all-card run's 11751, logits_rel to it 5.542e-2 (printed) PASS
transform: 54 admitted experts, 0 parts differ from a static load: PASS
(rs) mid-p446-s1, each layer reseeded to its highest ids: 54 host experts staged onto the card, the oracle's band held true PASS

With the folder's codes staged as stored instead of converted (dst.copy_from_slice(src) in crates/gpu/src/host/swap.rs), the same gate prints:

transform: 54 admitted experts, 162 parts differ from a static load (first layer 0 expert 511 slot 446 part 0 at Some(0)): FAIL
(rs) mid-p446-s1, each layer reseeded to its highest ids: 54 host experts staged onto the card, the oracle's band held true FAIL
gate_qwen4exp_nvfp4: FAILED: one or more checks above did not pass

Hardware (if the change is for a machine)

DGX Spark: nvidia-smi --query-gpu=name,driver_version,compute_cap prints NVIDIA GB10, 595.84, 12.1. The serve binary was built with cargo oxide build --arch sm_121.

AI help

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

@github-actions github-actions Bot added gpu The card engine: crates/gpu*, crates/app 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 Oct 31, 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 merge-blocking defect found in the host peak accounting or NVFP4 residency verification.

Checked

Duplicates: 3 new definitions checked against existing owners; none duplicated. dryer reported 0 candidate pairs.

Complexity: reseeded is new at 23, with plan/open, reseed/compare and replay phases. split grows 18→20 by adding the residency clause. HostShort::fmt grows 21→24 through diagnostic formatting arms.

Silent failure: 4 paths followed: saturated read room, empty source parts, missing matrices and invalid code groups. Exact admission or named errors handle them. Part readers join and the upload ring drains before the churn pool is populated.

Tests: Mutation inspection of crates/placement/src/placement/workstation.rs:1097: summing pool and reads makes the new peak test fail. Its fixture arithmetic and one-byte boundary were checked separately.
Mutation inspection of crates/gpu/src/model.rs:2300: subtracting the pool from read room makes the changed part-plan test fail.
Mutation inspection of crates/placement/src/placement/workstation.rs:1597: counting both phases makes the page-class test fail. Restoring the unconditional residency hint also fails the new peak test.

Gates: No bands or pins moved. The new residency clause has a reported FAIL-first run with unconverted codes. The shared comparison now visits every source part and requires a staged expert.

Escape catalog: No C1–C4 pattern matched. Production changes affect loading and verification, with no new decode or prefill work.

Notes

dryer excluded gpu-gates; those changes were searched manually.
Rust tests and GPU gates were not run in this review. The reported GPU run names be0462ecd/904266cfc, rather than the current head/base.

Card check: gpu-evidence. This pull request changes crates/gpu-gates/src/bin/gate_glm5next_residency.rs, crates/gpu-gates/src/bin/gate_qwen38_residency.rs, crates/gpu-gates/src/bin/gate_qwen4exp_nvfp4.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 Oct 31, 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

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 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