-
Notifications
You must be signed in to change notification settings - Fork 73
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: allow result variadic inference #3559
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #3559 +/- ##
========================================
Coverage 90.39% 90.40%
========================================
Files 466 466
Lines 58642 58760 +118
Branches 5585 5599 +14
========================================
+ Hits 53009 53121 +112
- Misses 4202 4203 +1
- Partials 1431 1436 +5 ☔ View full report in Codecov by Sentry. |
xdsl/irdl/constraints.py
Outdated
@@ -677,17 +677,21 @@ def get_variable_extractors( | |||
""" | |||
return {} | |||
|
|||
def can_infer(self, var_constraint_names: Set[str]) -> bool: | |||
def can_infer(self, var_constraint_names: Set[str], length_known: bool) -> bool: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
At the call site, the True
or False
don't communicate much in terms of what's going on, how do you feel about making the argument mandatory?
def can_infer(self, var_constraint_names: Set[str], length_known: bool) -> bool: | |
def can_infer(self, var_constraint_names: Set[str], *, length_known: bool) -> bool: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
absolutely, I might do the same for infer
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very very nice
I'm think I'm going to add a test that shows that trying to infer a |
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.Probably needs a test of something. 🤷