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: (builtin) Custom syntax for UnrealizedConversionCastOp #1406

Merged
merged 9 commits into from Aug 4, 2023

Conversation

kingiler
Copy link
Collaborator

@kingiler kingiler commented Aug 3, 2023

Custom syntax for UnrealizedConversionCastOp in par with MLIR. Address #1402

@kingiler kingiler self-assigned this Aug 3, 2023
@kingiler kingiler added enhancement New feature or request dialects Changes on the dialects testing PRs that modify tests minor For minor PRs, easy and quick to review, quickly mergeable labels Aug 3, 2023
@codecov
Copy link

codecov bot commented Aug 3, 2023

Codecov Report

Patch coverage: 100.00% and no project coverage change.

Comparison is base (7116e21) 90.09% compared to head (c86f44c) 90.10%.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #1406   +/-   ##
=======================================
  Coverage   90.09%   90.10%           
=======================================
  Files         214      214           
  Lines       26410    26434   +24     
  Branches     3912     3914    +2     
=======================================
+ Hits        23794    23818   +24     
  Misses       2003     2003           
  Partials      613      613           
Files Changed Coverage Δ
xdsl/dialects/builtin.py 85.77% <100.00%> (+0.51%) ⬆️

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

@kingiler kingiler marked this pull request as ready for review August 3, 2023 14:40
@AntonLydike
Copy link
Collaborator

Can you add proper interop tests as well? Just checking that mlir can parse our custom syntax and it doesn't fail

@kingiler
Copy link
Collaborator Author

kingiler commented Aug 3, 2023

Tests are added for print and parsing custom syntax.

@superlopuh
Copy link
Member

I think @AntonLydike means a test like tests/filecheck/mlir-conversion/with-mlir/dialects/builtin/unrealized_conversion_cast.mlir but that would roundtrip the custom syntax as opposed to the custom syntax

@@ -1,16 +1,22 @@
// RUN: xdsl-opt %s | xdsl-opt --print-op-generic | filecheck %s
// RUN: xdsl-opt %s | xdsl-opt --print-op-generic | xdsl-opt | filecheck %s
Copy link
Member

Choose a reason for hiding this comment

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

I'm not sure of the benefit of three xdsl-opts

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

For around-tripping printing and parsing of both generic and custom syntax.

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.

This implementation doesn't handle nor test extra attributes in the syntax.
Just noticed the other day that we have this problem with quite a few custom syntaxes, we should be careful!

%3 = "builtin.unrealized_conversion_cast"(%0) : (i64) -> i64
// CHECK: %4 = builtin.unrealized_conversion_cast to i64
Copy link
Collaborator

Choose a reason for hiding this comment

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

Oh, never seen that case, what is a cast from nothing to a type? 🤔
Looked for a case because I see it specially implemented in the parser.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

UnrealizedConversionCastOp seems has 0-1 conversion.

@kingiler
Copy link
Collaborator Author

kingiler commented Aug 4, 2023

Interop tests has been added.

@kingiler
Copy link
Collaborator Author

kingiler commented Aug 4, 2023

Attribute dict has been handled.

@kingiler kingiler merged commit be6d80d into main Aug 4, 2023
10 checks passed
@kingiler kingiler deleted the custom_syntax_cast branch August 4, 2023 14:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dialects Changes on the dialects enhancement New feature or request minor For minor PRs, easy and quick to review, quickly mergeable testing PRs that modify tests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants