Skip to content

[Cherry-pick release/2.15] [xccl] WA: preload libccl.so.1 so the oneCCL legacy plugin can load - #5666

Merged
torchxpubot merged 1 commit into
release/2.15from
cherry-pick-5648-by-chuanqi129
Oct 11, 2026
Merged

torchxpubot merged 1 commit into
release/2.15from
cherry-pick-5648-by-chuanqi129

Conversation

@torchxpubot

Copy link
Copy Markdown
Contributor

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.

…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)
@chuanqi129
chuanqi129 force-pushed the cherry-pick-5648-by-chuanqi129 branch from 4caa25b to e97299c Compare October 10, 2026 12:53
@torchxpubot
torchxpubot merged commit 96580c8 into release/2.15 Oct 11, 2026
26 of 29 checks passed
@torchxpubot
torchxpubot deleted the cherry-pick-5648-by-chuanqi129 branch October 11, 2026 15:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants