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

core: (irdl) Add regions to declarative assembly format #3065

Merged
merged 13 commits into from
Aug 21, 2024

Conversation

kimxworrall
Copy link
Collaborator

Added support for regions to the declarative assembly format.

The declarative assembly format now supports:

  • Referring to region variables
  • Referring to optional or variadic region variables
  • Printing custom assembly for region variables

The format requires that:

  • The attr-dict-with-keyword directive is present and not attr-dict. This is to maintain consistency with mlir.
  • The regions appear after the attributes.

Also added tests.

@kimxworrall kimxworrall requested a review from alexarice August 19, 2024 12:36
@kimxworrall kimxworrall self-assigned this Aug 19, 2024
Copy link
Collaborator

@alexarice alexarice left a comment

Choose a reason for hiding this comment

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

Could you comment on why regions must come after attributes? I can't see anything about this in the mlir documentation (which doesn't mean it's not true)

xdsl/irdl/declarative_assembly_format.py Outdated Show resolved Hide resolved
xdsl/irdl/operations.py Outdated Show resolved Hide resolved
xdsl/tools/xdsl-opt Outdated Show resolved Hide resolved
Copy link
Collaborator

@alexarice alexarice left a comment

Choose a reason for hiding this comment

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

Haven't read through everything but here's some comments

tests/irdl/test_declarative_assembly_format.py Outdated Show resolved Hide resolved
xdsl/irdl/declarative_assembly_format.py Outdated Show resolved Hide resolved
xdsl/irdl/declarative_assembly_format.py Outdated Show resolved Hide resolved
xdsl/irdl/declarative_assembly_format.py Outdated Show resolved Hide resolved
xdsl/tools/xdsl-opt Outdated Show resolved Hide resolved
…s' into kim/declarative-assembly-parser/add-regions. Remove casts.
Copy link
Collaborator

@alexarice alexarice left a comment

Choose a reason for hiding this comment

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

There's still two files that you've not touched being pulled in somehow. I've left a few minor comments but looking good, will give it a test tomorrow

xdsl/irdl/declarative_assembly_format.py Outdated Show resolved Hide resolved
xdsl/irdl/declarative_assembly_format.py Outdated Show resolved Hide resolved
xdsl/irdl/declarative_assembly_format.py Outdated Show resolved Hide resolved
xdsl/irdl/declarative_assembly_format.py Show resolved Hide resolved
@alexarice
Copy link
Collaborator

I also have no idea why the mlir integration tests are failing

Copy link

codecov bot commented Aug 19, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 89.90%. Comparing base (5299b90) to head (3ab7c03).
Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3065      +/-   ##
==========================================
+ Coverage   89.88%   89.90%   +0.02%     
==========================================
  Files         418      418              
  Lines       52764    52913     +149     
  Branches     8175     8202      +27     
==========================================
+ Hits        47426    47571     +145     
- Misses       4013     4015       +2     
- Partials     1325     1327       +2     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

kimxworrall and others added 2 commits August 20, 2024 10:17
Co-authored-by: Sasha Lopoukhine <superlopuh@gmail.com>
Co-authored-by: Sasha Lopoukhine <superlopuh@gmail.com>
Copy link
Collaborator

@PapyChacal PapyChacal left a comment

Choose a reason for hiding this comment

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

Amazing to see that in!

The implementation and existing tests seem perfect to me, only have some minor polish comments :) Making this an approval as at this point I consider any further polishing a bonus, the feature seems ready to benefit xDSL in itself!

Thanks a lot!

Fix region directive formats to be consistent by changing them to dollar-ident
Copy link
Collaborator

@alexarice alexarice left a comment

Choose a reason for hiding this comment

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

I've had a little test locally and this seems reasonable. Thanks for implementing this. Happy for this to be merged once the remaining comments are resolved

@superlopuh superlopuh merged commit 600dd91 into main Aug 21, 2024
14 checks passed
@superlopuh superlopuh deleted the kim/declarative-assembly-parser/add-regions branch August 21, 2024 06:57
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