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

dialect: (irdl) Add region and attributes operations #3049

Merged
merged 11 commits into from
Aug 18, 2024

Conversation

alexarice
Copy link
Collaborator

Adds RegionsOp, RegionOp, RegionType, and AttributesOp to irdl

@alexarice alexarice added dialects Changes on the dialects testing PRs that modify tests labels Aug 16, 2024
@alexarice alexarice self-assigned this Aug 16, 2024
Copy link

codecov bot commented Aug 16, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 89.89%. Comparing base (e70919f) to head (53c401d).
Report is 11 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3049      +/-   ##
==========================================
+ Coverage   89.86%   89.89%   +0.02%     
==========================================
  Files         415      416       +1     
  Lines       52078    52232     +154     
  Branches     8048     8075      +27     
==========================================
+ Hits        46801    46955     +154     
- Misses       3983     3984       +1     
+ Partials     1294     1293       -1     

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

xdsl/printer.py Outdated Show resolved Hide resolved
Co-authored-by: Sasha Lopoukhine <superlopuh@gmail.com>
Co-authored-by: Sasha Lopoukhine <superlopuh@gmail.com>
xdsl/printer.py Outdated
Comment on lines 262 to 272
if not elems:
self.print("{}")
else:
self.print("{ ")
for i, (key, value) in enumerate(elems.items()):
if i:
self.print_string(delimiter)
print_key(key)
self.print_string(" = ")
print_value(value)
self.print(" }")
Copy link
Member

Choose a reason for hiding this comment

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

Just noticed this, I don't think it belongs in a PR tagged as dialects, since it's actually a core change. Why is it necessary?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

It's not "necessary", I could just put this logic in the printer for AttributesOp, but I thought it would make sense to use the print_dictionary function and I (maybe incorrectly) thought that since it was used nowhere else that it would be safe to modify/improve

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I think if we want to change this to insert newlines then the logic has to be done from a method in Printer, as the newline methods are private

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Would be happy to split this change off into a separate pr if wanted

Copy link
Member

Choose a reason for hiding this comment

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

Hmm, that's weird that it's not used... I'm also surprised none of the tests fail... My first instinct is to remove the helper if it's not used. In either case, I would probably recommend do this in a custom way in your custom syntax.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I have reverted the core change and put improved printing in AttributesOp

@alexarice
Copy link
Collaborator Author

I simplified the printing a bit, removing the empty case as this should never occur in practice (in fact mlir does not even parse it). I also added the verifier that mlir has to check that there are the same number of names and values, is it worth adding a test for this?

@alexarice
Copy link
Collaborator Author

Just realised that mlir does parse the empty case, but does it by omitting the curly braces entirely

@alexarice alexarice merged commit e4704b3 into main Aug 18, 2024
10 checks passed
@alexarice alexarice deleted the alexarice/irdl-update-2 branch August 18, 2024 16:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dialects Changes on the dialects testing PRs that modify tests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants