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

dialects: (arith) add truncation option to ConstantOp #3635

Merged
merged 3 commits into from
Dec 13, 2024

Conversation

alexarice
Copy link
Collaborator

split off from #3583

@alexarice alexarice added dialects Changes on the dialects minor For minor PRs, easy and quick to review, quickly mergeable labels Dec 13, 2024
@alexarice alexarice requested a review from superlopuh December 13, 2024 11:04
@alexarice alexarice self-assigned this Dec 13, 2024
Copy link

codecov bot commented Dec 13, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 90.74%. Comparing base (237c605) to head (afb7644).
Report is 2 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #3635   +/-   ##
=======================================
  Coverage   90.74%   90.74%           
=======================================
  Files         465      465           
  Lines       58750    58755    +5     
  Branches     5630     5630           
=======================================
+ Hits        53312    53317    +5     
  Misses       3997     3997           
  Partials     1441     1441           

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

uv.lock Outdated
Copy link
Member

Choose a reason for hiding this comment

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

uh oh, let's separate this out?

Copy link
Member

Choose a reason for hiding this comment

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

This is my bad, I think the new workflow should be to make this change a part of the dependabot PR, I'll do this quickly

Copy link
Member

Choose a reason for hiding this comment

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

Ah no I merged textual, you have a newer version of ruff than our requirements

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This is not ideal that switching between branches messes up lock files

Copy link
Member

Choose a reason for hiding this comment

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

In theory, this is exactly what UV is supposed to enable, switching branches with different dependencies and updating those silently

Comment on lines 167 to +180
@staticmethod
def from_int_and_width(
value: int | IntAttr, value_type: int | IntegerType | IndexType
value: int | IntAttr,
value_type: int | IntegerType | IndexType,
*,
truncate_bits: bool = False,
) -> ConstantOp:
if isinstance(value_type, int):
value_type = IntegerType(value_type)
return ConstantOp.create(
result_types=[value_type],
properties={"value": IntegerAttr(value, value_type)},
properties={
"value": IntegerAttr(value, value_type, truncate_bits=truncate_bits)
},
Copy link
Member

Choose a reason for hiding this comment

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

could you please add a unit test for this?

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.

TY

@alexarice alexarice merged commit 1f67b7d into main Dec 13, 2024
15 checks passed
@alexarice alexarice deleted the alexarice/truncate-constant branch December 13, 2024 12:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dialects Changes on the dialects minor For minor PRs, easy and quick to review, quickly mergeable
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants