Repository navigation
Where a replicating TMA multicast's bytes are counted, measured - #190
Merged
Merged
Conversation
`tma_load_2d_multicast_cg2` has taken an arbitrary cta_mask since it was
written, and its documentation has said outright that nobody knew whether the
one barrier it names sees the charge once or once per destination. Every
multicast in this repo, and in cuda-oxide's own gemm_sol_final, uses a one-bit
mask, so the replicating form was never exercised.
oxide-train#80 needed it for a 4-CTA cluster and measured it on a B200
(`gpu/gemm/src/mcast_probe.rs`: five variants over one cluster, every wait
against a globaltimer deadline so a wrong answer came back as a table row rather
than a launch that never returned):
The copy landing in CTA d completes on the barrier at the supplied OFFSET, in
whichever CTA of d's own cta_group::2 pair the supplied address's rank PARITY
names.
An n-bit mask therefore produces n completions of one tile each, at n different
barriers — so the charge this method hands back was already the right unit. Two
consequences neither guessable nor in the ISA text: an even-rank address means
"each destination's pair leader" and not "rank 0" (mask {1,3} with at_rank(0)
charges ranks 0 and 2), and the named barrier is NOT charged once per
destination, so charging it n tiles over-charges it and hangs the block.
GAPS §2.4 drops `tma_load_2d_multicast_cg2` from the cluster-ops ask: nothing
was missing from it but the semantics.
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.
tma_load_2d_multicast_cg2has taken an arbitrarycta_masksince it was written, and its own documentation has said outright that nobody knew what that mask does to the barrier:It was never going to be answered by accident. Every multicast in this repo — and in cuda-oxide's own
gemm_sol_final— uses a one-bit mask: the own-bit form, which replicates nothing and exists only to reach a.shared::clusterbarrier operand. The replicating form has never run.oxide-train#80 needed it, because the named exit from that issue's residual is a 4-CTA cluster running two
cta_group::2pairs on adjacent tiles of one tile-row withAmulticast between them — the only structure that gets the narrow tile's wave quantization at the wide tile's arithmetic intensity. That kernel cannot be written without knowing where the bytes are counted, and guessing wrong is silent: it hangs.Measured
gpu/gemm/src/mcast_probe.rsin oxide-train — five variants over one 4-CTA cluster on a B200, every wait against aglobaltimerdeadline so a wrong answer comes back as a row of a table instead of a launch that never returns. Each CTA also reports the row range it received, which separates delivery from accounting.[mbar]{0,2}{1,3}mapa'd{1,3}mapa'd{1,3}mapa'd{0,2},{1,3}mapa'dOne model fits all five:
Variant 3 is what rules out the "one absolute barrier" reading: rank 2 was never named by anything, and it completed. Variant 2 rules out "once per destination at the named barrier".
What that changes here
Two consequences, neither guessable and neither in the ISA text:
mask = {1,3}withsem.at_rank(0)charges ranks 0 and 2. The absolute rank is not what is read; its parity is. This is the whole reason a cluster of several pairs can be fed and accounted for by one instruction while keeping one barrier per pair.ntiles for ann-bit mask over-charges it and hangs the block.The diff
Documentation only — no code, no API change, and the charge the method already handed back turns out to be the correct unit.
src/shared.rs— the paragraph that said "it has not been answered" now says what the answer is, with both traps spelled out.docs/library/shared.md— a new subsection under the own-bit multicast, since that section explicitly set up the question.GAPS.md§2.4 —tma_load_2d_multicast_cg2comes off the cluster-ops ask. It was listed as hardcoding the 2-CTA pair; it never did. Its mask was always the caller's, and the_cg2in the name is thecta_groupqualifier the instruction carries, not a limit on the mask.commit_multicast_cg2andmma_walk_cg2stay on the list — those really do hardcode the pair.scripts/fmtclean.