Skip to content

docs: sparkdec.md §9 gives the cc 12.1 JIT's registers and blocks per SM for the eight decode entries; gate_up and o_resid fit 4 blocks per SM, not 5 - #70

Merged
midagedev merged 1 commit into
midagedev:mainfrom
juliankang4:dgx-spark-doc-sparkdec-occ
Oct 12, 2026

Conversation

@juliankang4

Copy link
Copy Markdown
Collaborator

What and why

Open term 3 of docs/research/sparkdec.md §9 asks for the registers the cc 12.1 JIT gives the decode entries. #17 comment 6117957831 measured them, and your reply asked for the table to be folded into §9. This adds the table under term 3 and corrects in place the terms derived from the sm_86 scan's 5 blocks per SM, since two plain entries fit 4 on a Spark; no measured number and no lever's Δ changes.

What changes

The table gives registers and blocks per SM of the eight entries from §1, for the plain entries and for the _prefetch entries that main launches on an integrated device. Two plain entries fit at most 4 blocks per SM, not 5: qwen3moe_gate_up_swiglu_q4k (62 registers) and qwen3moe_o_resid_q4k (59). In the _prefetch entries q4k_gemv_sel also drops to 4 (64 registers). Blocks per SM is what cuOccupancyMaxActiveBlocksPerMultiprocessor returns: the most blocks of that size that fit on one SM, not a count taken from a running kernel. The build §2 timed (04d0c0ae) gives the plain column's values, so no measured number in §2 moves. The term also said seven entries, and §1 lists eight, so it now says eight.

The corrected terms, all [derived] from the table and listed in §9 term 3:

  • Verdict, row 1c (line 13): o_resid_q4k's 256 blocks sit on 192 slots, not 240. The Δ cell keeps −0.07 ms and now says it holds if the regrid removes the whole tail (§4.3).
  • §1 (lines 38 and 43 to 49): the [unverified] note on the JIT's allocation and the [cited; ... confirm with cuDeviceGetAttribute on the Spark] flag on the per-SM limits are replaced by the reading (1536 threads, 65536 registers, 102400 B of shared memory per SM, 48 SMs, the same on two Sparks). "The static blocks per SM carry over" now names the two plain entries that do not, and q4k_gemv_sel_prefetch.
  • §2 (lines 60 and 64, and a note at 70 to 72): the waves column has gate_up_swiglu_q4k at 3.00 on GB10, not 2.40, and o_resid_q4k at 1.33, not 1.07. The note says which blocks per SM the column uses, and that gate_up_swiglu_q4k's 3.00 waves are all full, so in this model its 2.89 µs tail is not a partial-wave tail; a kernel in whole waves still has a tail.
  • §4.2 (line 137): the router's registers under the JIT are 48, not 47. It stays at 5 blocks per SM, so the 240 slots and the 17-block second wave stand.
  • §4.3 (lines 189 to 197): the second wave of o_resid_q4k is 64 blocks, not 16. Its 512 warps hold 128 to 576 B each a round, about 66 to 295 KB, against the 118 to 353 KB of §5.1. The old reason for the tail (up to 74 KB, under the need at every latency) no longer holds, and the new count alone cannot say whether the wave is short of bytes, so the paragraph now gives the tail's cause as [unverified]. The −0.07 ms of 1c is kept; the text says it assumes the regrid removes the whole 1.76 µs tail, which is unverified, since gate_up_swiglu_q4k has a tail in whole waves.
  • §5.2 (lines 243 to 247, 252 and 254, and a note at 262 and 263): the premise that 48 registers cannot hold two iterations' loads is now limited to the sm_86 scan. Under the JIT, at 59 to 63 registers, whether two iterations' loads overlap is [unverified: SASS not read]; the Q4_K rows and §4.3's count assume they do not, and a warp would hold up to twice as much if they do. Both rows have 32 warps per SM, not 40 (4 × 256 / 32), so 4.1 to 18.4 KB in flight per SM, as in qkv_q4k's row. o_resid_q4k's last cell no longer calls its tail a wave tail.
  • §5.3 (line 267): the Q4_K kernels' in-flight ratio is 0.6 to 2.5 of the need, not 0.6 to 3.1.
  • docs/research/adaptive-picks.md (lines 149 and 286) and docs/research/headpick-warmup.md (line 593) cite sparkdec.md by line. The cited sentences move from lines 170 and 196 to 177 and 209, so the three citations move with them.

