Repository navigation
Load ROCm from the SDK wheels the torch wheel was built against - #4
Merged
Merged
Conversation
ROCm wheels built against an unpacked TheRock SDK (PYTORCH_ROCM_EXTERNAL_SDK) declared no ROCm dependency and shipped no torch/_rocm_init.py, so `import torch` resolved librocm-openblas and the HIP libraries only through LD_LIBRARY_PATH or whatever ROCm the host's ld.so.conf exposed. On a Breadboard guest that is the accelerator pack's ROCm 10.0, not the 10.1 SDK the wheel was built and patched against; without LD_LIBRARY_PATH the import fails on librocm-openblas.so.0. The build now takes the SDK wheels' version from PYTORCH_ROCM_SDK_VERSION. tools/metadata/dependencies.py pins rocm[libraries] to it, and torch/CMakeLists.txt writes the _rocm_init.py that the existing install rule and torch/__init__.py already expect, so `import torch` preloads the SDK libraries from those wheels through rocm_sdk.initialize_process and checks the version. The preload list is TheRock's build_prod_wheels.py list minus hipdnn, which this SDK does not build. PYTORCH_ROCM_EXTERNAL_SDK is gone; the alternative of keeping it and fixing the guest's ld.so.conf would leave torch tied to whatever ROCm the host provides. Test Plan: ``` cmake -P test.cmake # the new block, with and without PYTORCH_ROCM_SDK_VERSION python -c 'import dependencies; ...' # rocm[libraries]==<version> env -u LD_LIBRARY_PATH python -c 'import torch; ...' ``` With the generated _rocm_init.py added to the published gdb71170c wheel on a gfx1201 sandbox, `import torch` succeeds without LD_LIBRARY_PATH and /proc/self/maps shows libamdhip64, libhsa-runtime64, librocblas, libMIOpen and librocm-openblas loaded from the rocm_sdk wheels. A full wheel build with the change was not run. Authored with an AI assistant (Claude Code). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
Draft until reviewed.
Agent details (AI-generated)
🤖 Generated with Claude Code