Repository navigation
[xccl] WA: preload libccl.so.1 so the oneCCL legacy plugin can load - #5648
Merged
Merged
Conversation
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 a flat
PyPI/venv layout libccl.so.1 is looked up only in /etc/ld.so.cache, /lib and
/usr/lib. It is not found there and oneCCL fails with "oneCCL could not be
initialized! Could not load any plugin.", taking down every XCCL process
group creation unless the user sets LD_LIBRARY_PATH by hand.
dlopen("libccl.so.1", RTLD_NOW | RTLD_GLOBAL) from this library resolves it
through our own RPATH -- the same one that already locates libccl.so.2 -- and
leaves it in the global scope, so the plugin binds against the already-loaded
object instead of searching the filesystem.
Reproduced outside torch with a stub mirroring the real layout (NEEDED
libccl.so.2 + RUNPATH to the oneCCL dir, oneCCL not on LD_LIBRARY_PATH):
without preload: dlopen libccl_legacy.so -> libccl.so.1: cannot open
shared object file
with preload : dlopen libccl.so.1 -> OK
dlopen libccl_legacy.so -> OK
tsocha
approved these changes
Oct 9, 2026
Contributor
|
Hi @Chao1Han could yo please help to remove the WA in distributed test workflow also? for example here https://github.com/intel/torch-xpu-ops/blob/main/.github/actions/linux-uttest/action.yml#L174 |
Contributor
Author
|
distributed tests passed, seems add libccl.so.1 safely. |
chuanqi129
approved these changes
Oct 10, 2026
Contributor
|
@torchxpubot merge -f |
Contributor
|
PR has been successfully merged by @chuanqi129 (force merge). |
Contributor
|
@torchxpubot cherry-pick --onto release/2.15 -c critical |
chuanqi129
pushed a commit
that referenced
this pull request
Oct 10, 2026
…5648) 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 a flat PyPI/venv layout libccl.so.1 is looked up only in /etc/ld.so.cache, /lib and /usr/lib. It is not found there and oneCCL fails with "oneCCL could not be initialized! Could not load any plugin.", taking down every XCCL process group creation unless the user sets LD_LIBRARY_PATH by hand. dlopen("libccl.so.1", RTLD_NOW | RTLD_GLOBAL) from this library resolves it through our own RPATH -- the same one that already locates libccl.so.2 -- and leaves it in the global scope, so the plugin binds against the already-loaded object instead of searching the filesystem. Reproduced outside torch with a stub mirroring the real layout (NEEDED libccl.so.2 + RUNPATH to the oneCCL dir, oneCCL not on LD_LIBRARY_PATH): without preload: dlopen libccl_legacy.so -> libccl.so.1: cannot open shared object file with preload : dlopen libccl.so.1 -> OK dlopen libccl_legacy.so -> OK (cherry picked from commit d8bc81a)
torchxpubot
added a commit
that referenced
this pull request
Oct 11, 2026
…CL legacy plugin can load (#5666) 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 a flat PyPI/venv layout libccl.so.1 is looked up only in /etc/ld.so.cache, /lib and /usr/lib. It is not found there and oneCCL fails with "oneCCL could not be initialized! Could not load any plugin.", taking down every XCCL process group creation unless the user sets LD_LIBRARY_PATH by hand. dlopen("libccl.so.1", RTLD_NOW | RTLD_GLOBAL) from this library resolves it through our own RPATH -- the same one that already locates libccl.so.2 -- and leaves it in the global scope, so the plugin binds against the already-loaded object instead of searching the filesystem. Reproduced outside torch with a stub mirroring the real layout (NEEDED libccl.so.2 + RUNPATH to the oneCCL dir, oneCCL not on LD_LIBRARY_PATH): without preload: dlopen libccl_legacy.so -> libccl.so.1: cannot open shared object file with preload : dlopen libccl.so.1 -> OK dlopen libccl_legacy.so -> OK Cherry-pick of #5648 to `release/2.15`. Cherry-picked from commit d8bc81a. Co-authored-by: Chao Han <chao1.han@intel.com>
chuanqi129
pushed a commit
that referenced
this pull request
Oct 12, 2026
…#5670) #5648 preloaded libccl.so.1 by soname, assuming libtorch_xpu.so's RPATH would locate it the same way it locates libccl.so.2. It does not, so the workaround never took effect and PYTORCHDGQ-10126 still reproduces. LD_DEBUG on a PyPI/venv install shows only three RPATHs ever being used -- numpy's extension module, torch/_C.cpython-*.so and libtorch_global_deps.so -- all objects that were dlopen'd directly. libtorch_xpu.so is pulled in as an indirect dependency, so glibc resolves our dlopen() against those, never against ours. libccl.so.2 is found only because it is a DT_NEEDED of libtorch_global_deps.so: find library=libccl.so.2 ... (RPATH from file .../libtorch_global_deps.so) find library=libccl.so.1 ... search cache=/etc/ld.so.cache ... (system search path) Ask the loader for the resolved path of libccl.so.2 and open libccl.so.1 from the same directory instead, which does not depend on any search path.
This was referenced Oct 12, 2026
chuanqi129
pushed a commit
that referenced
this pull request
Oct 13, 2026
… already loaded libccl.so.2 (#5676) #5648 preloaded libccl.so.1 by soname, assuming libtorch_xpu.so's RPATH would locate it the same way it locates libccl.so.2. It does not, so the workaround never took effect and PYTORCHDGQ-10126 still reproduces. LD_DEBUG on a PyPI/venv install shows only three RPATHs ever being used -- numpy's extension module, torch/_C.cpython-*.so and libtorch_global_deps.so -- all objects that were dlopen'd directly. libtorch_xpu.so is pulled in as an indirect dependency, so glibc resolves our dlopen() against those, never against ours. libccl.so.2 is found only because it is a DT_NEEDED of libtorch_global_deps.so: find library=libccl.so.2 ... (RPATH from file .../libtorch_global_deps.so) find library=libccl.so.1 ... search cache=/etc/ld.so.cache ... (system search path) Ask the loader for the resolved path of libccl.so.2 and open libccl.so.1 from the same directory instead, which does not depend on any search path. Cherry-pick of #5670 to `release/2.15`. Cherry-picked from commit d44bbbc. Co-authored-by: Chao Han <chao1.han@intel.com>
minmingzhu
pushed a commit
to minmingzhu/torch-xpu-ops
that referenced
this pull request
Oct 28, 2026
…ntel#5648) 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 a flat PyPI/venv layout libccl.so.1 is looked up only in /etc/ld.so.cache, /lib and /usr/lib. It is not found there and oneCCL fails with "oneCCL could not be initialized! Could not load any plugin.", taking down every XCCL process group creation unless the user sets LD_LIBRARY_PATH by hand. dlopen("libccl.so.1", RTLD_NOW | RTLD_GLOBAL) from this library resolves it through our own RPATH -- the same one that already locates libccl.so.2 -- and leaves it in the global scope, so the plugin binds against the already-loaded object instead of searching the filesystem. Reproduced outside torch with a stub mirroring the real layout (NEEDED libccl.so.2 + RUNPATH to the oneCCL dir, oneCCL not on LD_LIBRARY_PATH): without preload: dlopen libccl_legacy.so -> libccl.so.1: cannot open shared object file with preload : dlopen libccl.so.1 -> OK dlopen libccl_legacy.so -> OK
minmingzhu
pushed a commit
to minmingzhu/torch-xpu-ops
that referenced
this pull request
Oct 28, 2026
…intel#5670) intel#5648 preloaded libccl.so.1 by soname, assuming libtorch_xpu.so's RPATH would locate it the same way it locates libccl.so.2. It does not, so the workaround never took effect and PYTORCHDGQ-10126 still reproduces. LD_DEBUG on a PyPI/venv install shows only three RPATHs ever being used -- numpy's extension module, torch/_C.cpython-*.so and libtorch_global_deps.so -- all objects that were dlopen'd directly. libtorch_xpu.so is pulled in as an indirect dependency, so glibc resolves our dlopen() against those, never against ours. libccl.so.2 is found only because it is a DT_NEEDED of libtorch_global_deps.so: find library=libccl.so.2 ... (RPATH from file .../libtorch_global_deps.so) find library=libccl.so.1 ... search cache=/etc/ld.so.cache ... (system search path) Ask the loader for the resolved path of libccl.so.2 and open libccl.so.1 from the same directory instead, which does not depend on any search path.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 a flat PyPI/venv layout libccl.so.1 is looked up only in /etc/ld.so.cache, /lib and /usr/lib. It is not found there and oneCCL fails with "oneCCL could not be initialized! Could not load any plugin.", taking down every XCCL process group creation unless the user sets LD_LIBRARY_PATH by hand.
dlopen("libccl.so.1", RTLD_NOW | RTLD_GLOBAL) from this library resolves it through our own RPATH -- the same one that already locates libccl.so.2 -- and leaves it in the global scope, so the plugin binds against the already-loaded object instead of searching the filesystem.
Reproduced outside torch with a stub mirroring the real layout (NEEDED libccl.so.2 + RUNPATH to the oneCCL dir, oneCCL not on LD_LIBRARY_PATH):
without preload: dlopen libccl_legacy.so -> libccl.so.1: cannot open
shared object file
with preload : dlopen libccl.so.1 -> OK
dlopen libccl_legacy.so -> OK