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: (scf) loop range folding #3417

Merged
merged 4 commits into from
Nov 11, 2024

Conversation

mamanain
Copy link
Collaborator

@mamanain mamanain commented Nov 9, 2024

Porting mlir pass of the same name. The logic is almost the same. We need this to keep snitch compilation fully inside xdsl.

@mamanain mamanain added the transformations Changes or adds a transformatio label Nov 9, 2024
@mamanain mamanain self-assigned this Nov 9, 2024
Copy link

codecov bot commented Nov 9, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 90.16%. Comparing base (de1bee5) to head (5089786).
Report is 6 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3417      +/-   ##
==========================================
- Coverage   90.16%   90.16%   -0.01%     
==========================================
  Files         455      456       +1     
  Lines       57467    57553      +86     
  Branches     5532     5545      +13     
==========================================
+ Hits        51815    51890      +75     
- Misses       4195     4200       +5     
- Partials     1457     1463       +6     

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

Comment on lines 65 to 69
new_step.result.name_hint = "new_step"
op.operands[2] = new_step.result

new_lb.result.name_hint = "new_lb"
new_ub.result.name_hint = "new_ub"
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 great, but I have a feeling that it might actually make it easier to read if we keep the name hint as the user's name hint, to make it explicit what calculation we're pulling out

Comment on lines 14 to 15
%0 = arith.addi %shift, %i : index
%1 = arith.muli %0, %mul_shift : index
Copy link
Member

Choose a reason for hiding this comment

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

So wrt my comment below, if we give names to these variables, their names will be visible outside of the for loop in the added arithmetic calculations

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Could you please check if that's what you meant?

Comment on lines 49 to 51
new_name_hint = (
user.result.name_hint if user.result.name_hint is not None else "new"
)
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 cute but I worry that it might be a bit confusing if done extensively, like for the new_lb_lb above. I'm now tempted to say that we should not be doing anything here, and let the default name copying done by the rewriter do the work.

Copy link
Collaborator Author

@mamanain mamanain Nov 11, 2024

Choose a reason for hiding this comment

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

I agree, to be honest. Should I omit name hints here?

Copy link
Member

Choose a reason for hiding this comment

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

Yep, I would just add the name hints to all variables in the test file, and remove the name hint manipulation in the rewrite

@mamanain mamanain merged commit daab137 into xdslproject:main Nov 11, 2024
14 checks passed
@mamanain mamanain deleted the manainen/loop-range-folding branch November 11, 2024 19:33
EdmundGoodman pushed a commit to EdmundGoodman/xdsl that referenced this pull request Dec 6, 2024
Porting mlir pass of the same name. The logic is almost the same. We
need this to keep snitch compilation fully inside xdsl.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
transformations Changes or adds a transformatio
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants