Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
Chao1Han committed Sep 4, 2024
1 parent c9ef78f commit 076db36
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 6 deletions.
2 changes: 1 addition & 1 deletion build_variables.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -542,7 +542,6 @@ libtorch_distributed_extra_sources = [
"torch/csrc/distributed/autograd/rpc_messages/rref_backward_req.cpp",
"torch/csrc/distributed/autograd/rpc_messages/rref_backward_resp.cpp",
"torch/csrc/distributed/c10d/HashStore.cpp",
"torch/csrc/distributed/c10d/ProcessGroupXCCL.cpp",
"torch/csrc/distributed/rpc/agent_utils.cpp",
"torch/csrc/distributed/rpc/message.cpp",
"torch/csrc/distributed/rpc/profiler/remote_profiler_manager.cpp",
Expand Down Expand Up @@ -787,6 +786,7 @@ libtorch_python_cuda_sources = libtorch_python_cuda_core_sources + [

libtorch_python_xpu_sources = [
"torch/csrc/xpu/xccl.cpp",
"torch/csrc/distributed/c10d/ProcessGroupXCCL.cpp",
"torch/csrc/xpu/Event.cpp",
"torch/csrc/xpu/Module.cpp",
"torch/csrc/xpu/Stream.cpp",
Expand Down
5 changes: 2 additions & 3 deletions caffe2/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1015,13 +1015,12 @@ endif()

if(USE_XPU)
if(USE_XCCL)
list(APPEND Caffe2_XPU_SRCS
${TORCH_SRC_DIR}/csrc/xpu/xccl.cpp)
list(APPEND Caffe2_XPU_SRCS
${TORCH_SRC_DIR}/csrc/xpu/xccl.cpp)
endif()
add_library(torch_xpu ${Caffe2_XPU_SRCS})
torch_compile_options(torch_xpu) # see cmake/public/utils.cmake
target_compile_definitions(torch_xpu PRIVATE USE_XPU)

# ATen XPU implementation
set(TORCH_XPU_OPS_DIR ${TORCH_ROOT}/third_party/torch-xpu-ops)
set(TORCH_XPU_OPS_REPO_URL https://github.com/intel/torch-xpu-ops.git)
Expand Down
1 change: 1 addition & 0 deletions cmake/Summary.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,7 @@ function(caffe2_print_configuration_summary)
message(STATUS " USE_ITT : ${USE_ITT}")
message(STATUS " USE_XCCL : ${USE_XCCL}")
if(${USE_XCCL})
message(STATUS " USE_C10D_XCCL : ${USE_C10D_XCCL}")
message(STATUS " XCCL include path : ${XCCL_INCLUDE_DIR}")
message(STATUS " XCCL library : ${XCCL_LIBRARY}")
endif()
Expand Down
5 changes: 5 additions & 0 deletions torch/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,9 @@ if(USE_XPU)
append_filelist("libtorch_python_xpu_sources" TORCH_PYTHON_SRCS)

list(APPEND TORCH_PYTHON_COMPILE_DEFINITIONS USE_XPU)
# if(USE_XCCL)
list(APPEND TORCH_PYTHON_LINK_LIBRARIES torch::xpurt)
# endif()
endif()

if(USE_CUDNN OR USE_ROCM)
Expand Down Expand Up @@ -419,6 +422,8 @@ endif()
target_compile_definitions(torch_python PRIVATE "-DTHP_BUILD_MAIN_LIB")

target_link_libraries(torch_python PRIVATE ${TORCH_LIB} ${TORCH_PYTHON_LINK_LIBRARIES})
target_link_libraries(torch_python PRIVATE torch::xpurt)
target_link_libraries(torch_python PRIVATE c10_xpu)

target_compile_definitions(torch_python PRIVATE ${TORCH_PYTHON_COMPILE_DEFINITIONS})

Expand Down
2 changes: 0 additions & 2 deletions torch/csrc/distributed/c10d/ProcessGroupXCCL.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@

#include <oneapi/ccl.hpp>
#include <torch/csrc/xpu/xccl.h>
#include <torch/csrc/xpu/Stream.h>
#include <torch/csrc/xpu/Event.h>
#include <exception>
#include <memory>
#include <vector>
Expand Down
2 changes: 2 additions & 0 deletions torch/csrc/xpu/xccl.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
#include <optional>
#include <vector>
#include <torch/csrc/distributed/c10d/Store.hpp>
#include <torch/csrc/xpu/Stream.h>
#include <torch/csrc/xpu/Event.h>

namespace torch::xpu::xccl {

Expand Down

0 comments on commit 076db36

Please sign in to comment.