mirror of
https://github.com/pytorch/pytorch.git
synced 2025-10-20 12:54:11 +08:00
Before this change, if one builds PyTorch without XPU build process will be perpetually regenerating code because of the reference to non-existing file, that will make autograd codegened files always out of date, see part of the `ninja -d explain torch_cpu` output: ``` ninja explain: output ../torch/csrc/inductor/aoti_torch/generated/c_shim_xpu.cpp doesn't exist ninja explain: output third_party/kineto/libkineto/CMakeFiles/libkineto_defs.bzl of phony edge with no inputs doesn't exist ninja explain: third_party/kineto/libkineto/CMakeFiles/libkineto_defs.bzl is dirty ninja explain: /Users/malfet/git/pytorch/pytorch/torch/csrc/autograd/generated/Functions.cpp is dirty ``` This is a regression introduced by https://github.com/pytorch/pytorch/pull/139025. After this change, incremental rebuilds with no changes cause no build actions: ``` % ninja -j1 -v -d explain -n torch_cpu ninja explain: output third_party/kineto/libkineto/CMakeFiles/libkineto_defs.bzl of phony edge with no inputs doesn't exist ninja explain: third_party/kineto/libkineto/CMakeFiles/libkineto_defs.bzl is dirty ninja: no work to do. ``` Test plan: Wait for at least on XPU build to finish... Fixes https://github.com/pytorch/pytorch/issues/140432 Pull Request resolved: https://github.com/pytorch/pytorch/pull/140438 Approved by: https://github.com/kit1980, https://github.com/huydhn