Repository navigation
ptx-schedule: classify the asynchronous proxy pipeline as schedule sites - #1195
Conversation
…ule sites
`classify_instruction` covered the synchronous ordering primitives -- atomics,
`red.*`, the `bar.*`/`barrier.*`/`mbarrier.*` family, `membar.*`/`fence.*`, the
warp collectives and ordered `ld`/`st` -- and nothing from the asynchronous
proxy. An opcode that classifies as nothing is not a site of any kind, so it
received no injection and never appeared in a report: the pipeline a Hopper or
Blackwell kernel is built around was the part a campaign could not reach.
None of the existing arms reach these, and each for its own reason:
* `cp.async.bulk.tensor...` carries `mbarrier::complete_tx::bytes` in its
qualifier list, but spells it with `::`, so it never matches the barrier
arm's `mbarrier.`;
* `wgmma.fence.sync.aligned` is a fence that does not start with `fence.`;
* `tcgen05.ld...` splits to a base of `tcgen05` rather than `ld`, so the
ordered-memory arm returns before seeing it;
* `clusterlaunchcontrol.try_cancel.async` completes through an mbarrier just
as the bulk-tensor copy does, and matches nothing at all.
Adds `SiteKind::AsyncProxy` and one prefix arm for the four families. Taking
each family whole matches how `bar.`/`mbarrier.` and the warp collectives are
already handled, and keeps the consumer halves (`tcgen05.ld`,
`clusterlaunchcontrol.query_cancel`) as sites alongside the issues and waits
they read.
Across the 167 `.ptx` the example corpus builds, this takes the analyzer from
2093 sites to 2465: 372 ordering instructions that were previously invisible.
The crate README carries the `SiteKind` table, so it gains the row in the same
position; the two lists agree in order and content.
Signed-off-by: Vyncint Ng <[email protected]>
The new arm matched "cp.async" but not the TMA reduce family: mir-lower's
inline-asm template emits
cp.reduce.async.bulk.tensor.{n}d.global.shared::cta.{op}.{mode}.bulk_group,
where "reduce" sits before "async", so "cp.async" walks past it.
Before/after for a kernel using TMA tensor reduce:
cp.reduce.async.bulk.tensor.2d...bulk_group -> (no site) -> AsyncProxy
cp.async.bulk.commit_group -> AsyncProxy -> AsyncProxy
cp.async.bulk.wait_group 0 -> AsyncProxy -> AsyncProxy
That left the issue classified as nothing while its commit/wait pair became
sites: the half-covered condition issue NVIDIA#1113 describes. Adds the prefix,
one fixture line spelled verbatim from the mir-lower template, and extends
the existing assertions. No example emits cp.reduce today, so corpus site
counts are unchanged (verified: no count constants reference the corpus).
Signed-off-by: nihalpasham <[email protected]>
819baca to
1eed4d2
Compare
|
Reviewed in depth; this is exactly the fix #1113 needed and the evidence work (corpus recount, 21/21 ptxas on perturbed output with a negative control, the mutation table) made it easy to trust. One gap found, and we patched it on your branch rather than round-tripping. The gap: mir-lower's TMA reduce path emits an instruction your prefix list can't match, while its ordering pair can: An issue the fuzzer can't delay against a wait it can perturb is the same half-covered condition your issue describes. No example emits it today (counts unchanged), but the API is user-reachable, so it would have bitten the first kernel that used TMA reduce. What we stacked on your branch (your commit untouched underneath)
Validation
Two adjacent families our verification turned up that are deliberately NOT in this arm: |
The B200 evidence for PR NVIDIA#1066 previously lived only in the PR description. scripts/regress-gemm-sol-schedule.sh (just regress-gemm-sol) makes it repeatable: the default pass-after mode runs the mbarrier-focused fuzz-schedule campaign on the current tree with --fail-on-finding and asserts from summary.json that the baseline was Usable (a Declined baseline also exits 0), every variant ran, and AsyncProxy sites were classified (post-NVIDIA#1195 coverage incl. tcgen05 commit/wait). The opt-in --fail-before <ref> mode rebuilds the pre-fix tree in a throwaway worktree and asserts the race is CONFIRMED there. Seeds are per-build (site renumbering), so the pinned defaults document the lineage they were confirmed on and stay overridable. Gated on sm_100 hardware; skips cleanly elsewhere. Signed-off-by: nihalpasham <[email protected]>
* fix: synchronize phase 4b tile metadata The gemm_sol_clc producer warp republished the TILE_INFO mailbox after signaling TILE_READY without waiting for the MMA and epilogue warps to copy the current tile coordinates. Add a TILE_INFO_FREE mbarrier (arrival count 5, one leader per reader warp) that the producer waits on before each republish, including the final has_work = 0 publish. Found by the schedule perturbation campaign: seeds 56 and 135 of a 0..140 --focus mbarrier sweep on a B200 (sm_100a) failed the phase 4B validator 3/3; with this fix the same sweep is clean and phase 4b throughput is unchanged within noise. Signed-off-by: David Holtz <[email protected]> * fix: extend tile-metadata handshake to phases 4a, 4c, 4d Signed-off-by: David Holtz <[email protected]> * fix(gemm_sol): lane-0 CLC decode behind a cluster rendezvous in 4D; tile-distinct Walsh validator for the CLC phases Phase 4D decoded the CLC response in all 32 producer lanes with no proxy fences and no rendezvous, unlike 4B/4C: the leader's next clc_try_cancel_multicast can overwrite both CTAs' CLC_RESPONSE while slow follower lanes still hold the old one, so is_canceled diverges and the warp hangs at the K-loop sync (reachable when k_iters == 4). Adopt the 4C pattern: CLC_READY cluster rendezvous armed before the local TILE_INFO_FREE wait, lane-0-only decode with async-proxy fences, and shuffle broadcast so the cancel branch is warp-uniform by construction. The TILE_INFO_FREE barrier itself stays CTA-scope; a comment now pins the CTA-locality invariant and the escalation path. The CLC correctness phases also swap their periodic inputs (every 128x128 output tile byte-identical - blind to exactly the tile permutations the mailbox race causes) for the 12-bit Walsh fingerprint validator with a full exact-BF16 output scan. A quadrant scale on A breaks the affine-code twin symmetry (code(x+2048) = code(x) ^ 0x800) that would otherwise leave each tile a byte-identical twin 16 tiles away; all values stay exact in f16/f32/bf16 in any accumulation order. Signed-off-by: nihalpasham <[email protected]> * test: committed schedule-fuzz regression for the gemm_sol mailbox race The B200 evidence for PR #1066 previously lived only in the PR description. scripts/regress-gemm-sol-schedule.sh (just regress-gemm-sol) makes it repeatable: the default pass-after mode runs the mbarrier-focused fuzz-schedule campaign on the current tree with --fail-on-finding and asserts from summary.json that the baseline was Usable (a Declined baseline also exits 0), every variant ran, and AsyncProxy sites were classified (post-#1195 coverage incl. tcgen05 commit/wait). The opt-in --fail-before <ref> mode rebuilds the pre-fix tree in a throwaway worktree and asserts the race is CONFIRMED there. Seeds are per-build (site renumbering), so the pinned defaults document the lineage they were confirmed on and stay overridable. Gated on sm_100 hardware; skips cleanly elsewhere. Signed-off-by: nihalpasham <[email protected]> --------- Signed-off-by: David Holtz <[email protected]> Signed-off-by: nihalpasham <[email protected]> Co-authored-by: Claude (subagent) <[email protected]>
Closes #1113.
classify_instructioncovered the synchronous ordering primitives and nothing from the asynchronous proxy. An opcode that classifies as nothing is not a site of any kind, so it received no injection and never appeared in a report — the pipeline a Hopper or Blackwell kernel is built around was the part a campaign could not reach.Why none of the existing arms reached these
Each family misses for its own reason, which is why this was not a one-line oversight:
cp.async.bulk.tensor...mbarrier::complete_tx::bytesmbarrierin its qualifiers but spells itmbarrier::, so it never matches the barrier arm'smbarrier.wgmma.fence.sync.alignedfence.tcgen05.ld.sync.aligned...tcgen05, so the ordered-memory arm returns before theld/sttestclusterlaunchcontrol.try_cancel.asyncAdds
SiteKind::AsyncProxyand one prefix arm for the four families. Taking each family whole matches howbar./mbarrier.and the warp collectives are already handled, and keeps the consumer halves (tcgen05.ld,clusterlaunchcontrol.query_cancel) as sites alongside the issues and waits they read.Two corrections to the issue, both making the gap larger
372 instructions, not the 227 I filed. That figure came from a line-anchored
grep; 120 of these sit inside single-line inline-asm blocks, which the parser finds and the grep did not. Measured withanalyze_ptxover the 167.ptxthe corpus builds:Per example:
gemm_sol206,gemm_sol_final118,tcgen05_matmul14,cp_async_zfill3,wgmma3,tma_copy2,tma_multicast1.clusterlaunchcontrol.*is a fourth family the issue did not name — 25 instructions, same pipeline. Splitting it out would have meant two PRs editing the same match arms, so it is folded in and the issue is updated.The perturbed PTX still assembles
The real risk in classifying these is emitting something
ptxasrejects, and it is a risk I cannot answer by running the kernels: every affected example needs sm_80 or above, and the six Hopper/Blackwell ones cannot execute anywhere I have access to. So I assembled instead. Each of the 7 affected examples was perturbed atintensity 1.0under 3 seeds and fed toptxasfor its own target:Negative control, so the 21/21 is not vacuous — corrupting one injected instruction makes
ptxasreject it:Tests
Three, following
redux_is_a_warp_collective_and_red_is_still_a_reduction— the closest precedent, since it also added a classification and had to prove it did not steal from a neighbour. Every opcode spelling in the fixture is taken verbatim from PTX the backend emits, not hand-written.Mutations, each applied to the fixed tree:
cp.asyncfrom the prefix listwgmma.tcgen05.clusterlaunchcontrol.ld.(would swallow ordered memory)contains()(would stealwgmma.fence)That last one is what the negative-control test is for. I checked the symmetric case too and am reporting it accurately rather than claiming more: relaxing the barrier arm to
contains()changes nothing, because the bulk-tensor opcode spells the qualifiermbarrier::and so never containsmbarrier.. The test's comment says so.Scope
SiteKindtable, so it gains the row in the same position; the two lists agree in order and content.SiteKindhas no exhaustivematchanywhere, so the new variant breaks no caller; it is additive in the serialized report.cp_async_zfill(sm_80) is the only affected example that could run on hardware I can reach, and g5 spot capacity was exhausted in both permitted regions throughout this session; the T4 alternative is sm_75, below whatcp.asyncneeds. Rather than claim a run I did not make, the validity argument rests on theptxasassembly above, which covers all four affected targets — including the two no one here can execute.Test plan
cargo test -p ptx-schedule— 19 passed (16 pre-existing + 3 new), plus the 3 binary tests.cargo clippy -p ptx-schedule --all-targets -- -D warnings— clean.cargo fmt --check— clean.RUSTDOCFLAGS="-D warnings" cargo doc --no-deps -p ptx-schedule— clean.