8000 Make require_contiguous require exact strides instead of stride order by eellison · Pull Request #148235 · pytorch/pytorch · GitHub
[go: up one dir, main page]

Skip to content

Make require_contiguous require exact strides instead of stride order #148235

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

Open
wants to merge 2 commits into
base: gh/eellison/767/base
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
8000
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions torch/_inductor/ir.py
Original file line number Diff line number Diff line change
Expand Up @@ -2798,9 +2798,7 @@ def fake_reindex(index): # type: ignore[no-untyped-def]
# TODO: unbacked should not diverge from backed in determining striding
# Need to require contiguous here instead of realize, see:
# https://github.com/pytorch/pytorch/issues/145561
x = ExternKernel.require_exact_strides(
x, FlexibleLayout.contiguous_strides(x.get_size())
)
x = ExternKernel.require_contiguous(x)

storage, old_layout = as_storage_and_layout(x, want_contiguous=True)
new_layout = FixedLayout(
Expand Down Expand Up @@ -5356,7 +5354,7 @@ def require_channels_last_3d(cls, x): # type: ignore[no-untyped-def]

@classmethod
def require_contiguous(cls, x): # type: ignore[no-untyped-def]
return cls.require_stride_order(x, list(reversed(range(len(x.get_size())))))
return cls.require_exact_strides(x, FlexibleLayout.contiguous_strides(x.get_size()))

def apply_constraint(self) -> None:
pass
Expand Down
Loading
0