Repository navigation
gpu, model, refset: Qwen3.8 served from the NVIDIA NVFP4 checkpoint on one card, every routed expert on the card, against its pinned oracle - #561
Conversation
…n one card, every routed expert on the card, against its pinned oracle The split prepare writes from nvidia/Qwen3.8-Flash-Next-NVFP4 holds its routed stacks in NVFP4 with one tensor scale an expert. Every card leg loads such a stack in its planes (placement's leg_card_format, which every leg's arm and the hybrid plan's card rule read) and Qwen3.8's leg admits it; the card's step leg reads it through the NVFP4 `_sel` entries main already has. The prompt route reads every card stack by the GEMM entry the kernel table names for its type (card_leg's StackW::route), so Qwen3.8's ubatch route and its tier card's block route keep no type list of their own, and NVFP4's planes go through the 32-value GEMM over 32-value rows, which the ubatch route holds in place of the q8_1 rows the plan counts (one input form a load). A layer whose experts all sit on the card has no host leg in the pass or the ubatch walk either, and the host run holds no view of it (model::host_run over the other layers), so its stacks need no host kernel; the expert ring and the tier card's block route refuse NVFP4 by name. A format's tensor scale, `<stem>.scale` beside a `<stem>.weight` whose type reads one, takes its tensor's layer in the shared classifier, so no family lists it. gate_qwen4exp_nvfp4 holds the load, the batch set's steps, its pass and its ubatch walk, and D3K's step to the checkpoint's own forward (refset hf-qwen4exp-nvfp4, tools/ref/qwen4exp-nvfp4-oracle.py, whose route ids carry ik's logical twins) by the e2e gate's bands and its reading of the reference's routing, which both gates now take from one file.
…old its positions, reuse the grouped mapping
There was a problem hiding this comment.
Verdict: CLEAN: The remaining dispatch-evidence request is non-blocking.
Non-blocking
⚠ Complete the dispatch proof: crates/gpu/src/arch/qwen3moe/wide38.rs:1164. The prompt route changes format dispatch. The grouped path retains one input quantization per run; each expert batch retains two gate/up GEMMs, one SwiGLU quantization and one down GEMM. Supply the move-class PTX comparison for the existing GGUF path and a same-lease base/head UD-Q4_K_XL A/B under R20. The speed table compares two formats at one head. Establish the regression baseline before another format uses this dispatch.
Checked
Duplicates: Dryer reported zero pairs in model, placement and refset. GPU and GPU-gates were outside its search.
Complexity: Diagnostics report CardRoute38::enqueue rising from 30 to 38. Its changed code adds format dispatch and ring refusals; complexity alone is not a finding.
Dispatch: Compared the cited hunk and enqueue_gemm_batch at base and head. The grouped path preserves the quantization and GEMM call sequence described above. Landing and ring batches can invoke the GEMM sequence more than once per run.
Error paths: CardRoute38::enqueue refuses incompatible route/input forms and unsupported ring combinations before entering the run loop.
Gates: FREE_BAND remains 0.10 and FLIP_ERR_CAP remains 2.0 in shared/q38_oracle.rs, with their existing dated PINs.
Classification: The review rules classify missing change-class performance evidence as a non-blocking request. No escape pattern or ledger lesson changes that classification.
Notes
Validation used source and diff inspection. GPU results are the PR's reported GB10 runs. The PR states that gate_qwen4exp_e2e was built but not run.
Card check: gpu-evidence. This pull request changes crates/gpu-gates/Cargo.toml, crates/gpu-gates/src/bin/gate_qwen4exp_e2e.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)
|
The review is done and the contribution check passed, so I'm merging this. |
Qwen3.8-Flash-Next의 NVIDIA NVFP4 체크포인트를 DGX Spark(GB10) 한 장에서 실행하고, 체크포인트 자체의 순전파 결과와 맞는지 확인하는 게이트를 추가합니다.
Part of #493.
This PR lets bloomery run Qwen3.8-Flash-Next from NVIDIA's NVFP4 checkpoint (
nvidia/Qwen3.8-Flash-Next-NVFP4) on a DGX Spark (GB10), with all 24,576 routed experts on the card. On main, loading the GGUF split thatpreparewrites from this checkpoint stops at144 tensors have no role. With this PR the same split generates text, and a new gate,gate_qwen4exp_nvfp4, passes against a pinned oracle computed from the checkpoint itself.What and why
Running the checkpoint needed four contracts. Each lives in a common owner, so the next NVFP4 model, Qwen3.8 FP4-Local included, at most adds a type to its leg's arm.
.scalerolecrates/model/src/arch/classify.rs,tensor_scale_roleinside the commonclassify_with<stem>.scalebeside a<stem>.weightwhose type reads a scale (GgmlType::reads_scale) is unread and belongs to that tensor's layer. Any other.scalestays unclassified and the file is refused by name. The per-layer embedding scale row inqwen35moe/roles.rsis gone because the common rule now covers it.crates/placement/src/accepts.rs,leg_card_formatqwen35moe/place.rsandcard_routedinplace_hybrid.rscall it instead of namingCardFormat::KQuantthemselves. The Qwen3.8 arm gains NVFP4 gate-up and down entries.crates/gpu/src/card_leg.rs,StackW::route(ty)kernels::gemm: K-quant and i-quant words go through the grouped GEMM; Q8_0, Q5_1 and IQ4_NL blocks and NVFP4 planes go through the 32-value GEMM.StackW::routebuilds the grouped format throughGemmWeight::from_ggml. The ubatch route inwide38.rsand the block route intier38.rscall only this, and their own Qwen3.8 type lists are gone.crate::model::host_runbody38.rspasseshost_runonly the layers that have a host leg, andqwen35moe::host::layersandrouted_layerstake a layer set instead of a range. A layer without a host leg downloads nothing and adds a zero sum (Card38::zero_sumin the pass,hsum.zero_asyncin the walk).The calls that go with these contracts:
card38.rsreads an NVFP4 stack throughWeights::nvfp4_stack. At load,one_gate_up_formdecides one input form for every card layer fromStackW::route(the q8_1 rows or the 32-value rows) and refuses a load that mixes the two, naming both layers. The ubatch route inwide38.rs(RouteX) then holds only that one form, so the plan's existing per-token bound,CARD_ROUTE_RUN_TOKEN_BYTESinqwen35moe/place.rs, covers it. Its comment now says so. A GGUF load allocates the same input rows as on main.gate_qwen4exp_nvfp4is new, with the recipejust gate-gpu-qwen4exp-nvfp4. It reads the refset familyhf-qwen4exp-nvfp4(crates/refset/src/arch/qwen4exp/nvfp4.rs), whichjust dump-ref-qwen4exp-nvfp4writes withtools/ref/qwen4exp-nvfp4-oracle.py: an f32 CPU forward of the checkpoint at revisionfc694b54fb0174e0913e6adf86691ef85a4ead47, on the weights the prepared split holds. The writer emits each int row twice, flat and logical, in lowercasei32, the formcrates/refsetalready reads.--resumecontinues only from state with the same writer md5, checkpoint path and config, transformers model code hash, torch version, arm names, token ids and tap format. Missing or different identity is refused by name before any model computation. The prose input is exactly 3,001 in-vocabulary integers, and its digest comes from the bytes the computation used.qwen4exp::check_inputs(crates/refset/src/arch/qwen4exp/mod.rs) checks the positions of the batch, step4, D1K and D3K sets.gate_qwen4exp_nvfp4calls it for its four manifests before the GPU load, andgate_qwen4exp_e2ecalls it at its manifest and step entry points.gate_qwen4exp_e2eread reference routing and collect route flips through one file,crates/gpu-gates/src/bin/shared/q38_oracle.rs. The bands and their PINs moved there unchanged.Release notes: Added: Qwen3.8-Flash-Next runs from the NVIDIA NVFP4 checkpoint on one card with every routed expert on the card, and
just gate-gpu-qwen4exp-nvfp4checks it against an f32 forward of the checkpoint.Code shape
card_routednow callleg_card_format, the reference routing reader has one home inq38_oracle.rs, the position check has one owner incheck_inputs, and the grouped format conversion incard_leg.rscallsGemmWeight::from_ggmlwhere six local copies stood.StackW::routeandleg_card_format..scalebeside a type that reads no scale, a stack type the GEMM table does not name, a load that mixes the two input forms, and an oracle--resumeor input set that does not match its identity or positions are each refused by name.q38_oracle.rswith the same values and PINs.cargo fmtandcargo clippyare clean on what I touched; the lint count did not go up.Duplication found or removed (
path:line), or "none":crates/gpu-gates/src/bin/gate_qwen4exp_e2e.rsloses its own reference routing reader and its two flip loops, which now live incrates/gpu-gates/src/bin/shared/q38_oracle.rs.CardFormat::KQuantwritten in each leg arm is replaced byleg_card_format(crates/placement/src/accepts.rs:186). The six grouped-format conversions inStackW::routebecome one call toGemmWeight::from_ggml(crates/gpu/src/gemm/grouped.rs:179).What I ran
The PR head is
50d934b6over upstreame3ce40fd. Runs used a DGX Spark (GB10) except the CPU mutants. The accuracy gate, its scale mutant and the route device test ran onb5562dea; the later commit changes only the oracle writer's completion handling, its harness identity and a CPU test, with no device code. The build, the card tests, the card38 mutants, the short generation, the UD-Q4_K_XL comparison and the speed record ran onbf5238fd, and each of those sections names that head. Since thencard_leg.rsgained theGemmWeight::from_ggmlconversion, which the gate and the route test below ran with.Build and device tests
On
bf5238fd, the build ofgenerate_qwen3moe,gate_qwen4exp_nvfp4andgate_qwen4exp_e2eatsm_121: build rc=0, with no warning in a file this PR changes.The card leg's device tests and card38's tests (
card_leg::tests::hw_andcard38::tests::):test result: ok. 11 passed; 0 failed. They includehw_a_stack_routes_by_the_tables_gemm_entryfor the route anda_load_reads_its_card_gate_up_in_one_formfor the one input form.The route device test on
b5562dea:card_leg::tests::hw_a_stack_routes_by_the_tables_gemm_entrygivestest result: ok. 1 passed; 0 failed.Mutants that must fail
On
bf5238fd, two mutants planted incard38.rseach madea_load_reads_its_card_gate_up_in_one_formfail, and the test passes without them:test result: FAILED. 0 passed; 1 failed, rc=101test result: FAILED. 0 passed; 1 failed, rc=101test result: ok. 1 passed; 0 failed, rc=0On
308c579c,cargo test -p bloomery-refset arch::qwen4exp::nvfp4 --libpasses withtest result: ok. 2 passed; 0 failed. Seventeen mutants of the oracle input checks (3 position and unknown-set checks, and 14 set-name guards each skipped) each make the test fail,test result: FAILED. 1 passed; 1 failed, rc=101. With the file restored it passes again, rc=0.On
b5562dea, a mutant inweights.rsuploads every NVFP4 expert scale as zero. The accuracy clauses fail: the free walk (worst l_out_rel 5.140e-1 at layer 0 position 2), (p) and (g) with argmax 279 against oracle 11751, and (t) with argmax 279 against 423. With the file restored, the same gate passes (next section). Removing thecheck_inputscall from the gate makes the input-refusal check fail.Accuracy gate against the checkpoint
The recipe and its output summary, on
b5562dea, with the local refset directory shortened to the family name:Clause (l) checks that every layer holds all 512 experts on the card. The free walk (5 tokens), clause (p) (one pass) and clause (g) (one ubatch) compare each layer and the logits with the oracle. Clause (t) compares position 3,000 of a 3,001-id prompt.
Writing the reference set again with this writer, in three sittings that resumed under one identity, gives 1,546 data files byte-identical to the first set.
sha256sum -cover the family passes.Our argmax token equals the oracle's in the one-pass, one-ubatch and 3,000-id clauses.
Short generation, main and this branch
On
bf5238fd:generate_qwen3moe --prompt "The capital of France is" -n 64 --ctx 4096 --timeon the NVFP4 split:generate_qwen3moe: 144 tensors have no role: blk.0.ffn_down_exps.scale, ..., exit 1 (SHORT-RC main 1)SHORT-RC head 0, 64 tokens,text " Paris. The capital of Germany is Berlin. The capital of Italy is Rome. ...", decodep50_ms=32.6501The existing UD-Q4_K_XL path is unchanged
On
bf5238fd,generate_qwen3moebuilt from main and from this branch, greedy, 64 tokens each, on the UD-Q4_K_XL GGUF. On GB10 that file also puts every routed expert on the card, so it goes through the new host-load path.IDS-EQUAL batch,PLAN-EQUAL batchIDS-EQUAL prose2k,PLAN-EQUAL prose2k, and a second run of each binary gives the same ids (IDS-REPEAT-EQUAL prose2k)The only records that differ are main's four
load host_tier type=... path=fusedlines (q4_K,q5_1,q5_K,q8_0). This branch builds no host view for layers that have no host leg.Speed (recorded, not a verdict)
bloomery-servefrom this branch atbf5238fd, one server per file in one lease, prose-en prompts, greedy, draft off, 512 generated tokens. Each cell is one request without repeats, so the table is a record of this run only.Hardware
A DGX Spark (GB10). The builds, the gate and the
generate_qwen3moeruns used the CUDA 13.3.1 container.nvidia-smiin the gate job:GPU: NVIDIA GB10, driver 595.84, CUDA 13.3
Models:
nvidia/Qwen3.8-Flash-Next-NVFP4at revisionfc694b54fb0174e0913e6adf86691ef85a4ead47, split byprepareinto four GGUF shards; first shard sha256513302fc64c400279d1ba3d5a86211a0dbe65dddc8c5e16c3516a0970d9a09b3.Qwen3.8-Flash-NextUD-Q4_K_XL GGUF at revision766911a6b7369840a91dbcd95f9f997acaab6cd6; first shard sha2564448186216b3af4cc558bbce2c3213f01608f8f8b2e5267a9767971dd3ec8082.What I ran into
None of this blocks the PR.
nvidia/Qwen3.8-Flash-Next-FP4-Local(revisionb9ce18a6),generate_qwen3moe -n 16:144 tensors have no role. With this branch it generates 16 tokens:[11751, 13, 561, 6511, 314, 9564, 369, 19241, 13, 561, 6511, 314, 14898, 369, 21047, 13], the same as the first 16 of the NVFP4 split.144 tensors have no role. With this branch it gets through classification and the plan (host_experts=0 card_experts=24576), then Body38 refuses it:mxfp8 attention matrices (the body reads q8_0). Body38 reads MXFP8 dense weights in a later PR.site::gemm,site::gated) still refuses NVFP4. A later PR extendsStackW::routeand the tablekernels::gemmto it. The points it changes:crates/gpu/src/site.rs:796:site::gemmreturnsno_wide_gemmforSiteTy::Nvfp4crates/gpu/src/site.rs:929:Gated::checkrefuses NVFP4crates/gpu/src/site.rs:168:SiteTy::reads, one input form per typecrates/gpu/src/site.rs:256:site::siteknowsDevWeight::Nvfp4but notDevWeight::Nvfp4Stackcrates/placement/src/kernels.rs:265:SiteEntry::readscrates/gpu/src/arch/qwen3moe/wide.rs:1398(slots_gemm) and:1442(slot_site)gate_qwen4exp_e2ewas built but not run here, because its reference set and fixture are not on this machine. The reference routing code it now shares runs ingate_qwen4exp_nvfp4above.AI help
AI 코딩 에이전트가 코드를 작성한 후 설명을 썼고, 테스트를 마쳤습니다. diff 리뷰와 PR 초안 리뷰는 제가 직접 했습니다.