You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Bundling librocjpeg moves it out of _rocm_sdk_core/lib, breaking AMD's
own relative RPATH inside it that points to librocm_sysdeps_* transitive
deps. We then have to re-patch those paths ourselves, which is fragile
and was causing the missing librocm_sysdeps_va.so.2 / libamdhip64.so.7
failures at runtime.
The cleaner approach: exclude librocjpeg from auditwheel bundling and
instead append _rocm_sdk_core/lib (ROCm >= 7.14) and /opt/rocm/lib
(ROCm <= 7.2) to the RPATH of libtorchcodec_image.so itself. At runtime
the dynamic linker finds librocjpeg in its original location; AMD's own
RPATH on that library then correctly resolves all transitive deps without
any intervention from us.
_find_rocjpeg_lib() is kept: auditwheel still needs librocjpeg in
LD_LIBRARY_PATH to resolve the DT_NEEDED during its analysis pass, even
though we exclude it from bundling.
Co-authored-by: Cursor <cursoragent@cursor.com>
print(os.pathsep.join(d for d in dirs if pathlib.Path(d).is_dir()))
178
-
" 2>/dev/null || true)
165
+
# ROCm 7.14 pip-wheel layout: librocjpeg lives in _rocm_sdk_core/lib and
166
+
# its transitive deps (librocm_sysdeps_va.so.2 etc.) are in
167
+
# _rocm_sdk_core/lib/rocm_sysdeps/lib. The RPATH on libtorchcodec_image.so
168
+
# points to _rocm_sdk_core/lib, and AMD's own RPATH on librocjpeg handles
169
+
# the sysdeps. Set LD_LIBRARY_PATH as belt-and-suspenders for the HIP
170
+
# runtime (libamdhip64) that librocjpeg needs.
171
+
rocm_core_lib=$(python -c "import importlib.util, pathlib, os; spec = importlib.util.find_spec('_rocm_sdk_core'); p = pathlib.Path(spec.submodule_search_locations[0]) if spec else None; dirs = [str(p/'lib'), str(p/'lib'/'rocm_sysdeps'/'lib')] if p else []; print(os.pathsep.join(d for d in dirs if pathlib.Path(d).is_dir()))" 2>/dev/null || true)
0 commit comments