Repository navigation
gpu, placement, qwen38: every dense site of the wide walk runs its wide GEMM, its rows holding only the forms their sites read - #1080
Conversation
…de GEMM, its rows holding only the forms their sites read A K-quant site reads the rows' q8_1 blocks of 128 on the grouped GEMM and an NVFP4 site the q8 blocks of 32 on the 32-value GEMM, one launch a projection in place of the by-name chunks of eight columns; the shared expert's three sites go through site::gated whatever their types. site::DenseActs holds a wide input's q8_1 blocks only when a K-quant site reads them, its q8 blocks of 32 only when a Q8_0, Q5_0 or NVFP4 site does, and room for the MMA forms its sites copy. placement::kernels::wide_act_bytes is the one rule of those bytes; PlanInputs::stack counts them by the file's dense types and a machine holds them beside the ubatch walk's other rows.
…; the product epilogues refuse a SiLU gate by name NormGateArgs and NormGateTail carry a GdnGate (SiLU for Qwen3.5/3.6, sigmoid for Qwen3.8 and KDA), one enqueue_norm_gate picks the entry by it, and site::resident_gemm_norm_gate runs a SiLU-gated norm apart from the product, so a SiLU-gated model's z projection reads the same common site.
A dense site whose consumer reads BF16 rows (the delta layer's qkv, the attention projections) took an F32 product and a separate conversion on every arm except BF16 and native NVFP4. The Q8_0 plane (and its slab entry), the five K-quant types a dense site reads and the Q8 NVFP4 entry now each have a BF16 twin that differs only in the output type; the store and the refused-NaN store of both GEMM families go through one cell rule (f32tile::ProductCell: the identity for f32, round to nearest even for u16), so the three families share one epilogue. GemmKernels::enqueue_gemm_bf16 and Gemm32Kernels::enqueue_gemm32_bf16 launch them; another weight type is refused by name. site::gemm takes the BF16 output on every one of these arms. gate_gemm checks each BF16 store against the F32 product of the same weights and columns rounded to nearest even, with the guard past the cells untouched: bf16_store over a synthetic stack of each K-quant type (IQ3_XXS refused by name), the Q8_0 plane and slab entries in g32_slab, and the Q8 NVFP4 product in nvfp4_native, which previously required it to be refused. The model-free cases run under their own filters.
…aunch On a site without a product epilogue, the gated norm wrote its f32 rows and a second launch quantized them for the output projection. The norm now has two entries that also store each token's row in the form its readers take: gdn_norm_gate_q32 (q8 blocks of 32, one head a group of four blocks, act32::quant32_group) and gdn_norm_gate_q128 (q8_1 blocks of 128, one head a block, q8_1_quant_vals), under either gate. The warp gathers its values into the quantizers' lane geometry, so the bytes, refusals and fault are those of the quantizer over the stored row. NormGateKernels::enqueue_norm_gate_into takes the form (NormOut); site::resident_gemm_norm_gate uses it when the readers take one q8 form and no MMA or native FP4 form, and keeps the norm then resident_quantize otherwise. gate_gemm norm_form: the rows and both forms bit-equal to the norm then the quantizer under SiLU and sigmoid at 1, 9 and 512 tokens, and a head holding a NaN refused alike with the fault raised.
There was a problem hiding this comment.
Verdict: CLEAN: No must-fix findings remain.
Non-blocking
⚠ Complete the numeric-change evidence: crates/gpu/src/arch/qwen3moe/wide38.rs:2460.
K-quant q/k/v now reach the BF16 product store before convolution. The precision-change class requires an owning e2e count pin and timed A/B evidence. The PR provides gate summaries, timing tables and a server startup command, but omits the measurement commands and their output. Attach those logs, the model file paths and the raw nvidia-smi line, and identify how the tested commits correspond to this head. This makes the reported token divergence and speed comparison independently assessable.
Checked
Confirmed the removed q8_1 bypass in wide38.rs and traced resident_gemm_bf16 through the K-quant BF16 dispatch in site.rs to its convolution consumer. Checked the evidence request against the base contracts and PR body. The reviewer instructions classify missing performance proof as non-blocking. No escape-catalog pattern or ledger lesson applies to this finding.
Notes
Static validation only; no Rust build or GPU gate run. The reported measurements were not independently reproduced.
Card check: needs-gpu. This pull request changes crates/gpu-gates/src/bin/gate_gemm.rs, crates/gpu-gates/src/bin/gate_linear.rs, crates/gpu-gates/src/bin/gate_nvtier.rs … and carries no gate run on a card (CONTRIBUTING's evidence list); a maintainer adds gpu-verified after one.
🔨 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. |
|
After this PR, This is the case your (AI 코딩 에이전트가 작성한 코멘트이며, 내용은 제가 확인했습니다.) |
|
@midagedev Thanks for catching this. It is ours: the recorded budget in the q38dense header still comes from (AI 코딩 에이전트가 작성한 코멘트이며, 내용은 제가 확인했습니다.) |
|
The fix is up in #1093. The recorded card budget in the Qwen fixture now plans with the load's own activation stack, so q38dense holds 256 routed experts a layer again ( The five q38dense sets are regenerated with the (AI 코딩 에이전트가 작성한 코멘트이며, 내용은 제가 확인했습니다.) |
Qwen3.8 전용으로 남아 있던 dense site 처리(형식별 chunk 경로, activation 형식 선택, norm gate 선택)를 공용 owner로 옮겼습니다. 다음 모델은 이 코드를 따로 쓰지 않아도 되며, 판정 arm에서 손실은 없습니다.
What and why
The Qwen3.8 wide prefill walk carried its own code for the dense sites. It had a by-name chunk path for K-quant and NVFP4 projections in
wide38.rs, withact_with,project_chunks,reads_q8_1andwide_in. Its inputs held every quantized form whatever the sites read, and a sigmoid-only norm entry served it. The next model with dense sites on GGUF, NVFP4 or FP4-Local files would have had to write the same again. This PR moves each piece into a shared owner, so a new model's walk calls these owners and writes none of it:site::gemm, whatever its type. A K-quant site reads q8_1 blocks of 128 on the grouped GEMM, and an NVFP4 site reads q8 blocks of 32 on the 32-value GEMM. The shared expert goes throughsite::gated. The chunk path inwide38.rsis removed, and so is the ubatch arena's by-name state that served it.site::DenseActsandsite::resident_wantshold only the forms the sites read. The load and the plan count the same bytes through one rule,placement::kernels::wide_act_bytes, which readskernels::attention::Forms, reached throughPlanInputs::stack().place_hybridand the Nemotron-H plan now callgemm_act32_bytes, which replaces their own copies of the formula.GdnGate). Qwen3.6 uses SiLU; Qwen3.8 and GLM-5.3-Flash KDA use sigmoid. That replaces the per-gate entryenqueue_norm_gate_sigmoid. The BF16 and MXFP8 product epilogues finish only a sigmoid-gated norm, so they refuse SiLU by name.f32tile::ProductCell: the identity for f32, round to nearest even for BF16). Every format's q/k/v now gets the BF16 rows that only FP4-Local had.gdn_norm_gate_q32,gdn_norm_gate_q128). It calls the existingnorm_gate_bodyand quantizer cores after a warp gather, so the bytes, refusals and fault are the quantizer's.The grouped and 32-value GEMMs keep their own sum order. A K-quant or NVFP4 prompt column is therefore no longer bit for bit the decode step's one-column launch. The prompt matches the decode within the e2e gate's bands, as the FP4-Local path already did. The plan of a real file counts its own forms. The recorded fixture budget and the
qwen4exp_metapins keep the q8-32 count they were recorded with, named asStack::q8_blocks32.No arm of the A/B loses (table in What I ran). UD-Q4_K_XL prefill also moved +1.49%, and TTFT p95 moved +1.46%, at C=1.
Release notes: Under the hood: the dense sites of the Qwen3.8 prompt walk run through shared owners for every file format, with no speed loss.
Code shape
norm_gate_bodyand the existing quantizer cores (act32::quant32_group,q8_1_quant_vals). The form byte rule has one owner,placement::kernels, whichmodel::fit,place,place_hybridand the Nemotron-H plan read. The Q8_0 plane checks are one helper,Gemm32Kernels::q8_0p_entry.plan38::GDN_GATE).wide38.rslost its chunked fallback.act_with,project_chunks,reads_q8_1,wide_inand theByNameuse inwide38.rs, andenqueue_norm_gate_sigmoid, are removed.UBATCH_TOKEN_BYTESmoves from 120,889 to 109,209 with aPIN; the 11,680 B left the arena for the counted forms. The unsafe ratchet adds the norm entries' blocks with aPIN. The new PTX shape rows carry aPIN.cargo fmtandcargo clippyare clean on what I touched; the lint count did not go up.Duplication found or removed (
path:line), or "none": the chunked by-name fallback incrates/gpu/src/arch/qwen3moe/wide38.rs(removed); the two norm-gate entries per gate incrates/gpu/src/linear/norm_gate.rs(now one enqueue dispatching on the gate).What I ran
Every check ran on a DGX Spark. The gate runs print this line from
nvidia-smi --query-gpu=name,driver_version,compute_cap --format=csv,noheader:bash tools/arch.shprintssm_121a, and the toolkit is CUDA 13.3. Each block below names the commit it ran on; all of them are commits of this branch.FAIL-first, on head
a574ed15a, with the BF16 cell rule truncating instead of rounding and the norm's q8 words written without the lane gather:All three cases exit 1.
bf16_storeprints 10 FAIL lines (every dense K-quant line),g32_slab6 andnorm_form8. The first of each:Gates on head
a574ed15a(base6791d577b), aftergit checkoutof the two files and a rebuild ofgate_gemm:bf16_storechecks the five dense K-quant types at 7 and 300 columns: each BF16 row equals the F32 store rounded to nearest even, bit for bit. IQ3_XXS has no BF16 entry and is refused by name.g32_slabpasses 13 lines andnvfp4_native51, with no FAIL line; everynvfp4_nativeline hasbf16_eq=true.zgatepasses 28 lines. The output (theptx-spilllist of nonzero entries is cut here):The Qwen3.8 e2e gate also ran on head
993bf33df(base28bc0af4b). Its forced arm holds the stores and the last logits within their bands:norm_formalso ran on commite4856df2, which holds this change. Its last line is the native FP4 form, refused by name with the output kept:Host tests on head
a574ed15a:bloomery-placementlib (225 passed, includinga_wide_input_holds_the_forms_its_readers_read),bloomery-modelarch::qwen35moe(112 passed),bloomery-gpulibsite wide38 norm_gate act32(22 passed).The user-facing binary on head
a574ed15a, built with the release feature set and started on each of the three Qwen3.8 files:UD-Q4_K_XL loaded in 20.4 s, NVFP4 in 23.9 s and FP4-Local in 16.9 s. All three answered the short prompt with
' Paris. The capital of Germany is Berlin. ...'. Each also answered a 4,701-token prompt (160 numbered copies of one sentence and a request to summarize them,n_predict48) coherently.Speed, TP=1, P=4096, K=128, three rounds per side on one GB10, base and head built and timed in the same run. The A/B runs print:
Each side is built in its own checkout (
baseorhead):The server for the C=1 arms, with
MODELset to the UD-Q4_K_XL first shard, the NVFP4 folder or the FP4-Local folder (Hardware below), and for the FP4-Local MTP C=2 arm:Each request is a streamed
POST /completionwhose prompt is 4,096 token ids from a fixed window of a token-id corpus (code-fn, SHA-2567520b471436fb307e91ee22640ad8100701d48e63e3da7de9160b705b92915d1; prose-en,d10c7044df8884fdd200304604772d81a4b56a228f802d5f05db724b245ef77a):{"prompt": [4096 token ids], "n_predict": 128, "cache_prompt": false, "stream": true, "timings_per_token": true, "return_tokens": true, "temperature": 0, "top_k": 1}The C=1 arms send one request at a time on code-fn. The C=2 arm sends two at once on code-fn and on prose-en, with
"temperature": 0.7and seed 42 for the first request and 43 for the second. Prefill and decode tok/s come from the server's timings, and TTFT p95 and total tok/s from the client clock. Each cell is the median of the three rounds, with their range in parentheses. A positive change is faster for every metric, TTFT included.C=1, head
a574ed15aagainst base6791d577b:FP4-Local MTP C=2, head
dd1ad10e9against base1397a0baf:The C=2 arm is sampled and this PR does not change the decode step, so I do not count its decode rows as a gain. Greedy UD-Q4_K_XL output first differs at token 42 of one request. The likely cause is the BF16 qkv rows that GGUF now shares with FP4-Local; the e2e gate holds its bands.
Hardware (if the change is for a machine)
NVIDIA GB10 (DGX Spark), driver 595.84, CUDA 13.3, arch sm_121a. Models:
UD-Q4_K_XL/Qwen3.8-Flash-Next-UD-Q4_K_XL-00001-of-00004.gguf(SHA-2564448186216b3af4cc558bbce2c3213f01608f8f8b2e5267a9767971dd3ec8082)AI help
AI 코딩 에이전트가 코드를 작성한 후 설명을 썼고, 테스트를 마쳤습니다. diff 리뷰와 PR 초안 리뷰는 제가 직접 했습니다.