Skip to content

Rewrite dilated convolutions by expanding the kernel#3041

Merged
copybara-service[bot] merged 1 commit into
google:mainfrom
belfortlabs:mdgrs/convolutionDilation
Jun 17, 2026
Merged

Rewrite dilated convolutions by expanding the kernel#3041
copybara-service[bot] merged 1 commit into
google:mainfrom
belfortlabs:mdgrs/convolutionDilation

Conversation

@mdgrs

@mdgrs mdgrs commented Jun 5, 2026

Copy link
Copy Markdown
Collaborator

The dilation argument adds 0 between the kernel values:

[1,2,3], dilation=3 -> [1,0,0,2,0,0,3], dilation=1

This pass rewrites a dilated convolution operator to a convolution operator with dilation=1 by explicitly inserting the 0s in the kernel.

If you agree with approach, I can also port it to the 2d convolution operator.

I am opening this as a draft PR because it is blocked by #3003 . The bug is unrelated to these changes, but it is making the integration test fail. Let me know if I can help you somehow with the resolution of #3003 @asraa . I am happy to sit down and try to figure this out together if you think that would be helpful.

@mdgrs mdgrs requested a review from j2kun June 5, 2026 09:18

@j2kun j2kun left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

LGTM! I think with Asra's other fix you should be unblocked here, either by making the input values smaller or by increasing the mod bits.

Comment thread lib/Transforms/LinalgCanonicalizations/LinalgCanonicalizations.cpp Outdated
Comment thread lib/Transforms/LinalgCanonicalizations/LinalgCanonicalizations.cpp Outdated
Comment thread tests/Transforms/linalg_canonicalizations/conv1d_dilated.mlir
@mdgrs mdgrs force-pushed the mdgrs/convolutionDilation branch from a74b3c9 to 1de1c4b Compare June 10, 2026 14:19
@mdgrs mdgrs marked this pull request as ready for review June 10, 2026 14:19
@mdgrs

mdgrs commented Jun 10, 2026

Copy link
Copy Markdown
Collaborator Author

LGTM! I think with Asra's other fix you should be unblocked here, either by making the input values smaller or by increasing the mod bits.

I changed the test parameters and added the 2d version, which was pretty straightforward. If you are happy with it, I'll squash down to 1 commit

@j2kun j2kun left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

LGTM! Let's squash and get it in

@mdgrs mdgrs force-pushed the mdgrs/convolutionDilation branch from 1de1c4b to ee8ad4c Compare June 15, 2026 10:49
@AlexanderViand AlexanderViand added the pull_ready Indicates whether a PR is ready to pull. The copybara worker will import for internal testing label Jun 17, 2026
@copybara-service copybara-service Bot merged commit 5fb9018 into google:main Jun 17, 2026
17 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pull_ready Indicates whether a PR is ready to pull. The copybara worker will import for internal testing

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants