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

[Arc] Make the canonicalizer shuffle the input vector elements before merging #7394

Merged

Conversation

elhewaty
Copy link
Member

No description provided.

@elhewaty elhewaty force-pushed the add-optimization-to-canonicalizer branch from 4c6e9cf to c1a1f0d Compare July 31, 2024 04:18
@elhewaty elhewaty requested a review from maerhart July 31, 2024 04:18
Copy link
Contributor

@fabianschuiki fabianschuiki left a comment

Choose a reason for hiding this comment

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

Very neat! Cool to see that the shuffling allows you to merge more vectorize ops 😃.

Can you check whether this works on one of the cores in circt/arc-tests? Once it does I think this is ready to go! 🥳

lib/Dialect/Arc/Transforms/ArcCanonicalizer.cpp Outdated Show resolved Hide resolved
Comment on lines +645 to +646
if (tempVec != SmallVector<Value>(otherVecOp.getResults().begin(),
otherVecOp.getResults().end())) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Does tempVec != otherVecOp.getResults() not work here?

Copy link
Member Author

Choose a reason for hiding this comment

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

I will try, but I think getResults() returns result_range which cannot be converted into a SmallVector<Value> but is worth trying!

Copy link
Contributor

Choose a reason for hiding this comment

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

There should be an implicit conversion from SmallVector<Value> to an iterator range, which should theoretically be able to compare against a result range. Worth trying, don't worry if it doesn't work 😃

Copy link
Member Author

Choose a reason for hiding this comment

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

I didn't work!

 error: invalid operands to binary expression ('SmallVector<mlir::Value>' and '::mlir::Operation::result_range' (aka 'mlir::ResultRange'))
    if (tempVec != otherVecOp.getResults()) 

Copy link
Contributor

Choose a reason for hiding this comment

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

Thanks for checking 😃

Copy link
Member Author

Choose a reason for hiding this comment

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

@fabianschuiki, should I land this now?

Copy link
Member Author

Choose a reason for hiding this comment

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

It's 12:17 AM here, so please land it if it's Okay.

@elhewaty
Copy link
Member Author

Can you check whether this works on one of the cores in circt/arc-tests? Once it does I think this is ready to go! 🥳

The canonicalizer crashes 😢, I will test it before pushing but I need to reduce the test case.

@elhewaty elhewaty force-pushed the add-optimization-to-canonicalizer branch from c1a1f0d to 7818e2b Compare August 3, 2024 20:36
@elhewaty
Copy link
Member Author

elhewaty commented Aug 3, 2024

Very neat! Cool to see that the shuffling allows you to merge more vectorize ops 😃.

Can you check whether this works on one of the cores in circt/arc-tests? Once it does I think this is ready to go! 🥳

It works on the dual rocket core

@fabianschuiki fabianschuiki merged commit 17e85f1 into llvm:main Aug 4, 2024
4 checks passed
@elhewaty elhewaty deleted the add-optimization-to-canonicalizer branch August 4, 2024 15:45
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.

3 participants