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: (constraints) add IntAttrConstraint #3797

Merged
merged 2 commits into from
Jan 30, 2025

Conversation

alexarice
Copy link
Collaborator

Adds a constraint that applies an integer constraint to the value of an integer attribute.

See: https://github.com/xdslproject/inconspiquous/blob/70f923cfe577b7eb48ece03d6f9a597c296cb698/inconspiquous/dialects/gate.py#L237
and https://github.com/xdslproject/inconspiquous/blob/70f923cfe577b7eb48ece03d6f9a597c296cb698/inconspiquous/dialects/qssa.py#L78

for an example of using this.

I'm unsure if this is the best place for this to live, or if it should be upstreamed at all.

@alexarice alexarice added the core xDSL core (ir, textual format, ...) label Jan 28, 2025
@alexarice alexarice self-assigned this Jan 28, 2025
Copy link

codecov bot commented Jan 28, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 91.25%. Comparing base (fa315a7) to head (26cc9b8).
Report is 12 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3797      +/-   ##
==========================================
+ Coverage   91.23%   91.25%   +0.01%     
==========================================
  Files         461      461              
  Lines       57480    57557      +77     
  Branches     5547     5549       +2     
==========================================
+ Hits        52443    52523      +80     
+ Misses       3615     3609       -6     
- Partials     1422     1425       +3     

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

)
def test_int_attr_extraction(program: str):
@irdl_op_definition
class IntAttrExtractOp(IRDLOperation):
Copy link
Collaborator

Choose a reason for hiding this comment

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

Mind pulling this and one below out and use a single definition? Fewer lines of code to eyeball over.

Comment on lines 3237 to 3238
class IntAttrExtractOp(IRDLOperation):
name = "test.int_attr_verify"
Copy link
Collaborator

Choose a reason for hiding this comment

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

Same here, plus a name for the class and its name that match (here one uses 'extract' and the other uses 'verify'

Copy link
Member

@superlopuh superlopuh left a comment

Choose a reason for hiding this comment

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

Very cool

@alexarice alexarice merged commit 9616a9b into main Jan 30, 2025
16 checks passed
@alexarice alexarice deleted the alexarice/int-attr-constraint branch January 30, 2025 11:44
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