Skip to content

cmake: add opt-in portable RPATHs for TheRock ROCm wheels - #3549

Draft
sa-faizal wants to merge 1 commit into
ROCm:release/2.12from
sa-faizal:fix/portable-rocm-wheel-rpath
Draft

cmake: add opt-in portable RPATHs for TheRock ROCm wheels#3549
sa-faizal wants to merge 1 commit into
ROCm:release/2.12from
sa-faizal:fix/portable-rocm-wheel-rpath

Conversation

@sa-faizal

@sa-faizal sa-faizal commented Aug 9, 2026

Copy link
Copy Markdown

The default CMAKE_INSTALL_RPATH_USE_LINK_PATH policy copies build-environment ROCm library directories into installed wheel RUNPATHs. Those absolute paths do not exist in a clean installation.

Add an opt-in THEROCK_PYTORCH_PORTABLE_RPATH policy that:

  • disables automatic link-directory capture;
  • keeps $ORIGIN for Torch's own libraries;
  • adds wheel-relative paths to _rocm_sdk_core and _rocm_sdk_libraries;
  • derives the Clang resource version from the configured compiler instead of hard-coding a ROCm release.

The option defaults to OFF, so existing builds retain their current behavior. The libtorchless MKL override also respects the opt-in policy.

Validation:

  • CMake tracing confirmed the portable list and CMAKE_INSTALL_RPATH_USE_LINK_PATH=FALSE when enabled.
  • The disabled path retains the existing link-path policy.
  • A configure run reached and reported the new policy before stopping on unrelated missing host Python packages.
  • git diff --check passes.

Stacked follow-up: ROCm/TheRock#7210 enables this option for its production PyTorch wheel builder and rejects absolute wheel RPATH/RUNPATH entries before publishing artifacts.

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.

1 participant