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

dialects: (irdl) Update for mlir compatibility #3002

Merged
merged 11 commits into from
Aug 15, 2024
Merged

Conversation

alexarice
Copy link
Collaborator

Added the irdl.c_pred operation as well as adding variadicity attributes to operands and results. Also updated the pyrdl-to-irdl script so that it prints symbols correctly.

@alexarice alexarice added dialects Changes on the dialects testing PRs that modify tests labels Aug 9, 2024
@alexarice alexarice self-assigned this Aug 9, 2024
@alexarice alexarice changed the title dialects (IRDL): update for mlir compatibility dialects (irdl): update for mlir compatibility Aug 9, 2024
@alexarice alexarice changed the title dialects (irdl): update for mlir compatibility dialects (irdl): Update for mlir compatibility Aug 9, 2024
Copy link

codecov bot commented Aug 9, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 89.86%. Comparing base (e1f68b5) to head (ce8589d).
Report is 3 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #3002   +/-   ##
=======================================
  Coverage   89.85%   89.86%           
=======================================
  Files         413      413           
  Lines       51862    51928   +66     
  Branches     8009     8028   +19     
=======================================
+ Hits        46600    46663   +63     
- Misses       3972     3975    +3     
  Partials     1290     1290           

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

@@ -51,7 +51,7 @@ def op_def_to_irdl(op: type[IRDLOperation]) -> OperationOp:
if result_values:
builder.insert(ResultsOp(result_values))

return OperationOp(op_def.name, Region([block]))
return OperationOp(op_def.name.split(".")[-1], Region([block]))
Copy link
Member

Choose a reason for hiding this comment

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

this doesn't quite feel right, are there any tests for this? My understanding is the dialect name is everything up to the first dot, and the op name is everything after it

Copy link
Member

Choose a reason for hiding this comment

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

We probably want to centralise this logic somewhere

Copy link
Collaborator

Choose a reason for hiding this comment

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

Yep, should be the other way around! Split on the first dot and keep whatever's after.

More concretely, some ops have nested-like names, say scf.forall.in_parallel : dialect still is just scf, op name is forall.in_parallel, dot including.

And yes, we probably want to centraluze it ahah

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Any idea where the centralisation should live?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Now rebased onto #3003

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.

Yay ❤️

xdsl/dialects/irdl/irdl.py Show resolved Hide resolved
@@ -51,7 +51,7 @@ def op_def_to_irdl(op: type[IRDLOperation]) -> OperationOp:
if result_values:
builder.insert(ResultsOp(result_values))

return OperationOp(op_def.name, Region([block]))
return OperationOp(op_def.name.split(".")[-1], Region([block]))
Copy link
Collaborator

Choose a reason for hiding this comment

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

Yep, should be the other way around! Split on the first dot and keep whatever's after.

More concretely, some ops have nested-like names, say scf.forall.in_parallel : dialect still is just scf, op name is forall.in_parallel, dot including.

And yes, we probably want to centraluze it ahah

@alexarice alexarice changed the title dialects (irdl): Update for mlir compatibility dialects: (irdl) Update for mlir compatibility Aug 9, 2024
@alexarice alexarice changed the base branch from main to alexarice/split_name August 12, 2024 10:41
alexarice added a commit that referenced this pull request Aug 12, 2024
Adds a `Dialect.split_name` method as discussed in #3002

---------

Co-authored-by: Sasha Lopoukhine <superlopuh@gmail.com>
Base automatically changed from alexarice/split_name to main August 12, 2024 13:03
@alexarice alexarice force-pushed the alexarice/irdl-update branch from 5c5cff4 to 00a7acb Compare August 12, 2024 13:05
xdsl/dialects/irdl/irdl.py Outdated Show resolved Hide resolved
Comment on lines +55 to +56
class VariadicityAttr(EnumAttribute[VariadicityEnum], SpacedOpaqueSyntaxAttribute):
name = "irdl.variadicity"
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
class VariadicityAttr(EnumAttribute[VariadicityEnum], SpacedOpaqueSyntaxAttribute):
name = "irdl.variadicity"
class VariadicityAttr(EnumAttribute[VariadicityEnum], SpacedOpaqueSyntaxAttribute):
name = "irdl.variadicity"
SINGLE = VariadicityAttr(VariadicityEnum.SINGLE)

etc

@alexarice alexarice requested a review from superlopuh August 14, 2024 18:18
@alexarice alexarice merged commit b1b5355 into main Aug 15, 2024
10 checks passed
@alexarice alexarice deleted the alexarice/irdl-update branch August 15, 2024 09:25
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.

3 participants