diff --git a/torch/_inductor/ir.py b/torch/_inductor/ir.py index fdc10c9ca16..8327fe0d7b5 100644 --- a/torch/_inductor/ir.py +++ b/torch/_inductor/ir.py @@ -998,11 +998,11 @@ def as_storage_and_layout(x, freeze=True, want_contiguous=False, stride_order=No 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 @@ class ReinterpretView(BaseView): layout: "Layout" + def __post_init__(self): + if isinstance(self.data, BaseView): + self.data = self.data.unwrap_view() + def __str__(self): return self.str_helper( [