Skip to content
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

[inductor][easy] add buffer layout to SchedulerNode.debug_str #125090

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 8 additions & 0 deletions test/inductor/test_debug_trace.py
Expand Up @@ -59,6 +59,8 @@ def fn(a, b):
buf0.group.device = cpu
buf0.group.iteration = ((256,), ())
buf0.sizes = ([256], [])
arg0_1_layout = FixedLayout('cpu', torch.float32, size=[16, 16], stride=[16, 1])
buf0_layout = FixedLayout('cpu', torch.float32, size=[16, 16], stride=[16, 1])
class buf0_loop_body:
var_ranges = {z0: 256}
index0 = z0
Expand All @@ -80,6 +82,8 @@ def body(self, ops):
buf1.group.device = cpu
buf1.group.iteration = ((256,), ())
buf1.sizes = ([256], [])
buf0_layout = FixedLayout('cpu', torch.float32, size=[16, 16], stride=[16, 1])
buf1_layout = FixedLayout('cpu', torch.float32, size=[16, 16], stride=[16, 1])
class buf1_loop_body:
var_ranges = {z0: 256}
index0 = z0
Expand Down Expand Up @@ -117,6 +121,8 @@ def body(self, ops):
buf0.group.device = cpu
buf0.group.iteration = ((256,), ())
buf0.sizes = ([256], [])
arg0_1_layout = FixedLayout('cpu', torch.float32, size=[16, 16], stride=[16, 1])
buf0_layout = FixedLayout('cpu', torch.float32, size=[16, 16], stride=[16, 1])
class buf0_loop_body:
var_ranges = {z0: 256}
index0 = z0
Expand All @@ -137,6 +143,8 @@ def body(self, ops):
buf1.group.device = cpu
buf1.group.iteration = ((256,), ())
buf1.sizes = ([256], [])
buf0_layout = FixedLayout('cpu', torch.float32, size=[16, 16], stride=[16, 1])
buf1_layout = FixedLayout('cpu', torch.float32, size=[16, 16], stride=[16, 1])
class buf1_loop_body:
var_ranges = {z0: 256}
index0 = z0
Expand Down
4 changes: 4 additions & 0 deletions torch/_inductor/scheduler.py
Expand Up @@ -732,6 +732,10 @@ def debug_str_extra(self) -> str:
f"{name}.group.iteration = {self.group[1]}",
f"{name}.sizes = {self._sizes}",
]
for dep in self.read_writes.reads_and_writes():
buf_name = dep.name
buf = V.graph.get_buffer(buf_name)
lines.append(f"{buf_name}_layout = {pformat(buf.layout)}")
if self.get_aliases():
lines.append(f"{name}.aliases = {pformat(self.get_aliases())}")
if self.get_mutations():
Expand Down