I did not re-price 1c, measure the tails or read the JIT's SASS. Whether 1c should become a bound ("≤ −0.07 ms", as 1d is written) is your call.

Code shape

  • No second copy. Documentation only.
  • Model code holds only architecture facts. No code changes.
  • Dead code is gone. The values and notes the readings replace are removed, with no second copy left beside them.
  • No silent failure. No code changes.
  • Comments state what is true now. No code changes.
  • No relaxed gate. No band, tolerance or lint moves.
  • cargo fmt and cargo clippy are clean on what I touched; the lint count did not go up. Nothing Rust is touched.

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

What I ran

On the branch, based on main e659f4fe, with tools/contrib-check.sh --tier t0 --only '^check-' (every tools/check-*.sh):

check-arch rc=0 7s
check-comments rc=0 6s
check-defaults rc=0 1s
check-levers rc=0 4s
check-loads rc=0 53s
check-ptx-names rc=0 0s
check-recipes rc=0 515s
check-rustflags rc=0 0s
check-unsafe rc=0 1s
check-waits rc=0 0s
DONE tier=t0 total=10 red=0 wall=587s

This ran on a Mac (the host line reads Darwin arm64) with no GNU timeout, so the units ran unbounded.

The change is Markdown only, so no gate applies. I checked the table cell by cell against the output of the occupancy script in the linked comment, recomputed every corrected value from it, checked the row_prefetch citation (crates/gpu/src/lib.rs:1936) at main e659f4fe, and checked that the three moved citations in the other two documents point at the same sentences as before.

Hardware (if the change is for a machine)

The readings were taken with the host driver 595.84 on DGX Spark (GB10, cc 12.1, 48 SMs), kernel 6.17.0-1032-nvidia: the plain entries on two Sparks and every _prefetch entry on one, from an empty environment and a fresh CUDA_CACHE_PATH. Repeated runs agree, and the registers equal oxart_jit's over the whole .oxart section. The module is the bloomery-gpu PTX of a bloomery-serve built from main dd187c1d. The conditions are in the linked comment. This pull request runs nothing on a Spark.

… SM for the eight decode entries; gate_up and o_resid fit 4 blocks per SM, not 5

Open term 3 is answered with the table from midagedev#17: registers and
cuOccupancyMaxActiveBlocksPerMultiprocessor of the plain and the _prefetch
entries on a Spark. The count in the term is eight, as section 1 lists.

The terms derived from the sm_86 scan's 5 blocks per SM are corrected in place
at 4: the verdict's 1c, section 1's per-SM limits and slots, section 2's waves
column with a note under it, the router's register count in section 4.2 (48,
not 47), section 4.3's o_resid tail, section 5.2's warps per SM with a note
under its table, and section 5.3's ratio. In section 4.3 the second wave is 64
blocks and the old 74 KB reason for the tail no longer holds, so the tail's
cause is open; 1c's Δ is kept and says it assumes the regrid removes the whole
tail. Section 5.2's premise that 48 registers cannot hold two iterations is
limited to the sm_86 scan, and the JIT's overlap is marked unverified. No
measured number and no lever estimate changes.

adaptive-picks.md and headpick-warmup.md cite sparkdec.md by line; their three
citations follow the text to its new lines.
@midagedev
midagedev merged commit f9706db into midagedev:main Oct 12, 2026
1 check passed
@juliankang4 juliankang4 added dgx-spark The DGX Spark (aarch64, GB10) port documentation Improvements or additions to documentation labels Oct 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dgx-spark The DGX Spark (aarch64, GB10) port documentation Improvements or additions to documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants