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

[Codegen][IGEMM] Add new pass for IGEMM transformation with reshape propagation #18161

Merged
merged 5 commits into from
Aug 9, 2024

Conversation

Max191
Copy link
Contributor

@Max191 Max191 commented Aug 8, 2024

This PR adds a new pass to perform the IGEMM transformation in Codegen. The new pass uses the Conv2DToIm2colOp patterns plus some reshape propagation and cleanup patterns. The PR also adds a control function on the Conv2DToIm2colOp patterns, in order to avoid transforming configured operations.

This separates the Conv2DToIm2colOp transformation from the codegen-specific IGEMM pipeline, and addresses an issue with fusions that requires reshape propagation. When there are consumers of the convolution op, the consumer needs to also be collapsed in order to tile and fuse it with the GEMM.

Adding reshape propagation is just one solution to the fusion issue. The other potential solution is to allow the im2col op to have multiple M dimensions in its result, and create a multi-M contraction instead of the collapsed version. This second solution is ideal as long as backends are able to handle the multi-M contraction, but it requires more work to change the im2col op semantics. For now this PR fixes the issue, and the alternative solution is left as a TODO.

@Max191 Max191 force-pushed the im2col-reshape-prop branch from 2e2709d to 4c849cd Compare August 9, 2024 14:47
@Max191 Max191 changed the title [LinalgExt][Im2col] Add reshape propagation to ConvertConv2DToIm2ColOpPass [Codegen][IGEMM] Add new pass for IGEMM transformation with reshape propagation Aug 9, 2024
@Max191 Max191 force-pushed the im2col-reshape-prop branch from 766d829 to 11900f2 Compare August 9, 2024 15:22
Signed-off-by: Max Dawkins <[email protected]>
@Max191 Max191 force-pushed the im2col-reshape-prop branch from 11900f2 to f855a46 Compare August 9, 2024 15:22
@Max191 Max191 requested review from kuhar and Groverkss as code owners August 9, 2024 15:29
@Max191 Max191 enabled auto-merge (squash) August 9, 2024 15:31
@Max191 Max191 disabled auto-merge August 9, 2024 15:39
@Max191 Max191 force-pushed the im2col-reshape-prop branch from f4cd9c4 to 2d4d033 Compare August 9, 2024 15:41
@Max191 Max191 enabled auto-merge (squash) August 9, 2024 15:41
@Max191 Max191 merged commit f0e8cda into iree-org:main Aug 9, 2024
45 checks passed
@Max191 Max191 deleted the im2col-reshape-prop branch October 25, 2024 14:17
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