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

[NFC][Im2Col] Move im2col to affine.delinearize_index #19840

Merged
merged 2 commits into from
Feb 4, 2025

Conversation

krzysz00
Copy link
Contributor

@krzysz00 krzysz00 commented Jan 28, 2025

Simplify the generated indexing code in im2col by using affine.delineraize_index instead of affine::delinearizeIndex.

Simplify the generated indexing code in im2call by using
affine.delineraize_index instead of affine::delinearizeIndex.
@hanhanW hanhanW changed the title [NFC][Im2Col] Move im2tocall to affine.delinearize_index [NFC][Im2Col] Move im2col to affine.delinearize_index Feb 3, 2025
Copy link
Contributor

@hanhanW hanhanW left a comment

Choose a reason for hiding this comment

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

I haven't followed the indexing for a while. I can approve it if we are switching to affine.delinearize_index approach. Just a couple of nits, thanks!

Comment on lines 789 to 792
auto delinKOffsetOp = b.create<affine::AffineDelinearizeIndexOp>(
nestedLoc, getValueOrCreateConstantIndexOp(b, loc, kIndex), kBasis,
/*hasOuterBound=*/true);
SmallVector<Value> delinKOffset = delinKOffsetOp.getResults();
Copy link
Contributor

Choose a reason for hiding this comment

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

I think we can just collapse them into a single statement because we do not use the op elsewhere.

Suggested change
auto delinKOffsetOp = b.create<affine::AffineDelinearizeIndexOp>(
nestedLoc, getValueOrCreateConstantIndexOp(b, loc, kIndex), kBasis,
/*hasOuterBound=*/true);
SmallVector<Value> delinKOffset = delinKOffsetOp.getResults();
SmallVector<Value> delinKOffset = b.create<affine::AffineDelinearizeIndexOp>(
nestedLoc, getValueOrCreateConstantIndexOp(b, loc, kIndex), kBasis,
/*hasOuterBound=*/true).getResults();

Comment on lines 823 to 826
auto delinMOffsetOp = b.create<affine::AffineDelinearizeIndexOp>(
nestedLoc, getValueOrCreateConstantIndexOp(b, loc, linearMOffset), mBasis,
/*hasOuterBound=*/true);
SmallVector<Value> delinMOffset = delinMOffsetOp.getResults();
Copy link
Contributor

Choose a reason for hiding this comment

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

ditto, we can just collapse them into a single statement.

@krzysz00 krzysz00 merged commit 002e637 into iree-org:main Feb 4, 2025
43 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants