Repository navigation
An MMA reads what tcgen05.st wrote, measured: the fence pair is not required of the tensor core either - #198
Merged
Merged
Conversation
…177 asks about `sttm round trip`, `ldtm x8 map` and `sttm restage` all read a stored segment back with another LDTM, which is the one consumer a kernel never has. This case hands the segment to an MMA. `mm_abt` writes it, each warp drains its own quadrant, scales it by 4 and `store_tile`s it back at the same columns, and a second `mm_abt` with `accumulate = true` takes the same segment. Both MMAs multiply the same operands, so every value is a multiple of the cell identity the first product already carries and a wrong one names the term that is missing: 5x is the claim, 2x is the accumulator as it stood before the rescale. Eight rows over three axes -- the fence ladder `tmem_warpgroup` runs, the warp that issues the second MMA, and whether `store_wait` is there at all -- plus the control that stores nothing, which is required to come back at 2x so that the two readings are known to differ before any row asserts which one arrived. Refs #177
…ragment says so Measured on a B200, `sttm into mma`, 16384 values a row: control: no store at all every cell at 2x (the stale reading) both fences, issuer stored too every cell at 5x both fences, issuer is warp 2 every cell at 5x neither fence (what ships) every cell at 5x neither fence, issuer is warp 2 every cell at 5x no fence::after_thread_sync every cell at 5x no fence::before_thread_sync every cell at 5x no store_wait every cell at 5x (reported, gates nothing) So `store_wait` plus the rendezvous that publishes the write is the whole of it, for an MMA taking the segment as accumulator as much as for a drain in the other warpgroup, and `store_fragment`'s contract states it as a rule for both readers rather than naming only the one #193 measured. The control is what makes the rest mean anything: a case whose stale and rescaled readings were indistinguishable would pass whatever the hardware did. The `no store_wait` row is the negative control and **it did not fire** -- every cell was exact, exactly as `tmem across warpgroups`' own dropped-wait row was. Neither case is therefore evidence about the wait, and the doc says so: a race that resolved in order is not an ordering, and `store_wait` stays required on the strength of what it is. Refs #177
feitreim
added a commit
that referenced
this pull request
Aug 6, 2026
…are (#204) #198 and #203 each merged green and composed into a build error: the STTM probe was written against the untyped MMA surface (#198), which #203 removed. The probe now speaks the typed one — alloc_block::<COLUMNS>, the two [128, 64] halves via split_columns/columns_right, and the shape argument gone because the tile is the shape. Same instructions, same launch, no semantic change.
feitreim
added a commit
that referenced
this pull request
Aug 6, 2026
…x` that reads it `load_fragment`'s contract asks the caller for `fence.proxy.async.shared::cta`. Both instructions are generic-proxy accesses, and the rule `publish_to_async_proxy` states is that such a pair owes no proxy fence at all — across threads it owes a barrier. Nothing in tree pairs the two directions on one tile, so neither reading has ever run. `stmatrix into ldmatrix`: warp 0 fills a `[64, 64]` tile twice, once from a stale generation of position identities published with everything the contract could ask for and then from the fresh one, and a reader warp reads the whole tile back. The two generations are the same addresses carrying identities 37 columns apart — odd and not a multiple of 16, so no misaddressed `ldmatrix` block can produce the displacement — and a value therefore names the generation that reached it rather than merely failing to match. Nine rows: the control, the proxy fence and `bar.sync` each present or absent, and the reader being the writing warp or another one. The control reads before the fresh store with a barrier making that the order, so it is required to come back stale everywhere — and being an ordering rather than a race it cannot decline to fire, which is the trap #198's dropped-wait control fell into. Refs #136
feitreim
added a commit
that referenced
this pull request
Aug 6, 2026
…the proxy fence `load_fragment` demanded orders nothing between them (#207) * A device-tests case for what orders an `stmatrix` before the `ldmatrix` that reads it `load_fragment`'s contract asks the caller for `fence.proxy.async.shared::cta`. Both instructions are generic-proxy accesses, and the rule `publish_to_async_proxy` states is that such a pair owes no proxy fence at all — across threads it owes a barrier. Nothing in tree pairs the two directions on one tile, so neither reading has ever run. `stmatrix into ldmatrix`: warp 0 fills a `[64, 64]` tile twice, once from a stale generation of position identities published with everything the contract could ask for and then from the fresh one, and a reader warp reads the whole tile back. The two generations are the same addresses carrying identities 37 columns apart — odd and not a multiple of 16, so no misaddressed `ldmatrix` block can produce the displacement — and a value therefore names the generation that reached it rather than merely failing to match. Nine rows: the control, the proxy fence and `bar.sync` each present or absent, and the reader being the writing warp or another one. The control reads before the fresh store with a barrier making that the order, so it is required to come back stale everywhere — and being an ordering rather than a race it cannot decline to fire, which is the trap #198's dropped-wait control fell into. Refs #136 * The fence between an `stmatrix` and an `ldmatrix` is a barrier, and `load_fragment` says so Measured on a B200, `stmatrix into ldmatrix`, 4096 values a row: control: the read runs first every value stale (the two differ) same warp, nothing between them every value fresh same warp, the proxy fence only every value fresh same warp, bar.sync only every value fresh same warp, both (the contract) every value fresh cross warp, bar.sync only every value fresh cross warp, both (the contract) every value fresh cross warp, nothing between them 128 of 4096 stale (reported) cross warp, the proxy fence only every value fresh (reported) So `fence.proxy.async.shared::cta` is redundant here and the barrier is the whole of it. `load_fragment`'s contract splits the obligation by writer: a TMA load is published by its own mbarrier, an `stmatrix` by a barrier and only when the writing warp is not the reading one. `store_fragment` states the same rule from the other side. The `cross warp, nothing between them` row fired on its own, so the hazard is real and this case sees it — and every one of its 128 wrong values was the stale *generation* rather than another position's identity, which is what says the failure was an ordering and not an address. The `proxy fence only` row came back clean and is not evidence: it has no barrier in it, it is the row above with one more instruction of delay, and a race that resolved is not an ordering. No caller in tree was exposed: every `load_fragment` and `load_tile` in the repo reads a TMA-staged tile, and every `stmatrix` write is read back by `ld.shared`, by the TMA store engine, or by an MMA. The two directions had never met, which is why neither reading of the sentence had ever run. That survey did turn up one exposure in the other direction, which the contract had right all along: `flash_forward` writes `P` with `store_tile` and hands it to an MMA — a generic write an async reader takes — with only a `sync_threads` between. The proxy fence it owes is now there. Refs #136 * The fence-only row read stale too, so the fence failing to order the pair is measured and not inferred The second run of the same nine rows had both races fire: `cross warp, nothing between them` at 256 of 4096 stale, and `cross warp, the proxy fence only` at 128. The second is the one that matters. The fence the contract demanded was in the kernel, in the position the contract named, and the `ldmatrix` still read the previous generation of the tile — which is the fence failing to order this pair, rather than an inference from which proxy the two instructions use. The counts themselves are the only numbers in the table that do not reproduce; the doc says so and says why it changes nothing, since a race that resolves in order is not an ordering either way and nothing gated rests on either row. Refs #136 * The `.x4` load side inherits the barrier obligation, and its contract points at the clause rather than half of it #206 landed `load_fragment_x4`/`load_tile_x4` against the old framing, where "visible to the generic proxy" was a bare bullet the caller had to interpret. `load_fragment`'s clause now splits that obligation by writer, so the three inheriting contracts name the route instead of the state: the TMA load's own mbarrier, or a barrier if an `stmatrix` in another warp wrote the bytes. The two widths differ in how many addresses the warp supplies and in nothing that touches a proxy, so it is one obligation and `docs/library/ldst.md` says so — the case runs `.x2`, which is what ships. Refs #136, #131
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.
tcgen05.stwas validated as LDTM's inverse and never as an MMA's input, sostore_fragment's contract could name the fence rule only for the reader #193 happened to measure — a drain. The reader a kernel actually has is a tensor core. This runs that hand-off and turns the rule into one that covers both.The case
device-tests'sttm into mma(device-tests/src/tmem_rescale.rs, kernelkernels::rescale_probeinmain.rs), in thefragment_probemould:mm_abtwrites the segment, so the values are the hardware's —D[row, column] == 128 * row + columnexactly.tile_x8, scales it by 4 in registers,store_tiles it back at the same columns, and the row's ladder decides which ofstore_wait/fence::before_thread_sync/fence::after_thread_syncretires it.mm_abtwithaccumulate = truetakes the same segment, issued by one warp's lane 0.Both MMAs multiply the same operands on purpose, so every value in the dump is a multiple of the cell identity the first product already carries and a wrong one names the term that is missing rather than merely comparing unequal: 5× is a segment the MMA read after the rescale, 2× is the accumulator as it stood before it, 4× is a store that landed with no second MMA.
Measured — B200, driver 580.95.05,
sm_100a, 16384 values a rowfence::after_thread_syncfence::before_thread_syncstore_wait53 of 53 cases passed.Same warp and different warps, both, in every row. All four warps store their own quadrant while one warp's lane 0 issues; so the issuer's own quadrant is the same-warp hand-off and the other three are the arrangement a kernel really has, where the MMA issuer does not own the lanes. The table counts them apart (
issuer'scolumn, 0 everywhere) and the issuer moves between rows, so an answer that depended on which quadrant was the issuer's would have shown up as a failure that moved with it.The control is what makes the rest mean anything. A case whose stale and rescaled readings were indistinguishable would pass whatever the hardware did.
no storeis required to come back at 2× and does, so 5× is positive evidence the MMA read the stored band.The negative control did not fire — say it loudly
The
no store_waitrow is the one the issue asked for, and it observed nothing: every cell exact, at 5×. It is the same non-answertmem across warpgroupsgot from its own dropped-wait row. So neither case is evidence about the wait, and nothing here strengthensstore_wait's necessity — a race whose two sides happened to arrive in order is not an ordering. The row is reported and gates nothing, and both the doc and the case say why.What the case can see is the store-visibility hazard, and the control proves it: with no store the dump reads 2× everywhere, which is exactly the reading a fence bug would produce.
What the contract now says
TmemTile::store_fragment(src/tmem.rs) — the fence pair is not additionally required, for either consumer, each layer removed on its own and both together:tmem across warpgroups);sttm into mma) — exact with neither fence, same warp and different warps, against a control that stores nothing and comes back stale.So
store_waitplus whatever rendezvous publishes the write to the consumer is the whole of it, and this crate using neither fence is now a measurement rather than an omission.store_waitstays required and neither case measures it.docs/library/tmem.mdgains the table and the two readings;GAPS.md§2.1 records the MMA consumer.Not established: the same question under
cta_group::2, an MMA in another CTA of a cluster, and any of it on silicon other than a B200.Closes #177 — the measurement it asks for is above, taken on a B200.