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 (scf): Canonicalization for const rehoisting #3421

Merged
merged 2 commits into from
Nov 11, 2024

Conversation

mamanain
Copy link
Collaborator

We want to carry out constant definition from loop definition to allow more loop optimizations. In mlir this is done in cse on constants inside the applyPatternsAndFoldGreedily function in the PatternRewriter. In the future we might port this functionality so this pattern will become redundant.

@mamanain mamanain added dialects Changes on the dialects transformations Changes or adds a transformatio labels Nov 11, 2024
@mamanain mamanain self-assigned this Nov 11, 2024
Copy link

codecov bot commented Nov 11, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 90.16%. Comparing base (9b64a9b) to head (d7816ff).
Report is 3 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #3421   +/-   ##
=======================================
  Coverage   90.16%   90.16%           
=======================================
  Files         455      455           
  Lines       57467    57509   +42     
  Branches     5532     5536    +4     
=======================================
+ Hits        51815    51854   +39     
- Misses       4195     4196    +1     
- Partials     1457     1459    +2     

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

@superlopuh superlopuh self-requested a review November 11, 2024 17:35
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.

Thank you!

Comment on lines 26 to 27
rewriter.insert_op_before_matched_op([new_const := child_op.clone()])
rewriter.replace_op(child_op, [], new_const.results)
Copy link
Member

Choose a reason for hiding this comment

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

nit:

Suggested change
rewriter.insert_op_before_matched_op([new_const := child_op.clone()])
rewriter.replace_op(child_op, [], new_const.results)
rewriter.insert_op_before_matched_op((new_const := child_op.clone(),))
rewriter.replace_op(child_op, (), new_const.results)

@@ -1,4 +1,4 @@
// RUN: xdsl-opt -p canonicalize %s | filecheck %s
// RUN: xdsl-opt -p canonicalize --split-input-file %s | filecheck %s
Copy link
Member

Choose a reason for hiding this comment

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

is this needed?

@mamanain mamanain merged commit b14e34a into xdslproject:main Nov 11, 2024
15 checks passed
EdmundGoodman pushed a commit to EdmundGoodman/xdsl that referenced this pull request Dec 6, 2024
We want to carry out constant definition from loop definition to allow
more loop optimizations. In mlir this is done in cse on constants inside
the `applyPatternsAndFoldGreedily` function in the PatternRewriter. In
the future we might port this functionality so this pattern will become
redundant.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dialects Changes on the dialects transformations Changes or adds a transformatio
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants