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

Use properties for attributes for many dialects #7736

Merged
merged 1 commit into from
Oct 26, 2024

Conversation

youngar
Copy link
Member

@youngar youngar commented Oct 26, 2024

This change enables the use of operation properties for more dialects in CIRCT. The option to not use properties is going to be removed in a future release of MLIR, but as well we expect this change to bring a performance improvement.

For all these dialects, the only change required was to properly infer return types. Some operations were hardcoded to search through the attributes, and the attribute was moved to the property storage. By using the generated adaptor classes, we can abstract over where the interesting attribute is stored.

For future work, some code may be refactored for further performance wins now that we are using properties. In particular usages setAttr and getAttr may be made faster by using a less generic op transformation interface.

This change enables the use of operation properties for more dialects in
CIRCT. The option to *not* use properties is going to be removed in a
future release of MLIR, but as well we expect this change to bring a
performance improvement.

For all these dialects, the only change required was to properly infer
return types.  Some operations were hardcoded to search through the
attributes, and the attribute was moved to the property storage. By
using the generated adaptor classes, we can abstract over where the
interesting attribute is stored.

For future work, some code may be refactored for further performance
wins now that we are using properties. In particular usages `setAttr`
and `getAttr` may be made faster by using a less generic op
transformation interface.
Copy link
Member

@uenoku uenoku left a comment

Choose a reason for hiding this comment

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

Looks awesome!

@youngar
Copy link
Member Author

youngar commented Oct 26, 2024

Updated to include all dialects but FIRRTL, it's going to take more work than everything else put together 😂 .

I launched a full nightly integration test on this, just to be sure. It is running here.

Testing this on a FIRRTL flow, seems like it doesn't affect most passes, but these two stand out: (this is new/old)
LowerFIRRTLToHW -> 51%
VerifyObjectFields -> 74%

@youngar youngar merged commit 54aa4e3 into llvm:main Oct 26, 2024
21 checks passed
@youngar youngar deleted the firrtl-interface branch October 26, 2024 06:42
@uenoku
Copy link
Member

uenoku commented Oct 26, 2024

That's really impressive!

@teqdruid
Copy link
Contributor

I could've sworn we had this turned on for more dialects... I think our of the reasons you don't see more speedup is since it was already turned on for the comb and seq dialects. I suspect you'll see much more when you do this for the firrtl dialect.

Thanks!

seldridge added a commit that referenced this pull request Oct 28, 2024
Add a region verifier to OM dialect's Class Op.  This verifies that the
terminator returns the right number of fields with the correct types that
match the declared type of the Class Op.

Fixes #7736.

Signed-off-by: Schuyler Eldridge <schuyler.eldridge@sifive.com>
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