Skip to content

Commit 184ac8c

Browse files
malfetpytorchmergebot
authored andcommitted
[MPSInductor] Fix noop codegen (#151224)
By adding `pass` in front of the comment for fake set_device call Which fixes `TestGPU.test_zero_element_mutation_mps`, which previously failed with ``` torch._inductor.exc.InductorError: RuntimeError: Failed to import /var/folders/sc/2thx6_x95h7_h9qs8s48yh140000gn/T/tmp2emka_sx/7k/c7kmnwhb363ysalhewglr3cwtej6tiz3t4ppqa4bvhubaokmlprw.py IndentationError: expected an indented block after 'with' statement on line 38 (c7kmnwhb363ysalhewglr3cwtej6tiz3t4ppqa4bvhubaokmlprw.py, line 40) ``` Pull Request resolved: #151224 Approved by: https://github.com/Skylion007, https://github.com/jansel, https://github.com/dcci
1 parent 001695c commit 184ac8c

2 files changed

Lines changed: 2 additions & 1 deletion

File tree

test/inductor/test_mps_basic.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -242,6 +242,7 @@ def fn(a):
242242
"test_views6",
243243
"test_views7",
244244
"test_zero_dim_reductions",
245+
"test_zero_element_mutation",
245246
]:
246247
setattr(MPSBasicTests, test_name, getattr(CommonTemplate, test_name))
247248

torch/_inductor/codegen/mps_device_op_overrides.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ def device_guard(self, device_idx: int) -> str:
1010

1111
def set_device(self, device_idx: int) -> str:
1212
assert device_idx == 0
13-
return "# MPS set device"
13+
return "pass # MPS set device"
1414

1515

1616
register_device_op_overrides("mps", MPSDeviceOpOverrides())

0 commit comments

Comments
 (0)