Skip to content

gpu, qwen38: a pass of one row a slot steps each delta state in place, so its commit replays nothing - #1104

Merged
juliankang4 merged 1 commit into
midagedev:mainfrom
juliankang4:dgx-spark-q38-spd-gdn-inplace
Nov 1, 2026
Merged

juliankang4 merged 1 commit into
midagedev:mainfrom
juliankang4:dgx-spark-q38-spd-gdn-inplace

Conversation

@juliankang4

Copy link
Copy Markdown
Collaborator

Qwen3.8에서 슬롯마다 한 행씩 도는 패스가 delta 상태를 제자리에서 갱신하게 해서, 커밋 때 다시 돌리는 replay를 없앴습니다.

What and why

A Qwen3.8 pass over several slots ran every GDN layer as a verify: each row's update went to a record beside the state, and each slot's commit then launched gdn_delta_recovery_layers to replay the kept rows into the lane. When every slot holds one row, the commit always keeps that row, so the record and the replay carry no information.

This change runs such a pass in place. model::slots::kept_whole names the rule (every slot holds one row), Body38 skips the record for that pass, and the new gdn_delta_lanes_seqs entry steps each stamped lane directly. A pass with a slot of several rows (an MTP drafted verify) records and replays as before. The timed A/B below shows no gain with ranges apart on every arm that the change reaches, so this PR makes no speed claim.

Release notes: Under the hood: a Qwen3.8 pass of one row a slot no longer records and replays its delta state; the commit has nothing left to replay.

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), or "none": none. linear::delta::enqueue_delta_seqs now takes a stamped sequence with or without its record and one launch kind per call, and refuses mixed kinds by name. gdn_delta_lanes_seqs and gdn_delta_recovery_seqs share one block body (lanes_seqs_block::<RECOVERY>, crates/gpu/src/linear/delta.rs); each entry is its launch contract plus one call. The unsafe pin in tools/unsafe-ratchet.txt moves from 2957/404 to 2959/405 for the new entry's block and the shared unsafe fn, and gdn_delta_lanes_seqs has rows in tools/ref/ptx-shapes.tsv and the per-arch tables.

What I ran

PR base 990a5ccc8297f632a0e06552ee2a277e23af6fa4, PR head db900b6732c76756cff3351ecceed9926236c349.

Clippy ratchet lint (the aarch64 form of tools/mac-check.sh lint, run on the PR head):

chain-clippy: lint rc 0 (^warning: 0, the ratchet 0 in tools/lint-ratchet.txt)

DGX Spark

$ nvidia-smi
Sun Nov  1 19:28:54 2026       
+-----------------------------------------------------------------------------------------+
| NVIDIA-SMI 595.84                 Driver Version: 595.84         CUDA Version: 13.3     |
+-----------------------------------------+------------------------+----------------------+
| 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 GB10                    On  |   0000000F:01:00.0 Off |                  N/A |
| N/A   50C    P8              4W /  N/A  | Not Supported          |      0%      Default |
|                                         |                        |                  N/A |
+-----------------------------------------+------------------------+----------------------+

+-----------------------------------------------------------------------------------------+
| Processes:                                                                              |
|  GPU   GI   CI              PID   Type   Process name                        GPU Memory |
|        ID   ID                                                               Usage      |
|=========================================================================================|
|  No running processes found                                                             |
+-----------------------------------------------------------------------------------------+
$ nvidia-smi --query-gpu=name,driver_version --format=csv,noheader
NVIDIA GB10, 595.84
$ export BLOOMERY_ARCH=sm_121a BLOOMERY_BOX_LOCAL=1 BLOOMERY_BOX_CARD=local
$ just ptx-compare 990a5ccc8297f632a0e06552ee2a277e23af6fa4 generate_ds41 --features gpu,deepseek41
  base entries  526
  head entries  527
  added         1: gdn_delta_lanes_seqs
  removed       none
  changed       1: gdn_delta_recovery_seqs (ptx-scan-md5:18aeb978->eb0dc551)
$ just gate-gpu-linear
GATE gate-gpu-linear rc=0 PASSLINES 246 FAILLINES 0
gate_linear: 196 clauses, 0 failed — PASS
$ just gate-ptx-spill
GATE gate-ptx-spill rc=0 PASSLINES 2 FAILLINES 0
$ BLOOMERY_TIER=fixture just gate-gpu-qwen4exp-e2e
GATE gate-gpu-qwen4exp-e2e tier=fixture rc=0 PASSLINES 190 FAILLINES 0
$ BLOOMERY_TIER=fixture just gate-gpu-qwen4exp-mtp
GATE gate-gpu-qwen4exp-mtp tier=fixture rc=0 PASSLINES 172 FAILLINES 0
$ BLOOMERY_TIER=fixture just gate-gpu-qwen38-serve
GATE gate-gpu-qwen38-serve tier=fixture rc=0 PASSLINES 141 FAILLINES 0

