Skip to content

Commit 9341ede

Browse files
nandesukapytorchmergebot
authored andcommitted
Revert to old behaviour of not padding strides if shape or stride is dynamic (pytorch#163639)
Differential Revision: D83053287 Pull Request resolved: pytorch#163639 Approved by: https://github.com/blaine-rister
1 parent 4c2c401 commit 9341ede

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

torch/_inductor/ir.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3741,6 +3741,15 @@ def _pad_strides(
37413741
):
37423742
return in_strides
37433743

3744+
# Skip padding the strides for dynamic shapes based on config.pad_dynamic_shape
3745+
# Checking both shape and strides, as there are cases where only one is dynamic
3746+
is_dynamic = not all(
3747+
isinstance(s, (int, sympy.Integer))
3748+
for s in itertools.chain(in_strides, size)
3749+
)
3750+
if not config.pad_dynamic_shapes and is_dynamic:
3751+
return in_strides
3752+
37443753
shape_env = V.graph._shape_env if hasattr(V.graph, "_shape_env") else None
37453754

37463755
def contains_unbacked_symints(expr: sympy.Expr | int) -> bool:

0 commit comments

Comments
 (0)