Repository navigation
model-hf, qwen3moe: a Qwen3.8 NVFP4 folder's routed stacks stay where the folder stores them - #1034
Conversation
…kernel runs them The plan put any routed stack the card rule left over on the host as its file bytes, whatever the host could compute: a BF16 or F16 stack, which no host kernel reads, planned and fit by its bytes and was refused only at load by the host tier's check. The split's one owner (routed_row_on_as) now asks the host's executor rule, kernels::host_stack: a fused qdot kernel for the type on this machine and a row width of whole units, the rule model::ops::host_stack_runs now delegates to. A host segment of a stack it refuses is PlacementError::NoHostKernel, naming the tensor, the type, the width and the experts the host would hold. The node scale tests' one-layer model held I8 stacks no host kernel runs; it holds MXFP4 rows of the same bytes, which the host runs and no card rule there reads.
The plan refused an NVFP4 routed stack with some experts on a card and the rest on the host: the card holds the stack as planes, and a residency swap copied the file's blocks into a card slot. The host's NVFP4 dot reads the file's blocks, so the plan now splits such a stack as it splits any other, and every reader of a split stack takes it: - Transform::Nvfp4Codes and Ue4m3Scales name their source form (Nvfp4From): a folder's plane, or GGUF's NVFP4 blocks, whose one run holds both planes interleaved. A slot part is Transform::target_len of its source, so the lane and the expert stream check and stage a part of another length than its source; planes::split_plane moves one plane of the blocks, checked as the load's split_rows checks a row. - FileSwap stages a GGUF NVFP4 expert's three planes from its one run (through the NVMe arena when it serves the id, which holds the run whole), reads its tensor scales from the stack's .scale, and holds NVFP4 planes for either NVFP4 file type. card_bytes gives a plane as the static load uploads it. - A Qwen3.8 load whose card route reads NVFP4 planes refuses BLOOMERY_XSTREAM=split by name (XSTREAM_FORM): its ring pass reads words. Unset, the rule then takes admit, as it does for a ring with no room. - The residency's unset word turns off beside the NVMe tier only for NVFP4 rows a folder locates. gate_qwen4exp_nvfp4 gains (s): the all-card plan under a card budget 8 GiB short, whose eager steps hold (c)'s band against the oracle.
…e page cache A card's share of a split stack (its experts along the stack or by a list) was normalized through the shard mapping: page faults on the reading thread, the page cache filled with the experts' bytes. It now takes the bounded direct reads a whole NVFP4 stack takes (`read_nvfp4`), over the sources the part reads whole (`whole_sources`, which `read_from` and `release` share), and its read bytes count that batch and the part's own output. A part that cuts rows still reads them through the mapping.
…their own
A checkpoint folder keeps a stack's experts wherever its shards fall:
of Qwen3.8-Flash-Next-NVFP4's 144 routed stacks, 21 cross a shard
boundary, and 5 matrices keep their block scales in the next shard
from their codes. A located stack held one shard, so the folder refused
such a stack by name ("not the stack's file", "the one matrix a stack of
planes holds").
gguf::Place::Stack names the shard of every run (codes_in, scales_in
beside codes_at, scales_at); the first matrix's codes shard lists the
stack in its table. Split::located checks each run inside its own file,
and overlap only between runs of one file; Split::matrix reads each run
from its shard. The host's StackRuns carries the same shards and reads
them through the split's files (ops::Files), and host_lock's expert
runs and page walks name each run's file. stack_in_place records each
plane's file instead of refusing a second one.
… the folder stores them A Qwen3.8 checkpoint folder made every tensor for the card, so its header located no file: the host could hold no routed expert, a plan that split the experts was refused by the load, and no residency machine ran. The qwen35moe map now keeps the routed stacks in place as NVFP4 rows planes, as the minimax-m3 and nemotron maps do, so a load reads them where the folder stores them and the plan splits them between the card and the host as a GGUF's. - folder::Keep says where a plan reads a tensor its map keeps in place: where the folder stores it (open), or nowhere (read, which prepare writes, and a draft), so prepare's split still holds made NVFP4 stacks. - A stack is kept only where its stored format is the rows type it is declared as; FP4-Local's stacks, whose csf block scales the host does not read, are made for the card as before. - The card holds NVFP4 rows as NVFP4's planes, so card38's leg types read them as NVFP4 (the same upload and kernels as before). - gate_qwen4exp_nvfp4 takes a folder whose routed gate is NVFP4 rows. - The NVMe expert tier reads a paged stack from its file run (gguf::Split::run), so a plan that pages a folder's located stacks is refused by name where it read a header offset no file holds. - The qwen38 seat, Folder38, serving.md, dgx-spark.md and the README say the NVFP4 folder's experts split; FP4-Local's stay on the card.
There was a problem hiding this comment.
Verdict: CLEAN: No reachable behavior defect or mechanical quality defect was proved.
Non-blocking
⚠ Verify live NVFP4 residency: crates/gpu-gates/src/bin/gate_qwen4exp_nvfp4.rs:632 forces residency off. This catches the load refusal but does not exercise the new staging path during an admission or eviction. Exercise migrations for the NVFP4 folder and GGUF, checking all plane parts, migration counts and eager/captured outputs. The existing residency gate needs adaptation: it opens GGUF directly and checks only three parts per expert.
⚠ Supply the host dispatch performance proof: crates/model/src/ops.rs:1385 builds shard maps through host_resident → expert_runs → stack_runs. For a full resident expert check over three located stacks of 512 experts, the change adds six shard-vector clones (24,576 bytes on a 64-bit host), at least six map allocations and at least three metadata-vector allocations per check, multiplied by checks per token [derived]. Read the existing split placement directly for one expert, or provide a same-lease A/B with live migrations. The move/split proof also needs identical PTX and unchanged host dispatch structural counts.
Checked
Duplicates: 28 new functions, types and constants checked. No qualifying duplicate found. Dryer reported zero pairs; GPU owners were searched manually.
Complexity: split is new (18), combining plan/load/run checks. Place::check (+5) adds shard validation; tensor_scales (+5) adds the GGUF source. Growth in planned_tensors, xstream_rule, assemble, host_pages, gate run and NvTier::of_paged adds origin, fallback, shard or refusal cases. Complexity alone produced no finding.
Silent failure: 10 default/conversion sites followed. Invalid runs, unsupported host rows and invalid scales reach named errors. Validated made tensors and optional streaming paths account for the remaining defaults.
Tests: static mutation checks only. Force the first shard in reads or page ranges → cross-shard assertions fail; omit scale validation → refusal/sentinel assertions fail; keep NVFP4_ROWS as the card leg type → type assertion fails; disable in-place origins → origin assertions fail; reverse listed experts → byte assertions fail; reject GGUF planes → part-count assertions fail; restore the split refusal or remove the host-capability check → placement/gate assertions fail. Other test edits adapt fixtures to the host-capability contract.
Gates: no band or tolerance moved. Removed refusal clauses have dated PIN reasons and replacement assertions.
Escape catalog: C1–C4 did not match.
Adversarial: checked cross-shard offsets, invalid scales, CSF fallback, located stacks on the NVMe tier and staging destination lengths. Existing guards blocked the constructed failures.
Notes
No builds or hardware tests were run here. Reported GB10 gate evidence names head 292c1328f; the reviewed head is 838061905.
Card check: gpu-evidence. This pull request changes crates/gpu-gates/src/bin/gate_qwen4exp_e2e.rs, crates/gpu-gates/src/bin/gate_qwen4exp_nvfp4.rs, crates/gpu-gates/src/bin/shared/qwen38_open.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)
|
The review is done and the contribution check passed, so I'm merging this. |
Qwen3.8 NVFP4를 체크포인트 폴더와 GGUF 모두에서 카드와 호스트로 나눠 serve할 수 있게 고쳤습니다.
What and why
A Qwen3.8 NVFP4 model could not be served split between the card and the host. The checkpoint folder was refused at load (
parts::load: blk.0.ffn_down_exps.weight is placed on Card(0) and Host: a load from a part source holds every tensor whole on card 0 ...), and the shipped GGUF (type 40) was refused by the placement rule.Part of #1022. This is the shared layer for the offload work: a routed stack's experts go to the host only where a host kernel runs them (
kernels::host_stack, used by both the plan and the load check);host::swapcarries an NVFP4 plane's source form and target length; a part source reads an NVFP4 stack's whole experts past the page cache; a located stack's runs may each lie in their own shard (144 stacks in the folder's index, 21 of them span more than one shard); and a folder load keeps a plain NVFP4 stack where the folder stores it instead of rebuilding it (Keep::InPlace). No kernel file changes, so an all-card load is bit for bit the one before.The folder split serves with
BLOOMERY_RESIDENCY=off. The GGUF split serves at the defaults.Release notes: Fixed: a Qwen3.8 NVFP4 model, as a checkpoint folder or the shipped GGUF, now serves split between the card and the host instead of being refused at load.
Code shape
kernels::host_stack, which the plan and the load check both call; the NVFP4 plane conversion extendshost::swap'sTransforminstead of adding a second path.PlacementError::NoHostKernel; a plan that pages a located stack from the NVMe tier stops with a named error.PIN(...)lines (crates/placement/src/placement/tests/bounds.rs,crates/model-hf/src/folder.rs); no band or tolerance moved.cargo fmtandcargo clippyare clean on what I touched; the lint count did not go up.Duplication found or removed (
path:line): none.What I ran
Head
292c1328fon upstream main294f8d6b4, on a DGX Spark (hardware below). The gate bundle printed:The library tests of the changed modules, and the NVMe tier's paged read of a GGUF stack on the card:
Before and after, serving the checkpoint folder under a 60G card budget (
bloomery-serve-qwen38 --place a --ctx-size 4096,BLOOMERY_CARD_BUDGET=60G,BLOOMERY_DRAFT=off, a 128 token greedy/completion). On13d469be1, the base at the time:On the head, with
BLOOMERY_RESIDENCY=off:The shipped GGUF split under the same budget, at the defaults:
The folder all-card serve on the base and on the head give the same 128 ids and the same probabilities:
Each split against its own format's all-card serve, on the head (128 tokens, each id's top two requested):
Both splits differ from all-card at a position where the top two candidates are within 0.3 nats (folder at 64: gaps 0.0703 and 0.1523; GGUF at 92: gaps 0.2659 and 0.0022), and agree with it before that.
Hardware (if the change is for a machine)
DGX Spark:
nvidia-smi --query-gpu=name,driver_version,compute_capprintsNVIDIA GB10, 595.84, 12.1. The gates ran in the project's dev container (CUDA 13.3.1) built with--arch sm_121.AI help
AI 코딩 에이전트가 코드를 작성한 후 설명을 썼고, 테스트를 마쳤습니다. diff 리뷰와 PR 초안 리뷰는 제가 직접 했습니다.