-
Notifications
You must be signed in to change notification settings - Fork 24.9k
Fallback to contiguous layout in convolution lowering on stride mismatch #159462 #159593
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
base: main
Are you sure you want to change the base?
Conversation
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/159593
Note: Links to docs will display an error until the docs builds have been completed. ❗ 1 Active SEVsThere are 1 currently active SEVs. If your PR is affected, please view them below: ❌ 1 New FailureAs of commit 8810e26 with merge base a991e28 ( NEW FAILURE - The following job has failed:
This comment was automatically generated by Dr. CI and updates every 15 minutes. |
This PR needs a
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For me it's still failing. I build it on top of your fix which is this commit 850db0c......
python3
Python 3.13.5 | packaged by conda-forge | (main, Jun 16 2025, 08:27:50) [GCC 13.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import torch
>>> print(torch.__version__)
2.9.0a0+git850db0c
>>> exit
(myenv) rohitrathore1@hpe10:~$ python3 test.py
succeed on eager
succeed on aot_eager
failed on inductor expected size 64==64, stride 1==100 at dim=1; expected size 100==100, stride 64==1 at dim=2
Error in op: torch.ops.aten.convolution.default
This error most often comes from a incorrect fake (aka meta) kernel for a custom op.
Use torch.library.opcheck to test your custom op.
See https://pytorch.org/docs/stable/library.html#torch.library.opcheck
@RohitRathore1 It could be platform-dependent, but since the operation uses only standard PyTorch modules on CPU, and passes on macOS with a clean build, it doesn’t immediately appear to be platform-specific.
|
❌ 🤖 pytorchbot command failed:
Try |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can't do try ... except here. We should figure out what the actual underlying issue is. Sorry this may not be a good first issue
Fixes #159462
Fallback to
.contiguous()
Layout Whenrequire_stride_order
Fails in Convolution LoweringThis PR fixes a stride validation error in the Inductor backend that occurs when a
permute(
) is followed by aConv1d
layer. The issue happens becausepermute()
creates a tensor with a non-standard layout, which breaks the expected stride checks during kernel compilation.In the
aten.convolution
lowering function, this patch wrapsrequire_stride_order(...)
with atry/except
. If the stride requirement check fails, it safely falls back torequire_contiguous(...)
. This resolves the mismatch by ensuring a compatible memory layout.Code:
Output:
cc @voznesenskym @penguinwu @EikanWang @jgong5 @Guobing-Chen @XiaobingSuper @zhuhaozhe @blzheng @wenzhe-nrv @jiayisunx @ipiszy @chenyang78 @kadeng @muchulee8 @amjames @chauhang @aakhundov @coconutruben