[inductor] normalize path of the code. (#159255)

Error stack:
<img width="1361" height="345" alt="image" src="https://github.com/user-attachments/assets/50fb2baa-34fd-4a48-a3e7-76e3185391d4" />

After fix:
<img width="1103" height="398" alt="image" src="https://github.com/user-attachments/assets/ece5a9ba-a085-46fe-b061-0c2ebda3a2df" />

Pull Request resolved: https://github.com/pytorch/pytorch/pull/159255
Approved by: https://github.com/desertfire
This commit is contained in:
Xu Han 2025-07-28 23:42:11 +00:00 committed by PyTorch MergeBot
parent 59e261bbd8
commit 8ad96a563c

View File

@ -111,6 +111,8 @@ torch._inductor.config.{"cpp" if device == "cpu" else "triton"}.inject_relu_bug_
def _maybe_subprocess_run(
self, args: Sequence[Any], *, isolate: bool, cwd: Optional[str] = None
) -> subprocess.CompletedProcess[bytes]:
from torch._inductor.cpp_builder import normalize_path_separator
if not isolate:
assert len(args) >= 2, args
assert args[0] == "python3", args
@ -121,7 +123,8 @@ torch._inductor.config.{"cpp" if device == "cpu" else "triton"}.inject_relu_bug_
else:
assert len(args) >= 2, args
with open(args[1]) as f:
code = f.read()
# Need normalize path of the code.
code = normalize_path_separator(f.read())
args = args[1:]
# WARNING: This is not a perfect simulation of running