Repository navigation
feat(wgmma): add TF32 m64n64k8 value-threaded full-drain lowering - #1077
Merged
nihalpasham merged 2 commits intoAug 20, 2026
Merged
Conversation
Signed-off-by: Raul Estrada <[email protected]>
Collaborator
|
nihalpasham
approved these changes
Aug 20, 2026
nihalpasham
pushed a commit
that referenced
this pull request
Aug 21, 2026
…1106) Closes #1090. `mlir-dialects.md` states its own freshness rule: At catalog SHA-256 `26a9cc13` (the stamp in every `ops/generated/` file header), the dialect holds 570 operations across 42 modules ... If the header stamp no longer starts with `26a9cc13`, the counts on this page predate the catalog you are reading. Nothing enforced that rule, so the rule that would expose stale counts was itself unchecked. The page failed its own test for weeks before #1052 (560 printed against 570 in the tree), and **it is failing again right now**: the catalog hashes to `00372dfe`, five hand-written ops and five catalog entries after that refresh landed. Two hand audits in two batches is the pattern this closes. ## The gate One file hashed, one page grepped, no cargo and no network. The hash is the one `cuda-intrinsics-gen` stamps into every generated file -- `sha256_bytes(catalog_json.as_bytes())` over the file as committed -- so a plain `sha256sum` reproduces it, and the page prints its first eight digits. Three checks rather than one, so each failure says which thing moved: - The generated sources must stamp the hash `catalog.json` actually has. Failing here means the generated outputs are stale, and the message says to run `cuda-intrinsics-gen -- generate` -- not to edit the book. - The page must print exactly one distinct stamp. It names it twice, once stating it and once in the rule that tells a reader what a mismatch means, so updating one and not the other leaves the rule contradicting the statement above it. - The stamps must agree, and the failure prints both sides plus the two commands that re-derive the counts the stamp guards. It refuses to report success from a check that found nothing: a page reworded so no stamp is left fails with that stated, rather than passing vacuously. That path needed the `|| true` on the capture rather than on a later pipeline -- under `pipefail` a grep matching nothing aborted the script before the diagnostic, turning a reworded page into a silent non-zero exit. ## The refresh that makes it pass Five numbers and the stamp, all re-derived from the tree: | claim | was | now | |---|--:|--:| | catalog stamp (x2) | `26a9cc13` | `00372dfe` | | total operations | 570 | 575 | | hand-written operations | 21 | 26 | | hand-written `wgmma` row | 9 | 14 | | catalog entries | 1010 | 1015 | Generated stays 549 across 35 modules and every area row is unchanged, because #1085's five new catalog entries are aliases onto existing structural ops -- exactly what the page's "several intrinsics can share one structural op" sentence predicts. The +5 hand-written are all `wgmma`, from #1075, #1077 and #1079. The `wgmma` row's description moves with its count, as in #1052: it said "the m64n64k16 bf16/f16 shapes", and the module now holds four shape/type pairs -- `m64n64k16` bf16 and f16, `m64n128k16` bf16 (#1079), `m64n64k8` tf32 (#1077). ## Verification - Four mutations, each failing with its own message: a stale stamp, only one of the two stamps updated, the page reworded so none is found, and an edited `catalog.json`. The healthy tree passes. - Every count re-checked against the tree: 26 + 549 = 575, both tables sum to their stated totals (7 rows to 26, 11 rows to 549), and each still lists every module on disk. - All eleven guard scripts pass, `check-spdx-headers.sh` accepts the new file, `cuda-intrinsics-gen -- check` reports outputs current, the workflow parses with all nine jobs on `ubuntu-latest`, and the book builds clean under `sphinx-build -W`. `just check-guards` should list this script too, one line beside the other ten. Its recipe is being restructured in #1102, so that line is left for a follow-up rather than conflicting; no guard enforces that list, so CI is unaffected either way. Signed-off-by: Vyncint Ng <[email protected]>
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 #1076
Summary
Adds value-threaded lowering for Hopper TF32 WGMMA
in the canonical linear full-drain case.
TF32 now follows the existing register-resident strategy for:
The 32
f32accumulator values remain tied through one convergent inline-PTX region, preventing LLVM from introducing a spill boundary while theasynchronous WGMMA group is in flight.
TF32 differs from the existing BF16/F16 forms in two relevant ways:
K=8;The lowering therefore models TF32 as a distinct instruction form instead of
only changing the input-type suffix.
What changed
Device API / importer
Adds:
for the canonical
[[f32; 8]; 4]accumulator.The importer now emits a dedicated TF32
m64n64k8pointer-form NVVM operation.The existing legacy compatibility entry
remains explicitly unsupported and is not repurposed.
NVVM dialect
Adds:
WgmmaMmaM64N64K8F32Tf32OpWgmmaMmaGroupValuesM64N64K8F32Tf32OpThe TF32 value carrier uses the same 32 ×
f32accumulator interface as theexisting BF16/F16
m64n64carriers.No TF32 counted-loop or pipeline carrier ops are added.
MIR lowering
Extends canonical linear full-drain recognition to TF32.
A region of the form
is rewritten from the pointer-form intrinsic to the 32-value SSA carrier.
The generated PTX is:
with:
and no F16/BF16 transpose operands.
Linear regions remain homogeneous. Mixing TF32 with BF16 or F16 is rejected.
TF32 has no deferred pointer fallback.
Existing counted-loop and partial-wait recognizers remain BF16-only.
Tests
Adds coverage for:
m64n64k8APIm64n64k16TF32 entryValidation
NVVM dialect tests:
Importer WGMMA path test:
WGMMA lowering tests:
End-to-end WGMMA value-carrier PTX tests:
All six
ptxas -arch=sm_90aprobes report:The TF32
m64n64k8.f32.tf32.tf32mnemonic is accepted directly byptxas.Book validation:
Scope
This PR deliberately does not add:
m64n64k16_f32_tf32APIThose remain fail-closed and can be addressed independently.