Skip to content

Commit e0d4da7

Browse files
Add torch/lib to bundled librocjpeg RPATH for PyTorch ROCm bundled layout
PyTorch ROCm wheels may bundle the ROCm runtime (libamdhip64, libhsa-runtime64 etc.) inside torch/lib/ rather than depending on a separate _rocm_sdk_core pip wheel. Add \$ORIGIN/../../torch/lib to the RPATH patched onto the bundled librocjpeg-HASH.so so it can find those deps in either layout: - torch/lib/ (torch bundles ROCm runtime, like it does for CUDA) - _rocm_sdk_core/lib/ (TheRock separate pip-wheel layout) - /opt/rocm/lib (ROCm <= 7.2 system install) Co-authored-by: Cursor <cursoragent@cursor.com>
1 parent ddf2313 commit e0d4da7

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

packaging/repair_wheel.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -253,11 +253,15 @@ def _patch_rocjpeg_rpath_in_wheel(wheel_path: Path) -> None:
253253

254254
rpath = ":".join([
255255
"$ORIGIN",
256-
# ROCm >= 7.14: rocm-sdk-core Python wheel layout
256+
# ROCm >= 7.14 layout A: torch bundles ROCm runtime inside torch/lib/
257+
# (same layout PyTorch uses for CUDA runtime on CUDA builds).
258+
"$ORIGIN/../../torch/lib",
259+
# ROCm >= 7.14 layout B: rocm-sdk-core ships as a separate pip wheel
260+
# and ROCm runtime lives in _rocm_sdk_core/lib.
257261
"$ORIGIN/../../_rocm_sdk_core/lib",
258262
"$ORIGIN/../../_rocm_sdk_core/lib/rocm_sysdeps/lib",
259263
# ROCm <= 7.2: standard system install path (AMD installer always
260-
# creates /opt/rocm symlink even for versioned installs like 7.2.0)
264+
# creates the /opt/rocm symlink even for versioned installs like 7.2.0).
261265
"/opt/rocm/lib",
262266
"/opt/rocm/lib/rocm_sysdeps/lib",
263267
])

0 commit comments

Comments
 (0)