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

transformations: Add convert-arith-to-varith pass #3242

Merged
merged 6 commits into from
Oct 8, 2024

Conversation

AntonLydike
Copy link
Collaborator

@AntonLydike AntonLydike commented Oct 3, 2024

Adds a pass convert-arith-to-varith that converts arith adds and muls to varith adds and muls. More tests coming.

Stacked on top of #3241

@AntonLydike AntonLydike added hackathon To be tackled at the hackathon transformations Changes or adds a transformatio labels Oct 3, 2024
@AntonLydike AntonLydike self-assigned this Oct 3, 2024
@AntonLydike AntonLydike force-pushed the anton/arith-to-varith branch 3 times, most recently from 3ea0950 to 65f9823 Compare October 4, 2024 12:52
Copy link

codecov bot commented Oct 4, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 89.92%. Comparing base (104245e) to head (d82cf41).
Report is 10 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #3242   +/-   ##
=======================================
  Coverage   89.92%   89.92%           
=======================================
  Files         441      442    +1     
  Lines       55417    55479   +62     
  Branches     8643     8655   +12     
=======================================
+ Hits        49832    49889   +57     
- Misses       4158     4161    +3     
- Partials     1427     1429    +2     

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

Base automatically changed from anton/varith to main October 4, 2024 13:11
Copy link
Collaborator

@n-io n-io left a comment

Choose a reason for hiding this comment

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

Thanks, looks good!


class MergeVarithOpsPattern(RewritePattern):
"""
Merges operands that are varith or arith ops into
Copy link
Collaborator

Choose a reason for hiding this comment

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

I'm not quite sure what you mean here

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Expanded on it!

if len(possibly_erased_ops) == 0:
return

rewriter.replace_matched_op(type(op)(*new_operands)) # pyright: ignore[reportUnknownArgumentType]
Copy link
Collaborator

Choose a reason for hiding this comment

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

nit: Could you include a comment for why you need to ignore the warning?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Done!

@AntonLydike AntonLydike merged commit 4a02c8a into main Oct 8, 2024
14 checks passed
@AntonLydike AntonLydike deleted the anton/arith-to-varith branch October 8, 2024 12:58
emmau678 pushed a commit that referenced this pull request Oct 8, 2024
Adds a pass `convert-arith-to-varith` that converts arith adds and muls
to varith adds and muls.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
hackathon To be tackled at the hackathon transformations Changes or adds a transformatio
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants