[Compiler][gfx120] Add modC/reuseA/reuseB to MmaOpGFX1250_WMMAType - #1001
[Compiler][gfx120] Add modC/reuseA/reuseB to MmaOpGFX1250_WMMAType#1001jli-melchior wants to merge 2 commits into
Conversation
e6cbc6c to
27056e1
Compare
| "bool":$clamp, | ||
| // Intrinsic attributes forwarded to the ROCDL WMMA op: modC (I16 | ||
| // C-operand modifier) and reuseA/reuseB (I1 operand-reuse scheduler | ||
| // hints). Default 0/false. | ||
| "int32_t":$modC, | ||
| "bool":$reuseA, | ||
| "bool":$reuseB |
There was a problem hiding this comment.
Update to DefaultValuedParam to simplify assembly format.
The non-scale WMMA path was missing modC/reuseA/reuseB parameters that its sibling WMMAScaleType already had. The lowering hardcoded WMMACModifier::none and reuseA/reuseB=false, causing mma_atom_call to emit rocdl.wmma ops without an explicit modC attribute. Since the ROCDL intrinsic distinguishes absent modC from modC=0, this produced incorrect ISA encodings and numerical precision regression for bf16 WMMA kernels. Add modC (int32_t), reuseA (bool), reuseB (bool) to the type with back-compat builders defaulting to 0/false/false, forward them through the Python binding and wrapper, and pass them to the ROCDL ops at emission time. Co-Authored-By: Claude <noreply@anthropic.com>
44bfe88 to
2b691b8
Compare
|
|
|
Maybe a better way is to add a separate pass to attach these reuse attrs automatically. |
reuseA/reuseB are bit fields of the wmma instruction that hint the XDL engine to reuse operand data. Exposing them gives users more flexibility for different scheduling scenarios ? |
Yes it sounds a good idea for a follow-up optimization which programmers may not set these flags, And it also need these fields on the type to construct the updated atom. This PR provides the foundation whether the flags are set manually or by a future automatic pass. |
|
I can't see how callers could conveniently control reuse flags within a single |
In mha kernel i haven‘t see use the fx.gemm to call mma atom, the gemm kernel can use this to get a perf improvement, but this need a special pattern for reuseA/reusesB. This may need different pattern according to different cases. |
The non-scale WMMA path was missing modC/reuseA/reuseB parameters that its sibling WMMAScaleType already had. The lowering hardcoded WMMACModifier::none and reuseA/reuseB=false, causing mma_atom_call to emit rocdl.wmma ops without an explicit modC attribute. Since the ROCDL intrinsic distinguishes absent modC from modC=0, this produced incorrect ISA encodings and numerical precision regression for bf16 WMMA kernels.
Add modC (int32_t), reuseA (bool), reuseB (bool) to the type with back-compat builders defaulting to 0/false/false, forward them through the Python binding and wrapper, and pass them to the ROCDL ops at emission time.
Motivation
Technical Details
Test Plan
Test Result
Submission Checklist