Repository navigation
The occupancy pole of the walk idiom, measured: the high-occupancy form is expressible, and it loses (#222) - #224
Merged
Merged
Conversation
A block-per-row rms norm against the tile walk at both of the walk's levers -- CHUNK, which is fp32 a lane, and WARPS, which is threads a block -- so the downstream revert's verdict can be reproduced here and attributed to one of the two. Every arm reads the row twice and writes it once, so the five issue identical bytes. `bench --case norm-occupancy`, checked before timed, with the driver's registers, frame and blocks/SM beside the clock.
The library docs said a fragment layout is a bad shape to store from; the same claim on the load side now has a clock on it, and the boundary is recorded where each half of the idiom is taught: global.md gets the five-arm table and the rule, ldst.md gets the distinction between the walk that wins and the walk that loses, layernorm.md gets the other pole beside its own 594 -> 5996, and GAPS.md records the two couplings a future attempt would have to move.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #222 — both dispositions, and the API half is answered by measurement rather than by API: the narrow-per-lane, high-occupancy walk needs no new surface, was built, and is the worst arm of five.
The verdict
experiments/src/norm_occupancy.rs,bench --case norm-occupancy. Five arms computingy = x · rsqrt(mean(x²) + ε)per row, every one reading the row twice and writing it once, so all five issue identical bytes. The reference is a block-per-row kernel with no register tile in it; the other four are the walk overglobal::load_rowsat a[16, CHUNK]band a warp, differing only inCHUNK(fp32 live in a lane) and warps a CTA (threads a block). Separating those two levers is the point — #222's hypothesis is about their product.B200, 148 SMs,
24576 × 3072(oxide-train's own shape), median of 3 whole measurements an arm taken round-robin, each the min of 30 timed launches after 5 warm-up, every arm checked against an f64 reference over every element first:The occupancy lever was pulled and it made things worse. The narrow-chunk arms reach 2048 threads an SM — the reference's own number, driver-queried at each arm's own launch envelope — and are the slowest two rows. The other two shapes order the four walk arms identically (
c64 w4<c64 w8<c16 w4<c16 w8):So chunk width orders this table and occupancy orders it backwards. The mechanism is the fragment map, not residency: under
BaseLdtma warp's paired access names 8 rows × 16 bytes — eight half-used 32-byte sectors — where the reference's 32 lanes name one contiguous 128-byte line. Identical bytes; not identical transactions.docs/library/global.mdhas said since #11 that a fragment layout is a bad shape to store from — this is the load side of that claim with a clock on it, and it is why a widerCHUNKwins (at 64 columns a chunk's row is a whole 128-byte line).The 16-row floor costs a second thing, on the launch: a CTA owns
16 · WARPSrows however few rows the problem has, so 6144 rows is 48 CTAs on a 148-SM device. Thewavescolumn says so, and it is why the third table is steeper.What this is not. The magnitudes are not oxide-train's — its two arms were both at 1.8 TB/s where the reference here is near bandwidth, and its second read of a row was L1-resident as this one's is. What reproduces is the sign and the ordering of the two levers, which is the internally controlled part: the four walk arms differ from each other in nothing but two const parameters.
Registers
ptxas, fromscripts/modal-run regcount. No spills and no.localdepot in any of the five (the shipped-set census is unmoved at 1 of 15):rms_norm_per_rowrms_norm_walk_c16_w4rms_norm_walk_c16_w8rms_norm_walk_c64_w4rms_norm_walk_c64_w8Docs — the boundary, where the idiom is taught
docs/library/global.mdgets the section this issue asked for: both poles, the five-arm table, and a three-step decision rule (achieved GB/s first; then count what a warp's fragment map names per access against what the kernel it replaces names; occupancy is not the answer to that, and it is two const parameters away, so it is a measurement rather than a wish). It attaches to the section that already argued a fragment layout is a bad shape to store from.docs/library/ldst.mdandsrc/ldst.rsdraw the line the two verdicts actually straddle: the walk over a TMA-staged shared tile is the one that went 594 → 5996 GB/s; the walk over global is the one that loses. Quoting either number about "the tile walk" without saying which path it was measured on is how one gets applied to the other.docs/kernels/layernorm.mdgets the other pole beside its own 594 → 5996 table: the two poles are not "walk versus no walk" but "a band that does not fit in registers wants streaming, and a row already coalesced in global memory does not want a fragment map".src/global.rs's module header carries the short form, since that is where a kernel author writingload_rowslands.GAPS.mdrecords the two structural couplings, in the entries a future attempt would read: §1.3 getsBaseLdtm's 16-row floor with the numbers it costs, and §3.2 gets the one shape the walk genuinely cannot express — a band split across warps by column, whose statistic is aRegVec<16>spanning warps, wheresync::block_reducefolds one scalar a warp and has no vector form. Filed nowhere, and this measurement is the reason to price the transactions before building it.experiments/README.mdcarries the full run record, all three shapes.Gates
scripts/fmt --check,cargo test(87 doctests),cargo doc --no-deps,clippy --all-targets -D warningsclean on the library.scripts/modal-run build— green (clippy across four crates, host tests,cargo doc --features host,sm_100acodegen of all three kernel crates).scripts/modal-run regcount— green, table above.scripts/modal-run examples— green, including the new row:pass norm_occupancy 512x1024 normalized by all 5 arms, worst relative error 2.88e-3. The five arms are on the correctness gate because an occupancy table whose arms computed different norms would be ordered by whichever dropped a pass.