Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[LLVMGPU] Support CastTypeToFitMMA on TransformDialect script. #17884

Merged
merged 3 commits into from
Jul 12, 2024

Conversation

raikonenfnu
Copy link
Collaborator

Previously CastTypeToFitMMA relies on the mma_schedule attribute on the function's translationInfo to obtain information about iree.amdgpu.mma(intrnisic selected).

While this is fine for C++ pipeline, the IR generated from TransformDialect script do not have such information. Instead IR generated in TD script typically annotate the iree.amdgpu.mma(intrnisic selected) directly on the vector.contractOps.

This is a crucial part of enabling performant the latest attention compilation pipeline (with online attn + transpose fusion) which is based on TD scripts.

Copy link
Contributor

@qedawkins qedawkins left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM


if (scheduleAttr) {
func.walk([&](vector::ContractionOp contract) {
contract->setAttr("iree.amdgpu.mma", scheduleAttr.getIntrinsic());
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: I would check if the contract already has this attribute set and only set it if not present. Also maybe add a comment

// Import mma type from dispatch schedule attribute if present.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That makes sense :)

@antiagainst antiagainst merged commit be461bd into iree-org:main Jul 12, 2024
52 checks passed
LLITCHEV pushed a commit to LLITCHEV/iree that referenced this pull request Jul 30, 2024
…org#17884)

Previously CastTypeToFitMMA relies on the `mma_schedule` attribute on
the function's translationInfo to obtain information about
`iree.amdgpu.mma`(intrnisic selected).

While this is fine for C++ pipeline, the IR generated from
TransformDialect script do not have such information. Instead IR
generated in TD script typically annotate the
`iree.amdgpu.mma`(intrnisic selected) directly on the
vector.contractOps.

This is a crucial part of enabling performant the latest attention
compilation pipeline (with online attn + transpose fusion) which is
based on TD scripts.

---------

Co-authored-by: Kunwar Grover <[email protected]>
Signed-off-by: Lubo Litchev <[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.

4 participants