Update USE_XCCL option if USE_XPU is OFF (#153936)

# Motivation
Disable `USE_XCCL` when `USE_XPU` is turned `OFF` to ensure configuration consistency. This is required because XCCL depends on XPU functionality.
Especially, ensure that `USE_XCCL` is correctly set to `OFF` when [caffe2_update_option(USE_XPU OFF)](1075bb37d3/cmake/Dependencies.cmake (L97)) is invoked.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/153936
Approved by: https://github.com/Skylion007
This commit is contained in:
Yu, Guangye 2025-05-20 16:26:02 +00:00 committed by PyTorch MergeBot
parent cf6e5d1881
commit daa68e7a93

View File

@ -1095,6 +1095,14 @@ if(USE_NCCL)
endif()
endif()
# ---[ XCCL
if(USE_XCCL)
if(NOT USE_XPU)
message(WARNING "Not using XPU, so disabling USE_XCCL. Suppress this warning with -DUSE_XCCL=OFF.")
caffe2_update_option(USE_XCCL OFF)
endif()
endif()
# ---[ UCC
if(USE_UCC)
if(NOT CMAKE_SYSTEM_NAME STREQUAL "Linux")