[RELAND] Always build USE_DISTRIBUTED (#160449) and Make distributed modules importable even when backend not built (#159889) (#162594)

Summary:
Original: D81957844 and D81957923

Also, https://github.com/pytorch/pytorch/pull/162142 is patched in as well

#buildall

Test Plan:
sandcastle and oss ci

Rollback Plan:

Reviewed By: H-Huang

Pull Request resolved: https://github.com/pytorch/pytorch/pull/162594
Approved by: https://github.com/H-Huang, https://github.com/dcci
This commit is contained in:
Edward Yang
2025-09-12 10:54:39 +00:00
committed by PyTorch MergeBot
parent a7bbc5fea7
commit 6c334885d4
52 changed files with 766 additions and 446 deletions

View File

@ -88,8 +88,7 @@ def build_pytorch(
) -> None:
my_env = _create_build_env()
if (
not check_negative_env_flag("USE_DISTRIBUTED")
and not check_negative_env_flag("USE_CUDA")
not check_negative_env_flag("USE_CUDA")
and not check_negative_env_flag("USE_NCCL")
and not check_env_flag("USE_SYSTEM_NCCL")
):