gdn_delta_recovery_seqs changed only because its body moved into the shared block; its row in the sm_121a table keeps 0 spill and 0 JIT local bytes, and the spill check passes against the pinned rows. The new gdn_delta_lanes_seqs row also reads 0 spill and 0 JIT local bytes.

The slots clauses of gate_qwen4exp_e2e run the new path (passes of one row a slot against each stream's solo run):

check slots H1 interleave: 8 interleaved steps a slot against each stream's solo run: every slot's ids, last logits, state hash and position bit for bit PASS
check slots H2 one pass: 4 passes of one row a slot (2 captured, the rest eager) against each stream's solo run: every slot's ids, last logits, state hash and position bit for bit
slots rollback isolation: slot 1's verify committed 2 of its 4 rows; slot 0's next 4 ids equal its solo run's continuation PASS

RTX 5090 machine

$ nvidia-smi
Mon Nov  2 05:41:04 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%   39C    P8              9W /  400W |       2MiB /  32607MiB |      0%      Default |
|                                         |                        |                  N/A |
+-----------------------------------------+------------------------+----------------------+

+-----------------------------------------------------------------------------------------+
| Processes:                                                                              |
|  GPU   GI   CI              PID   Type   Process name                        GPU Memory |
|        ID   ID                                                               Usage      |
|=========================================================================================|
|  No running processes found                                                             |
+-----------------------------------------------------------------------------------------+
$ nvidia-smi --query-gpu=name,driver_version --format=csv,noheader
NVIDIA GeForce RTX 5090, 595.99.02

Model: lmstudio-community/Qwen3.6-35B-A3B-GGUF at revision 68a34855558af61cbef0324d31f411be8a506b08, Qwen3.6-35B-A3B-Q4_K_M.gguf, SHA-256 4ac6a06bce551257267f49ad2226f8671a22519ccc1a4dde9d5b433d1f2a410d.

$ BLOOMERY_BOX_LOCAL=1 just gate-gpu-qwen35moe-e2e
GATE gate-gpu-qwen35moe-e2e rc=0 PASSLINES 41 FAILLINES 0
gpu-gate.sh: gate_qwen35moe_e2e ran 34 s (exit 0)
check slots H2 one pass: 5 passes of one row a slot (3 captured, the rest eager) against each stream's solo run: every slot's ids, last logits, state hash and position bit for bit

A/B on GB10 (Qwen3.8, 2 slots)

$ nvidia-smi
Sun Nov  1 20:26:01 2026       
+-----------------------------------------------------------------------------------------+
| NVIDIA-SMI 595.84                 Driver Version: 595.84         CUDA Version: 13.3     |
+-----------------------------------------+------------------------+----------------------+
| 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 GB10                    On  |   0000000F:01:00.0 Off |                  N/A |
| N/A   48C    P8              4W /  N/A  | Not Supported          |      0%      Default |
|                                         |                        |                  N/A |
+-----------------------------------------+------------------------+----------------------+

+-----------------------------------------------------------------------------------------+
| Processes:                                                                              |
|  GPU   GI   CI              PID   Type   Process name                        GPU Memory |
|        ID   ID                                                               Usage      |
|=========================================================================================|
|  No running processes found                                                             |
+-----------------------------------------------------------------------------------------+
$ nvidia-smi --query-gpu=name,driver_version --format=csv,noheader
NVIDIA GB10, 595.84

Model: nvidia/Qwen3.8-Flash-Next-FP4-Local at revision b9ce18a6887e18c089fdea8509a33e63429a3300 (MODEL_FP4L), SHA-256 of each file:

b0ad2a8a314ca96618e21e40d50c0af6e181e6060f9cdd1996c7074d19284c1a  README.md
c3cf9e34abf4f9e36c2d72165aa9c132d3e2a725b6c2586aaa3a8af9d7a81041  chat_template.jinja
b50dbc52a0c83b0cd2a44a372c1fb6b5e0e6827d22f2611c97d4d030f92f6b28  config.json
e70c136c1b78ddc1fb0905bac8e733a4dc448d4f852a5dd75143fffc70be550e  generation_config.json
a9d356d7bdf1ef4949e3e748e95b8e10ad9d4e2e838eddc38a0a7b6b94d1db8d  merges.txt
5fa166bbb1cf25adda455117563efa72a2072272001f459eedece131ffc913e1  model.safetensors.index.json
27225450ac9c6529872ee1924fcb0962ff5634834f817040f444118116f4e516  preprocessor_config.json
ebf3648c5f4cd1f24e79789e7803498dc4e74cb52515cc515b2d22cf8161953b  tensors/model-00001-of-00021.safetensors
79a643fc5c024089cecd32ca27dc43e671cbec70ff3628b728909b7656ac43ec  tensors/model-00002-of-00021.safetensors
c45f942203db4c7f5a1071700b93b908495cc790271acddfff39091c2b953923  tensors/model-00003-of-00021.safetensors
071ab9cf963ca0f1a6a194b4cec485f5de18ef9804da915b2e6abd0eb0c707af  tensors/model-00004-of-00021.safetensors
f80d17870eb1d36917257494770984953476583c57737f61fdbd341c957b9715  tensors/model-00005-of-00021.safetensors
3e9183d4ebb267fa92429184d5132d302cb1a98fd049149e5d01dccd4ca65795  tensors/model-00006-of-00021.safetensors
aa1ad959c4d62e0bc4600fd0b57cc2939b463e9fb53dc01020e188552b52ce5a  tensors/model-00007-of-00021.safetensors
0b18844027be74b84b240f23bf3a744bc29b35de0bd384f41c40cd85e6339326  tensors/model-00008-of-00021.safetensors
2d0b6c66790c17f8b1fdcf442f541778c8f0a381aca26c11b9d7cfcf7c96f2f0  tensors/model-00009-of-00021.safetensors
3ed9bd73745aebf6dc136f437b67d6b9fc3d38d25ad84300b399164bc87a72b7  tensors/model-00010-of-00021.safetensors
4936ff28c6cc8b66653ddb9cae28bc284569a1a2f7116819a017dc1a0e517ed8  tensors/model-00011-of-00021.safetensors
dd7df5a6ff73e9960412243f744eab9ec35f4be40da5bb158dc4ba8796b33742  tensors/model-00012-of-00021.safetensors
28a455c8ea4ebaa847fb4cbed2bc1de9eff0b501dd3f848a3a3cfc38778e8500  tensors/model-00013-of-00021.safetensors
6941676e685abf9817d9c48a17fdeda20b2b72d16217555252aa4c602b7f98b8  tensors/model-00014-of-00021.safetensors
2a1129b5acfc24a45bf402aa63dcef08b531aedfdaf5233c65fd3d12dc303fdd  tensors/model-00015-of-00021.safetensors
635e97fbad78fa988647d407e2b58e55d551ef94d798c9b6fb5550de25e86429  tensors/model-00016-of-00021.safetensors
bf60d564d89a805b67f8be5f2847a1b1567a70dbc23d19754395c127568474ad  tensors/model-00017-of-00021.safetensors
c5bde22f9364e82eb25973456795592fdcb4b158bc2095898979a2566bf4c562  tensors/model-00018-of-00021.safetensors
da3dc3b4f428f5b9dd53362691043d0242f48d03adca9b7b553bd9f3a1e96350  tensors/model-00019-of-00021.safetensors
4978bb6b8480cfc02d3c8bc84ba86202889f5f10d090bb17c21fee663cea7683  tensors/model-00020-of-00021.safetensors
48203838f2c76921bddbf1cc51d20a23858c128821a21add55fa1778e5e25283  tensors/model-00021-of-00021.safetensors
0997f410c57a1f4e53b09e4be8f4a172d90edd9564368fb0847030937229b9f3  tokenizer.json
b11349aafa7cdc6a320767cf7ceb29ed82f7eda5d65e8e0819e76f0ce947bf27  tokenizer_config.json
7768af27c1fafa9cc9011c1dc20067e03f8915e03b63504550e11d5066986d13  video_preprocessor_config.json
ce99b4cb2983d118806ce0a8b777a35b093e2000a503ebde25853284c9dfa003  vocab.json

Base is upstream main 39ed53b875a0811cdaf587dd19963da24a650c48, built with cargo oxide build --arch "$(bash tools/arch.sh)" -- -p bloomery-gpu-gates --features glm5next,clef,vision,mimo2,solar2,minimaxm3,flint,gemma-embedding2,hf,checkpoint --release --bin bloomery-serve; the head build uses the same command. Each arm serves with --parallel 2 --ctx-size 16896 and takes two concurrent 4096-token prompts with 128 generated tokens, temperature 0.7, seed 42, eight prompt windows (code-fn, and prose-en for the MTP arm), three rounds per side in the order base, head, head, base, base, head:

$ env BLOOMERY_DRAFT=off BLOOMERY_HOST_ROOM=96G ./base/target/release/bloomery-serve -m "${MODEL_FP4L}" --host 127.0.0.1 --port 18731 --parallel 2 --ctx-size 16896
$ env -u BLOOMERY_MTP_DRAFT BLOOMERY_DRAFT=mtp BLOOMERY_HOST_ROOM=96G BLOOMERY_MTP_WIDTH=cost ./base/target/release/bloomery-serve -m "${MODEL_FP4L}" --host 127.0.0.1 --port 18731 --parallel 2 --ctx-size 16896
$ python3 tools/sitting/client.py load --port 18731 --ids "${CODE_IDS}" --prompt-len 4096 --n-predict 128 --count 2 --conc 2 --offset 0 --bound 0 --label fp4l-off-c2s-lead-in --temperature 0.7 --out fp4l-off-c2s-lead-in-timed-code-fn-client.jsonl --seed 42 --window-plan sitting-windows.json --eos-shift 1024

(The head arms start ./head/target/release/bloomery-serve with the same arguments; the client line repeats at offsets 0, 50000, ... 350000 for each corpus.)

Metric (arm, corpus) Base Head Difference Ranges overlap
fp4l-off-c2s code-fn decode tok/s 22.41 22.73 +1.42% no
fp4l-off-c2s code-fn total tok/s 38.85 39.38 +1.34% no
fp4l-mtp-c2s code-fn decode tok/s 32.10 32.02 -0.23% yes
fp4l-mtp-c2s code-fn total tok/s 47.19 47.43 +0.52% yes
fp4l-mtp-c2s prose-en decode tok/s 25.56 26.41 +3.35% yes
fp4l-mtp-c2s prose-en total tok/s 41.48 40.90 -1.39% yes

Medians of three rounds. The result is no gain and no regression on any arm; the plain arm differences are +1.42% and +1.34% with the ranges apart, and the PR makes no speed claim.

Hardware (if the change is for a machine)

Machine GPU Driver CUDA
DGX Spark NVIDIA GB10 595.84 13.3
RTX 5090 machine NVIDIA GeForce RTX 5090 595.99.02 13.2

AI help

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

…, so its commit replays nothing

A pass of several slots ran every delta layer as a verify: each row's
update recorded beside the state, then each slot's commit replayed its
kept rows into the lane in one eager launch after the readback. A pass
whose every slot holds one row is kept whole by every commit (row 0
always; model::slots::kept_whole), so it now writes each slot's state in
place as the slot's step does, and its commit settles the waiting verify
without the replay. The row counts alone decide, so one capture of the
slots and counts still serves step_slots and verify_slots.

linear::delta gains gdn_delta_lanes_seqs, gdn_delta_lanes' in-place step
over several sequences' stamped lanes after their carries, one launch for
every slot as gdn_delta_recovery_seqs is; both entries now share one
block body. enqueue_delta_seqs takes a stamped sequence with or without
its record, and refuses sequences of two kinds by name. A pass with a
slot of several rows (a drafted verify) records as before.
@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 tools Tools, recipes, CI and the toolchain: tools/, justfile, .github/, Cargo 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 defect remains in the reviewed changes; one-row commits retain their row and mixed-row passes retain recovery.

Non-blocking

⚠ Supply the moved entry's codegen proof: crates/gpu/src/linear/delta.rs:1466.
The PR reports a changed PTX hash for gdn_delta_recovery_seqs after extraction. Zero spill and local bytes do not establish the move/split class's program equality.
Attach canonical PTX comparison and equal resource columns for this entry at the reviewed revisions. This separates a body move from a codegen change before merge.

Checked

Duplicates: 6 new or replacement items checked; no duplicate owner found. The dryer pair consists of two entry wrappers sharing lanes_seqs_block.

Complexity: enqueue_delta_seqs 28→35 adds mode validation and a launch arm. Crapper also reports mtp_chain_slots at 17; that definition is outside the supplied diff hunks.

Silent failure: 3 sentinel/default sites followed: empty sequence selection reaches a named table error; absent carry and record select explicit modes. Stamp, lane and numeric faults still reach token readback.

Tests: none added or changed. Existing H2 compares slot ids, logits, state hashes and positions with solo runs. GPU gates and mutations were not executed here.

Gates: no existing tolerance relaxed; the unsafe-count increase has a dated PIN and reason. New spill rows retain zero limits.

Adversarial checks: zero-row keeps are refused; mixed row counts record every slot; captured and eager passes derive their mode from the same row counts; carry positions prevent applying a carry twice.

Escape catalog: none of C1–C4 match the changes.

Notes

The body includes card, model, commit hashes and gate output. Those runs name head db900b6, while the supplied review head is 463bbc4; current-head gate evidence is not included.

Card check: gpu-evidence. This pull request changes crates/gpu/src/arch/qwen3moe/body35_slots.rs, crates/gpu/src/arch/qwen3moe/body38.rs, crates/gpu/src/arch/qwen3moe/program38.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.

@juliankang4
juliankang4 merged commit 55e23f1 into midagedev:main Nov 1, 2026
7 checks passed
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 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