[WIP] Unwrap View in Reinterpret View (#89016)
Pull Request resolved: https://github.com/pytorch/pytorch/pull/89016
Approved by: https://github.com/ngimel
diff --git a/torch/_inductor/ir.py b/torch/_inductor/ir.py
index fdc10c9..8327fe0 100644
--- a/torch/_inductor/ir.py
+++ b/torch/_inductor/ir.py
@@ -998,11 +998,11 @@
x.data.decide_layout()
return x, x.data.layout
if isinstance(x, ReinterpretView):
+ # making the base of x contiguous or stride_ordered will not necessarily make
+ # the ReinterpretedView either, so dont pass along those arguments
buffer, _ = as_storage_and_layout(
x.data,
freeze=freeze,
- want_contiguous=want_contiguous,
- stride_order=stride_order,
)
return buffer, x.layout
raise NotImplementedError
@@ -1402,6 +1402,10 @@
layout: "Layout"
+ def __post_init__(self):
+ if isinstance(self.data, BaseView):
+ self.data = self.data.unwrap_view()
+
def __str__(self):
return self.str_helper(
[