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

misc: raise error if variadic results types aren't referenced in assembly format #3416

Merged
merged 2 commits into from
Nov 11, 2024

Conversation

superlopuh
Copy link
Member

@superlopuh superlopuh commented Nov 9, 2024

The number of results is not passed in when parsing operations. In the generic format, the type of the operation always specifies the types of the results, and resultSegmentSizes specifies the ranges of of the results if multiple are variadic. In order to support variadic results, the types an length of all variadic results must be present in the custom syntax.

@superlopuh superlopuh added core xDSL core (ir, textual format, ...) misc Miscellaneous labels Nov 9, 2024
@superlopuh superlopuh self-assigned this Nov 9, 2024
Copy link
Member Author

Choose a reason for hiding this comment

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

@gabrielrodcanal
This seemed like the most natural change, since the init always specifies the result type anyway.

Copy link

codecov bot commented Nov 9, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 90.17%. Comparing base (e150009) to head (694f40f).
Report is 8 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #3416   +/-   ##
=======================================
  Coverage   90.16%   90.17%           
=======================================
  Files         455      455           
  Lines       57467    57482   +15     
  Branches     5532     5530    -2     
=======================================
+ Hits        51815    51833   +18     
+ Misses       4195     4193    -2     
+ Partials     1457     1456    -1     

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

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 think this change is an oververification and blocks some currently valid definitions

@superlopuh superlopuh requested a review from alexarice November 11, 2024 09:50
@@ -154,7 +154,7 @@ class ChannelPutOp(IRDLOperation):
src_sizes = var_operand_def(IndexType())
src_strides = var_operand_def(IndexType())

async_token = opt_result_def(AsyncTokenAttr())
async_token = result_def(AsyncTokenAttr())
Copy link
Collaborator

Choose a reason for hiding this comment

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

Should these be in this PR?

Copy link
Member Author

Choose a reason for hiding this comment

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

These tests fail with my changes. This is because we silently always set variadic (meaning also optional) results to have length 1. Our filecheck passes whether or not the results are present in the CHECK lines, because we match on substrings, so we silently ignore whether there are 0 or 1 results. Without the change on this line, the tests crash with the NotImplementedError I added in this PR.

@superlopuh superlopuh merged commit 97cfc1f into main Nov 11, 2024
15 checks passed
@superlopuh superlopuh deleted the sasha/misc/assembly-format/var-results-rebase branch November 11, 2024 20:05
alexarice added a commit that referenced this pull request Dec 3, 2024
Sort of a revert of #3416, but I believe this fixes the underlying
problem.

Changes range constraint inference so that passing in a length is
optional. The rationale for this is that the length of operands is
always known, but the length of results is never known (as they can
always be omitted). Similarly updates the `can_infer` function.
EdmundGoodman pushed a commit to EdmundGoodman/xdsl that referenced this pull request Dec 6, 2024
…mbly format (xdslproject#3416)

The number of results is not passed in when parsing operations. In the
generic format, the type of the operation always specifies the types of
the results, and `resultSegmentSizes` specifies the ranges of of the
results if multiple are variadic. In order to support variadic results,
the types an length of all variadic results must be present in the
custom syntax.
EdmundGoodman pushed a commit to EdmundGoodman/xdsl that referenced this pull request Dec 6, 2024
Sort of a revert of xdslproject#3416, but I believe this fixes the underlying
problem.

Changes range constraint inference so that passing in a length is
optional. The rationale for this is that the length of operands is
always known, but the length of results is never known (as they can
always be omitted). Similarly updates the `can_infer` function.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
core xDSL core (ir, textual format, ...) misc Miscellaneous
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants