Repository navigation
The drain a deferred job owes is Job::finish, and thirteen entry points stop remembering it (#132) - #200
Merged
Conversation
…ints stop remembering it (#132) A job that defers its last item's store owed one drain after the item loop, and the trait provided nowhere to put it: both deferred jobs invented a `pending` field with a `u32::MAX` sentinel and a `finish()` the *entry point* had to call. `gemm_ws` has nine entry points and so had nine chances to forget it, and forgetting it is a whole output tile computed by nobody. `Job::finish` is that place — empty default, so it costs nothing for a job that does not defer, and called by both `run` and `run_stealing` after their loops. It runs after the loop's last `inval` and before the caller's `dealloc_*`, which is exactly where all thirteen hand-rolled calls already sat, so no launch's instruction stream moves. The call sites removed: `gemm_cg2_lcsf`'s `job.finish()`, the nine in `gemm_ws`, and the three `job.ring.drain()` the `StoreRing` entry points carried — the same shape of obligation, named by #132 as such. Also written down in `pipeline.rs`, where #132 asks for it: a warp-asynchronous item stream is out of scope for this trait, why it is a decision rather than an omission, and what the decision costs — #90 and #94 put the item boundary it buys at a fifth to a third of the launch. That argument lived only in `experiments/src/gemm_ws.rs`, which is being restructured.
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 #132.
The hook
Job::finish(&mut self), empty default, called byrunandrun_stealingafter their item loops. A job that defers its last item's store had nowhere on
the trait to put the drain it owes, so both deferred jobs invented the same
thing — a
pending: u32with au32::MAXsentinel and afinish()the entrypoint had to remember.
gemm_wshas nine entry points, so it had nine chancesto forget, and forgetting is a whole output tile computed by nobody rather than
anything a type says something about.
It runs after the loop's last
invaland before the caller'sdealloc_*— which is where every hand-rolled call already sat, immediately after
pipeline::run(...)returned and immediately beforerelease. Both loops are#[inline(always)]and so isfinish, so nothing moves in any launch'sinstruction stream; this is the same call from a place it cannot be dropped
from.
The call sites removed — thirteen, not ten
experiments/src/gemm.rsgemm_cg2_lcsfjob.finish()→Lcsf::finishexperiments/src/gemm_ws.rsgemm_ws,gemm_ws_clc,gemm_ws_s6,gemm_ws_staged,gemm_ws_staged_x8,gemm_ws_staged_x4,gemm_ws_staged_x8x4,gemm_ws_staged_no_drain,gemm_ws_no_drainjob.finish()→Ws::finishexperiments/src/gemm.rsgemm_cg2_staged_x8x4_tma,gemm_cg2_staged_x8x4_tma_cta,gemm_cg2_staged_x8x4_tma_2gjob.ring.drain()→StagedTma::finish/StagedTmaCta::finishThe last three are the
StoreRing::drainobligation the issue names as havingthe same shape; now that the hook exists there is no reason for them to be the
one kind of teardown still spelled at the launch site.
Acceptance: no GEMM entry point calls a
finishof its own, and thesentence in
pipeline.rsabout the drain a job owes points atJob::finishrather than at the caller.
Scope item 1 — the warp-asynchronous item stream
Written down on the
Jobtrait itself, per the issue's "do not leave it statedonly in
gemm_ws.rs, which is being restructured": what cannot be expressed(warp groups of one cluster sitting at different items), why it follows from the
item boundary being a whole-cluster rendezvous, that the way to admit one is a
second scaffold rather than a change to this one, and what the boundary it buys
costs — #90 and #94 put it at a fifth to a third of the launch. The paragraph in
gemm_ws.rsnow points at it rather than being the only copy.Gates
cargo test(library, host + doctests)cargo clippy --all-targets(library)scripts/fmt --checkscripts/modal-run buildexperiments/, sincecuda.his not available locallyscripts/modal-run regcount.localcensus still 1 of 12 shipped kernelsscripts/modal-run examplesgemmandgemm_wselement-exact at both check sizes, all three traversal widths, both schedulers, every epilogue rung includinglcsfThe three TMA-store rungs are on no correctness gate (they are among the
entry points the tier-2 codegen is the only gate for), which is why the move
there was kept to relocating the identical call rather than changing it.
One correction to the issue's citations
The two files it names moved in #134: the jobs are
experiments/src/gemm.rsandexperiments/src/gemm_ws.rs, notexamples/. And the sentence it quotes —"a job that defers its last item's store owes one drain after
runreturns,which is a whole output tile computed by nobody if it is forgotten" — is at
docs/library/pipeline.md:177-178, which is the line number the issue gives,rather than in
src/pipeline.rs. Both now point at the hook; the doc's staleexamples/src/gemm.rspath is fixed in the same paragraph.