Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .github/actions/linux-uttest/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,6 @@ runs:
run: |
xpu-smi topology -m
mkdir -p ut_log/xpu_distributed
export PATH="${VENV_ROOT}/bin/libfabric:${PATH}"
XCCL_ENABLE=$(python -c "import torch;print(torch.distributed.is_xccl_available())")
if [[ "${XCCL_ENABLE,,}" == 'false' ]] || [[ "${XCCL_ENABLE}" == '0' ]]; then
echo -e "[ERROR] XCCL is not enabled"
Expand Down
4 changes: 3 additions & 1 deletion cmake/XCCL.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,9 @@ if(NOT __XCCL_INCLUDED)
${XCCL_INCLUDE_DIR})
# Wrap with --no-as-needed,...,--as-needed so it remains in NEEDED.
# Once the weak attribute is removed upstream, this wrapper can be dropped.
# CMAKE_DL_LIBS is for the libccl.so.1 preload in src/xccl/xccl.cpp; it can go
# away together with that workaround.
set_property(
TARGET torch::xccl PROPERTY INTERFACE_LINK_LIBRARIES
"-Wl,--no-as-needed,${XCCL_LIBRARY},--as-needed")
"-Wl,--no-as-needed,${XCCL_LIBRARY},--as-needed" ${CMAKE_DL_LIBS})
endif()
32 changes: 32 additions & 0 deletions src/xccl/xccl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,38 @@

#include <xccl/xccl.h>

#ifndef _WIN32
#include <dlfcn.h>
#endif

namespace {

// WA. revert it once DLE 2026.2 releases.
//
// libccl.so.2 dlopen()s its legacy plugin libccl_legacy.so, which lists
// libccl.so.1 in DT_NEEDED but ships without RPATH/RUNPATH. A dlopen'd object
// does not inherit the search path of whoever pulled it in, so in the flat
// PyPI/venv layout libccl.so.1 is looked up only in /etc/ld.so.cache, /lib and
// /usr/lib; it is not found and oneCCL fails with "Could not load any plugin",
// taking down every process group creation. Loading it here resolves it
// through this library's RPATH -- the same one that already locates
// libccl.so.2 -- and leaves it in the global scope for the plugin to bind
// against.
//
// A failure here is expected on a full oneAPI/DLE layout, where the plugin
// resolves its own dependencies, so it is deliberately not reported.
//
// oneCCL 2022.2 adds $ORIGIN search paths to its wheels; drop this once that
// is the minimum supported version.
[[maybe_unused]] const bool preloaded_oneccl_legacy_dep = []() {
#ifndef _WIN32
(void)dlopen("libccl.so.1", RTLD_NOW | RTLD_GLOBAL);
#endif
return true;
}();

} // namespace

namespace c10d {
namespace xccl {

Expand Down
Loading