Repository navigation
The pin moves to 20a5616, and two doc claims did not survive the audit - #152
Conversation
85d20c1 to
6d67a6d
Compare
Gates, all green — and the register census is the finding
The device harness is 42 cases, not #142's 41, so the kernels and cases that landed in #147/#148 are covered at the new pin for the first time. The headline: 44 of 270 register counts moved, and four of them are spills
This is not an LLVM bump. Most movement is downward — But four kernels started spilling, and three read as wins on the register count alone:
A count that falls while spill slots appear is Two of the six gated rows moved — The opcode census barely moved: 3 of 74 kernels, all in the One published number does not survive the bump
Written up in Two smaller things checked and closed
|
|
CI, all four green on
Every Rust change in this PR is a doc comment — |
cuda-oxide goes from b099f64 to 20a5616 across all four manifests, all four locks and `CUDA_OXIDE_REF` in `modal_app.py` — nine build files that move together, since the codegen backend and the device/host/core crates have to come from one revision. The lockfile diffs are the rev string and nothing else: zero non-rev changed lines across the four, and `cargo metadata --locked` passes on each. #142's 41-case validation predates the #144–#148 stack, so it no longer covers the tree and is not leaned on. What is leaned on is re-verification: every claim this commit repoints was read out of a checkout whose `git rev-parse HEAD` was confirmed to be `20a56163f258e09f2c51e4c27ae4e4ff17582443` first, which is #106's rule. Six of the seven checkouts in that cargo directory are not the pin, `/Users/finn/projects/cuda-oxide` (at `29396b7`) among them. **Two claims did not just need a new hash.** `src/lib.rs` said libdevice math is legal beside tcgen05 in one pure-PTX artifact "at cuda-oxide b099f64". Moving that hash would have asserted it at a revision nothing checks, because **nothing in this tree makes a libdevice call** — `Abs` clears the sign bit rather than calling `fabsf`, `fmax`/`fmin` are comparison-selects, `Sqrt`/`rsqrt` lower to native `sqrt.rn.f32`, and `exp2`/`log2` are FMA polynomials or the `ex2` SFU. So no gate re-establishes it, a green `build` says nothing either way, and the citation stays at `b099f64` with the reason written down. `GAPS.md` said `cp.reduce.async.bulk.tensor` was absent from cuda-oxide "in every form — not in the generated crate and not in `intrinsics/imported.json` either", and argued from that that reduction stores were a lowering to contribute. The records are there, and were there at `b099f64` too: 64 of them at both revisions, spelled `int_nvvm_cp_async_bulk_tensor_reduce_*` — which is why a grep for `cp_reduce_*` finds nothing and how the claim lasted. They are simply not admitted to the generated crate, where the count is zero. That makes #42 the same shape as prefetch one row below it, a generation-list change rather than a lowering, and a smaller ask than the file claimed. **Provenance kept where it is the historical fact.** The `gemm_sol_upstream` copy was taken at `b099f64` and the port measured there; `gemm_sol_final/` is byte-identical at `20a5616` and upstream's `kernels.rs` and the vendored copy all hash to `6746e517…`, so those citations keep `b099f64` and say why. The `stmatrix` defect is annotated rather than rewritten: #145 proved it survives the bump, so `ldst.rs`'s `ptx_asm!` workaround stays and `upstream_ptx`'s docstring now records that the bump drops neither workaround. **One retracted argument removed rather than repointed.** `gemm.rs`'s `.pack::16b` doc still carried "the register count does not fall, so nothing is packed" — the sixth instance of the register-count error (#47, #63, #67, #76, #81) that #147 refuted and corrected in `experiments/README.md`. Repointing the hash beside it would have asserted the retracted reasoning at the new pin, so the doc now carries #147's two answers instead: `cvt.rn.bf16x2` censuses at 0 and the arm faults with `Xid 13`.
6d67a6d to
707abc8
Compare
Rebased onto
|
vs 336e3d7 |
vs aaadcc2 |
|
|---|---|---|
| rows moved | 44 of 270 | 46 of 272 |
| newly spilling | gemm_sol_m512_mma, gemm_ws_staged, _x8, _x8x4 |
gemm_sol_m256_n128 (both crates), gemm_ws_staged, _x8, _x8x4 |
gemm_sol_m512_mma does not spill against the current main — it goes 80 → 79, 0/0. #154 moves registers on its own, and it moved that kernel out of the spill. My first reading was not wrong about the tree it measured; it was the wrong tree. The newly-spilling set is not stable under the choice of baseline, which is the general lesson.
regcount --determinism passes on the new pin (270 kernels, every counter, two builds), so the diff is a function of the revision. Still not an LLVM bump: rust-toolchain.toml byte-identical, both at rust-llvm-22.1.2-1cb4e383, only collector.rs/generated_intrinsics.rs + cargo-oxide's backend.rs differ.
Four spills, and every one falls in register count
| kernel | crate | regs | spill st/ld |
|---|---|---|---|
gemm_sol_m256_n128 |
both | 86 → 80 | 0,0 → 4,8 |
gemm_ws_staged |
experiments | 43 → 40 | 0,0 → 16,20 |
gemm_ws_staged_x8 |
experiments | 90 → 80 | 0,0 → 8,12 |
gemm_ws_staged_x8x4 |
experiments | 90 → 80 | 0,0 → 8,12 |
All four read as improvements on the register count alone. None are. That is ptxas taking a lower target and paying in local memory — the register-count error this repo has been burned by five times (#47, #63, #67, #76, #81), arriving from the toolchain instead of from a diff, which is a sharper version of the same point than any of the five. No row stopped spilling.
gemm_sol_m256_n128 is the one that matters: unlike the gemm_ws arms it is a shipped launch variant (Variant::M256xN128, what select_variant picks for a shape too narrow to fill a wave of the wider tile), and it spills in both crates. Occupancy gate #95 green both sides; opcode census moved in 3 of 80 kernels and only in selp.
The decomposition survives — re-timed on both pins, laddered
Thank you for the correction on 88.7%; I re-ran the K ladder (sol_ablate), not the launch figure. Each arm twice, at [256, 256] 4096², as % of peak:
| arm | old pin | new pin |
|---|---|---|
feed only |
103.2 / 104.2% | 104.2 / 103.8% |
mma only |
99.5 / 99.6% | 99.7 / 99.6% |
issue only |
99.6 / 99.5% | 99.8 / 99.7% |
no drain |
80.4 / 80.4% | 80.2 / 80.9% |
whole |
78.5 / 79.0% | 79.0 / 78.7% |
runtime stage |
76.4 / 76.3% | 76.9 / 77.1% |
Every arm agrees across the pin to 0.2 points or better, inside its own two-pass spread. [512, 256] is the same at 99.3–99.7% on both. Upstream's ladder: 82.3% old, 81.9% new.
mma only is still at peak, so "the MMA issue stream has no deficit" stands and no row of the published decomposition needs amending.
One number does not reproduce and it is not the pin's: mma only is published at 100.6% and reads 99.5–99.6% on the old pin at aaadcc2. Old and new pin agree to 0.1 point, so #154 or the session moved it, not the bump. Flagged rather than silently restated — it is not mine to fix, but it should not sit there unremarked.
The shipped spill does not resolve as a time
bench sol-small (both rungs twice round-robin) on both pins. The two pins cannot share a container, so the N128/N256 ratio is beside the absolute rates:
| shape | N128 old → new | N256 old → new | ratio old → new |
|---|---|---|---|
| 1024³ | 0.0144 → 0.0147 | 0.0179 → 0.0187 | 0.807 → 0.786 (−2.6%) |
| 1536³ | 0.0160 → 0.0171 | 0.0211 → 0.0212 | 0.758 → 0.807 (+6.4%) |
| 2048³ | 0.0249 → 0.0260 | 0.0241 → 0.0242 | 1.035 → 1.074 (+3.8%) |
| 3072³ | 0.0560 → 0.0572 | 0.0452 → 0.0469 | 1.238 → 1.221 (−1.4%) |
The ratio moves ±6.4% with inconsistent sign, and M256xN256 — whose register count did not move — reads 0.5–4.8% slower too. A change that hits the unmoved kernel as hard as the moved one is the container, not the diff.
So the spill's cost is unestablished rather than zero. That table's own spread column runs 4–87% at these shapes, which is why it says so itself, and settling it needs a same-container A/B that a dependency bump cannot provide. It is the one open item the pin leaves, and the static 4/8 is why it is worth opening.
Both earlier flags kept in the PR: cuda-core dropping public ClusteredCooperativeValidationUnsupported (never named here), and .reqntid now driver-enforced per axis where .maxntid only bounded the product — closed empirically by green build, regcount and 42/42 device cases.
|
CI green on the rebased head |
…ll is outside the hot loop Measured against `aaadcc2` rather than argued about, because a compiler-backend bump is exactly the change that moves registers with nothing watching: `regcount` on `aaadcc2` and on the same tree with the pin moved. 46 of 272 rows moved, the kernel set is identical on both sides, and `regcount --determinism` passes on the new pin — 270 kernels, every counter, across two builds. **This census was taken twice and the answer changed.** Against `336e3d7` it was 44 of 270 rows with `gemm_sol_m512_mma` among the newly-spilling four; #154 landed in between and moves registers on its own, and against `aaadcc2` that kernel is 80 -> 79 with no spill. The newly-spilling set is not stable under the choice of baseline, so a dependency diff has to be taken against the commit it will land on. Not an LLVM bump: `rust-toolchain.toml` is byte-identical and both revisions validate against `rust-llvm-22.1.2-1cb4e383`. Two files differ inside `rustc-codegen-cuda/src` (`collector.rs`, `generated_intrinsics.rs`) beside `cargo-oxide`'s `backend.rs`. Four rows started spilling and **every one falls in register count while doing so** — that is `ptxas` taking a lower target and paying in local memory, this file's oldest error arriving from the toolchain instead of from a diff. No row stopped spilling. Those columns are **bytes**, which is worth 20x: `4,8` is one 32-bit register stored once and reloaded twice, not four stores and eight loads, and the file now says so where it prints them. `gemm_sol_m256_n128` is the only one that ships (`Variant::M256xN128`), so it is the only one that had to be answered. **The decomposition survives, laddered on both pins.** `mma only` reads 99.5/99.6% of peak on the old pin and 99.7/99.6% on the new, every arm agrees across the pin to 0.2 points or better inside its own two-pass spread, and `[512, 256]` is the same at 99.3-99.7%. So `mma only` is still at peak and no published row needs amending. One number does not reproduce and it is not the pin's: `mma only` is published at 100.6% and reads 99.5-99.6% on the *old* pin at `aaadcc2`, so #154 or the session moved it. **The shipped spill is outside the hot loop, and a CPU container settled it.** `bench sol-small` could not: the N128/N256 ratio moves +-6.4% with inconsistent sign and `M256xN256`, whose registers did not move, reads 0.5-4.8% slower too, so that table's 4-87% spread is the container and not the diff. The disassembly can. `nvdisasm -c` through `_print_sass_loops`' backward-branch loop finder says the pin adds **exactly three** local-memory instructions to `m256_n128` and none to the two unspilled controls: one `STL` and two `LDL` at `[R1+0x100]`, which is the 4 and 8 bytes arrived at independently. All three sit in 510-727 instruction regions; the innermost 216-instruction loop, where this kernel's 64 pre-existing frame accesses live on *both* pins, contains none of them. That bounds the cost at <=0.6% of issue in one outer loop and zero in the inner one, against an instrument that reproduces to 4-87%. Below the noise floor, with the noise floor stated.
707abc8 to
a47adfa
Compare
Step 1 settled it. #152 lands — the spill is outside the hot loop, and one register wide.Pushed as First, a units correction that changes the magnitude by 20×
Where the spill lives
The pin adds exactly three instructions, only to the kernel that spills: one The controls were load-bearing. All three kernels already carry 64 local accesses on both pins, from their own 256-byte frames. So And they are not in the hot loop
The innermost 216-instruction loop — where the 64 frame accesses live, and the tightest structure in this kernel — contains none of the new traffic. The spill is one register saved and restored around a 510–727 instruction region. Cost bound: three instructions per 510 ⇒ ≤0.6% of issue in that outer region, and exactly zero in the inner loop. The noise floor, statedThe instrument that would have to see ≤0.6% is Below the noise floor, and that is the noise floor. Per your rule: #152 lands. The spill is real, localized to one register, outside the hot loop, and cannot matter at any shape HousekeepingThe diagnostic entry point was temporary and is not in the diff — Post-rebase re-verification, as asked: pin present in all four manifests and all four lockfiles, zero |
…t reports rather than gates (#167) Built against the depot a value-select among per-stage shared symbols lowers to -- a `match` yielding pointers or barrier references, one static per stage, which stock LLVM stores to `.local` and reloads in the hot loop. Measured on the real work-stealing gemm at 8192^3 in cuda-learning's `kernels/barrier_bench`, three otherwise-identical kernels: 710 TFLOP/s for the depot spelling against 857 for stage selection as `base.add(i)`. The rings and `SharedPlan` exist so selection is always the latter, but that property was emergent and nothing was watching for the class. The check reads the PTX *text* -- the `.local .align` frame declaration and its `st.local`/`ld.local` traffic -- because the depot is LLVM's and a ptxas spill happens after PTX and never appears in it. Disjoint from the spill columns by substrate, which is exactly how the finding stayed hidden: it shipped as a hard gate on the examples crate plus GATED_KERNELS, and its first run failed on every one of them. 256 B with 64 st.local / 16 ld.local across the whole staged-x8x4 family and every gemm_sol_* rung, 528 B on gemm_cg2, 1824 B on flash_forward, ~1540 B on groupnorm_tile -- all sitting in ptxas' stack column all along, unread, because #152 and every audit before it watched the spill columns, which are ptxas' own decisions and stayed zero. The register-tile probes (band_roundtrip, fragment_map_32x128, the store_ring_* family) carry the same shape -- scalar stores, a quarter as many loads -- so the suspect is a dynamically-indexed fragment array in `reg.rs`, not stage selection. That is a guess and is marked as one. So the raise is demoted to a report until the frames are attributed: failing on a number nobody understands gates nothing. The arming condition is written where the census prints -- a shipped set that reads zero flips it back. The gate variant was watched to fail on the real tree before being demoted, and the report ran green through `scripts/modal-run regcount` with the sentinel seen; the census table diffs across a change the way the register table does.
Rebuilds the orphaned
origin/pin-20a5616-wip(db53cf5, one commit on top of pre-stack0823d92) on top ofmainat336e3d7, and audits every prose citation individually rather than blanket-replacing the hash.The build files
All four manifests, all four lockfiles and
CUDA_OXIDE_REFmove together. The lock diffs are the rev string and nothing else — zero non-rev changed lines across the four, and zero occurrences of the old hash left in any manifest or lockfile:cargo fmt --checkandcargo metadata --lockedpass on all four crates locally — that is thedevice-surfacejob, and a stale lockfile is what it fails on.The only surviving
b099f64outside prose is inupstream_ptx's docstring, which is a provenance statement about where the defect was observed;CUDA_OXIDE_REFitself has moved.The citation audit
Per #106, every claim was read from a checkout whose
git rev-parse HEADwas confirmed to be20a56163f258e09f2c51e4c27ae4e4ff17582443before anything was read from it:~/.cargo/git/checkouts/cuda-oxide-6d394bb007f5e114/20a5616. Six of the seven checkouts in that directory are not the pin, and/Users/finn/projects/cuda-oxidesits at29396b7— nothing was read from it.Re-verified at
20a5616, hash updated:clc.rswith no usage example_x8_pack16and_x8_rawboth[u32; 32]gemm.rsstatus = "active", both[u32; 32].x8variants active with array results;_x8_pure/_x8_rawshare one LLVM intrinsicllvm.nvvm.tcgen05.ld.16x256b.x8generated/stmatrix.rsshipsstmatrix_m8n8_x4src/ldst.rsx2/x4, plain andtransProvenance kept at
b099f64, annotated rather than rewritten: thegemm_sol_upstreamcopy point and thestmatrixdefect observation.gemm_sol_final/is byte-identical at the two revisions —diff -ris empty, and upstream'skernels.rsat both revisions plus the vendoredgemm_sol_upstream_kernels.rsall hash to6746e517eca19fdcc01cb0d5003e924bb638f5ee42e8c333d457a0d6f334d6e9. So "copied without a character changed" is verified independently, and the measurement does not turn on the pin.Two claims that needed more than a hash
src/lib.rs's libdevice claim is not re-establishable at the new pin, so its citation stays put. It said libdevice math is legal beside tcgen05 in one pure-PTX artifact "at cuda-oxide b099f64". Nothing in this tree makes a libdevice call —Absclears the sign bit rather than callingfabsf,fmax/fminare comparison-selects,Sqrt/rsqrtlower to nativesqrt.rn.f32, andexp2/log2are FMA polynomials or theex2SFU.reg.rssays so on purpose:Absis a sign-bit clear so that it "keeps the op usable in a pure-PTX artifact whatever becomes of the crate-level claim". No gate exercises it, so a greenbuildsays nothing either way, and moving the hash would have been #106's exact failure mode. The claim now names the revision it was established at and says why it stays there.GAPS.md's
cp.reduceclaim was wrong, and wrong before the bump. It saidcp.reduce.async.bulk.tensorwas absent from cuda-oxide "in every form — not in the generated crate and not inintrinsics/imported.jsoneither", and argued from that that reduction stores were a lowering to contribute rather than a transcription. The records are there, and were there atb099f64too: 64 of them at both revisions, spelledint_nvvm_cp_async_bulk_tensor_reduce_{add,and,dec,inc,max,min,or,xor}_{tile,im2col}_{1..5}d. That spelling is why a grep forcp_reduce_*finds nothing and is how the claim survived as long as it did. What they are not is admitted to the generatedcuda-devicecrate, where the count is zero. That reclassifies #42 as the same shape as prefetch one row below it — a generation-list change, not a lowering — and a smaller ask than the file claimed. This is the orphaned commit's correction, verified at the new pin and kept.The merge conflict, and one retracted argument beside it
The single conflict was
experiments/README.md's.pack::16bsection. Tookmain's side. The incoming version's closing sentence — "The count does not fall, so nothing is being packed two-into-one for the same span" — is exactly the sentence the following paragraphs onmainrefute as a sixth instance of the register-count error (#47, #63, #67, #76, #81). Only the hash insidemain's text changed; the retracted reasoning is not reintroduced.experiments/src/gemm.rs's doc for the same rung still carried that retracted argument — #147 corrected the README and missed the kernel doc. Repointing the hash in that very doc block would have asserted the retracted reasoning at the new pin, so it now carries #147's two answers instead:cvt.rn.bf16x2censuses at 0, and the arm faults withXid 13, Out Of Range Address. This is a doc comment only — no kernel body is touched anywhere in this PR.Not done here
src/ldst.rs'sstmatrixptx_asm!workaround stays; #145 proved the defect survives the bump, and bothldst.rsandupstream_ptx's docstring now record that the bump drops neither workaround rather than leaving the "run it after a pin bump" instruction to be re-litigated.Validation
#142's 41-case B200 run predates the #144–#148 stack and is not leaned on. Gate results are posted below; the
regcountcensus againstmain's is the thing to read, since a compiler-backend bump is exactly the change that moves registers, spills or opcode counts silently.