[TLE] Support cross-dtype Hopper WGMMA accumulator reuse - #1001
Draft
July-h5kf3 wants to merge 1 commit into
Draft
[TLE] Support cross-dtype Hopper WGMMA accumulator reuse#1001July-h5kf3 wants to merge 1 commit into
July-h5kf3 wants to merge 1 commit into
Conversation
Select the current instruction shape from the WGMMA operands while preserving a compatible accumulator C-register layout across FP8 and BF16 operations. Reject explicitly marked chains when their physical accumulator layouts are incompatible, and cover register/shared operands plus the failure path with MLIR tests.
July-h5kf3
requested review from
Galaxy1458,
i3wanna2,
menchunlei,
sunnycase and
zhzhcookie
as code owners
August 17, 2026 11:32
Vincent-Xiao
marked this pull request as draft
August 18, 2026 11:34
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.
Background
TLE user-promise pipelines can chain Hopper WGMMA operations whose input
dtypes use different instruction K shapes while accumulating into the same
FP32 C fragment. One concrete case is an FP8
m64n64k32operation followedby a BF16
m64n64k16operation.The physical ownership of the FP32 accumulator registers is determined by
the instruction M/N shape and the warp/CTA distribution. K determines the
current WGMMA instruction form, but does not change that C-register
ownership. Therefore, an accumulator can be reused across the FP8 and BF16
operations when their physical C layouts are compatible.
Problem
convertDotcurrently selectsinstrMNKonly from the result accumulator'sNvidiaMmaEncodingAttr. In a cross-dtype async chain, that result may retainthe preceding FP8/K32 encoding even though the current operands are BF16 and
require K16.
This has two forms:
DotOperandEncodingAttrcarries the BF16/K16parent MMA encoding, but lowering ignores it and uses the stale
accumulator encoding.
the current instruction K. The current operand dtypes are the authoritative
source for K, while M/N and C-register ownership must remain those of the
accumulator.
As a result, lowering may select the wrong WGMMA instruction shape for the
current operands instead of preserving the compatible accumulator layout and
emitting the BF16/K16 instruction.
Minimal reproducer
The following input models a BF16/K16 WGMMA consuming an FP32 accumulator
whose result encoding came from a preceding FP8/K32 WGMMA:
Run it with:
Before this change, lowering aborts in
WGMMAOpPattern::getPtxAsmwith:After this change, lowering succeeds and emits:
Fix
contract.
MMA encoding only when both encodings are Hopper encodings with matching
M/N,
warpsPerCTA, andCTALayout.operand dtypes (
f16/bf16-> 16, TF32 -> 8, FP8/int8 -> 32), whilepreserving the accumulator's M/N layout.
are incompatible or a valid shared/shared Hopper instruction K cannot be
selected.
__TLE__; ordinary non-TLE lowering is unchanged.Same-dtype WGMMA is a no-op under this selection because the inferred/current
instruction shape matches the accumulator encoding.
Tests
Added MLIR regression coverage for:
Local validation on H800/SM90:
The complete local TLE lit suite reports 65/72 PASS. The seven failures are
the same pre-existing failures observed in the environment's unmodified
compiler control; neither new cross-dtype test is among them.
A downstream FP8/BF16 MLA reproducer was also rebuilt with the patched
compiler:
regression; normalized geomean latency versus CUDA changed from
0.92844to
0.92780(approximately-0.07%, noise-level).Risk and scope
The change is limited to Hopper WGMMA instruction-shape selection under
__TLE__. It does not relax accumulator compatibility: M/N, warpdistribution, and CTA layout must still describe the same physical C
register ownership. Explicitly marked incompatible chains fail with a
diagnostic rather than silently selecting an instruction.
No public API is changed.
Related issue
None.