[Codegen][IGEMM] Add new pass for IGEMM transformation with reshape propagation #18161
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 theConv2DToIm2colOp
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.