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

core: Add support for nested inferrence in IRDL #2005

Merged
merged 9 commits into from
Jan 25, 2024
Merged

Conversation

math-fehr
Copy link
Collaborator

This PR allows us to infer the types of some operands and results from the types of other operands and results.

It does so by adding three functions in AttrConstraint:

  • get_resolved_variables: This function returns the set of ConstraintVar that will be set during verification.
  • can_infer: Returns True if we can infer a unique attribute represented by the AttrConstraint from the assignment of ConstraintVar.
  • infer: Returns the only attribute that satisfy this constraint, given the constraint variables.

We use these methods to get all ConstraintVar from the parsed operand/result types present in the syntax, then infer the constraints on the types that are not in the syntax.

@math-fehr math-fehr requested a review from PapyChacal January 23, 2024 13:39
@math-fehr math-fehr self-assigned this Jan 23, 2024
@math-fehr math-fehr added the core xDSL core (ir, textual format, ...) label Jan 23, 2024
Copy link

codecov bot commented Jan 23, 2024

Codecov Report

Attention: 7 lines in your changes are missing coverage. Please review.

Comparison is base (37968f8) 90.03% compared to head (0e867f0) 90.04%.
Report is 1 commits behind head on main.

Files Patch % Lines
xdsl/irdl/irdl.py 79.41% 3 Missing and 4 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2005      +/-   ##
==========================================
+ Coverage   90.03%   90.04%   +0.01%     
==========================================
  Files         289      289              
  Lines       35768    35882     +114     
  Branches     5275     5287      +12     
==========================================
+ Hits        32202    32309     +107     
- Misses       2814     2818       +4     
- Partials      752      755       +3     

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

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.

Yaaay 🚀

@PapyChacal PapyChacal merged commit efe08f9 into main Jan 25, 2024
9 checks passed
@PapyChacal PapyChacal deleted the fehr/infer-irdl branch January 25, 2024 10:51
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, ...)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants