Skip to content

[Codegen] NFC: Lift DataTiledMMA inner_tiled lowering helpers into MMAUtils. - #24326

Merged
bjacob merged 1 commit into
mainfrom
users/bjacob/nfc-mma-utils
May 1, 2026
Merged

bjacob merged 1 commit into
mainfrom
users/bjacob/nfc-mma-utils

Conversation

@bjacob

@bjacob bjacob commented Apr 30, 2026

Copy link
Copy Markdown
Collaborator

Moves the body of DataTiledMMAAttr::buildUnderlyingOperations and its private helpers (incrementIndices, flattenVector, distributeMmaFragmentToIntrinsics) out of the GPU dialect into a new Codegen/Utils/MMAUtils.{h,cpp}. The shared
buildDataTiledMMAUnderlyingOperations takes a callback for the architecture-specific MMA op emission, so future CPU support can reuse everything except the per-intrinsic op creation.

Also consolidates the HoistableConversionOp tag string literals (kDataTiledAcc{Distribute,Reassemble}, kRdna3{Interleave,Deinterleave}Acc, kVDMFMA{Interleave,Deinterleave}Acc) into the new header so that paired tags — which match by string — can no longer drift between translation units.

GPU's DataTiledMMAAttr::buildUnderlyingOperations is now a thin wrapper that supplies a callback delegating to the existing createMmaOp. GPU's DataTiledScaledMMAAttr::buildUnderlyingOperations keeps using the helpers via using declarations.

No functional change.

Progress towards #24323

…AUtils.

Moves the body of `DataTiledMMAAttr::buildUnderlyingOperations` and its
private helpers (`incrementIndices`, `flattenVector`,
`distributeMmaFragmentToIntrinsics`) out of the GPU dialect into a new
`Codegen/Utils/MMAUtils.{h,cpp}`. The shared
`buildDataTiledMMAUnderlyingOperations` takes a callback for the
architecture-specific MMA op emission, so future CPU support can reuse
everything except the per-intrinsic op creation.

Also consolidates the HoistableConversionOp tag string literals
(kDataTiledAcc{Distribute,Reassemble}, kRdna3{Interleave,Deinterleave}Acc,
kVDMFMA{Interleave,Deinterleave}Acc) into the new header so that paired
tags — which match by string — can no longer drift between translation
units.

GPU's `DataTiledMMAAttr::buildUnderlyingOperations` is now a thin wrapper
that supplies a callback delegating to the existing `createMmaOp`. GPU's
`DataTiledScaledMMAAttr::buildUnderlyingOperations` keeps using the
helpers via `using` declarations.

No functional change for GPU.

Signed-off-by: Benoit Jacob <[email protected]>

Progress towards #24323
@bjacob bjacob mentioned this pull request Apr 30, 2026
25 of 28 tasks
@bjacob
bjacob marked this pull request as ready for review April 30, 2026 19:37
@bjacob
bjacob merged commit 404b958 into main May 1, 2026
64 of 66 checks passed
@bjacob
bjacob deleted the users/bjacob/nfc-mma-utils branch May 1, 2026 14:37
bjacob added a commit that referenced this pull request May 4, 2026
Implements CPU's `DataTiledMMAAttr::buildUnderlyingOperations` by
reusing the shared `Codegen::buildDataTiledMMAUnderlyingOperations` from
#24326. CPU passes a callback, `createCpuMmaIntrinsicCall`, that emits
an `llvm.call_intrinsic` for each per-intrinsic invocation. The function
dispatches on the `MMAIntrinsic` enum value through a switch.

Progress towards #24323

---------

Co-authored-by: Han-Chung Wang <[email protected]>
jerryyin pushed a commit that referenced this pull request May 7, 2026
…AUtils. (#24326)

Moves the body of `DataTiledMMAAttr::buildUnderlyingOperations` and its
private helpers (`incrementIndices`, `flattenVector`,
`distributeMmaFragmentToIntrinsics`) out of the GPU dialect into a new
`Codegen/Utils/MMAUtils.{h,cpp}`. The shared
`buildDataTiledMMAUnderlyingOperations` takes a callback for the
architecture-specific MMA op emission, so future CPU support can reuse
everything except the per-intrinsic op creation.

Also consolidates the HoistableConversionOp tag string literals
(kDataTiledAcc{Distribute,Reassemble},
kRdna3{Interleave,Deinterleave}Acc, kVDMFMA{Interleave,Deinterleave}Acc)
into the new header so that paired tags — which match by string — can no
longer drift between translation units.

GPU's `DataTiledMMAAttr::buildUnderlyingOperations` is now a thin
wrapper that supplies a callback delegating to the existing
`createMmaOp`. GPU's `DataTiledScaledMMAAttr::buildUnderlyingOperations`
keeps using the helpers via `using` declarations.

No functional change.

Progress towards #24323
jerryyin pushed a commit that referenced this pull request May 7, 2026
Implements CPU's `DataTiledMMAAttr::buildUnderlyingOperations` by
reusing the shared `Codegen::buildDataTiledMMAUnderlyingOperations` from
#24326. CPU passes a callback, `createCpuMmaIntrinsicCall`, that emits
an `llvm.call_intrinsic` for each per-intrinsic invocation. The function
dispatches on the `MMAIntrinsic` enum value through a switch.

Progress towards #24323

---------

Co-authored-by: Han-Chung Wang <[email protected]>
RattataKing pushed a commit to RattataKing/iree that referenced this pull request May 27, 2026
…AUtils. (iree-org#24326)

Moves the body of `DataTiledMMAAttr::buildUnderlyingOperations` and its
private helpers (`incrementIndices`, `flattenVector`,
`distributeMmaFragmentToIntrinsics`) out of the GPU dialect into a new
`Codegen/Utils/MMAUtils.{h,cpp}`. The shared
`buildDataTiledMMAUnderlyingOperations` takes a callback for the
architecture-specific MMA op emission, so future CPU support can reuse
everything except the per-intrinsic op creation.

Also consolidates the HoistableConversionOp tag string literals
(kDataTiledAcc{Distribute,Reassemble},
kRdna3{Interleave,Deinterleave}Acc, kVDMFMA{Interleave,Deinterleave}Acc)
into the new header so that paired tags — which match by string — can no
longer drift between translation units.

GPU's `DataTiledMMAAttr::buildUnderlyingOperations` is now a thin
wrapper that supplies a callback delegating to the existing
`createMmaOp`. GPU's `DataTiledScaledMMAAttr::buildUnderlyingOperations`
keeps using the helpers via `using` declarations.

No functional change.

Progress towards iree-org#24323
RattataKing pushed a commit to RattataKing/iree that referenced this pull request May 27, 2026
)

Implements CPU's `DataTiledMMAAttr::buildUnderlyingOperations` by
reusing the shared `Codegen::buildDataTiledMMAUnderlyingOperations` from
iree-org#24326. CPU passes a callback, `createCpuMmaIntrinsicCall`, that emits
an `llvm.call_intrinsic` for each per-intrinsic invocation. The function
dispatches on the `MMAIntrinsic` enum value through a switch.

Progress towards iree-org#24323

---------

Co-authored-by: Han-Chung Wang <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants