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

[MatchTargetSize] Extend for-loop canonicalization pattern #2045

Merged
merged 8 commits into from
Sep 9, 2024

Conversation

jopperm
Copy link
Contributor

@jopperm jopperm commented Aug 29, 2024

Support canonicalization of dependent scf.for loops by re-gluing individual results after the loop.

See #1947 for more context / the complete PoC.

@jopperm jopperm self-assigned this Aug 29, 2024

// If a results is used by another scf.for loop, we re-glue the individual
// results together to allow canonicalization of the dependent loop, too.
llvm::SmallDenseMap<OpResult, Value> reglueMap;
Copy link
Contributor

Choose a reason for hiding this comment

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

we can extend the new condition by handling the scf.yield operation.
no need to add a map.
if the scf.yield has a operand whose def is glue, then split it into two operands

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I've simplified the code to always insert glue ops after the loop, and replacing results immediately without storing them in a map.

Copy link
Contributor

@Dewei-Wang-sh Dewei-Wang-sh left a comment

Choose a reason for hiding this comment

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

LGTM

@Dewei-Wang-sh Dewei-Wang-sh merged commit 66bf5d8 into llvm-target Sep 9, 2024
4 checks passed
@whitneywhtsang whitneywhtsang deleted the jopperm/mts-dependent-loops branch September 9, 2024 21:11
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.

[#6 Attention Performance] extend attention support for Causal = True
4 participants