Skip to content

Point hipconfig's ROCM_PATH towards dev packages if develop packages are installed#2870

Merged
darren-amd merged 4 commits intomainfrom
darren-amd/fix-hipconfig-link
Mar 4, 2026
Merged

Point hipconfig's ROCM_PATH towards dev packages if develop packages are installed#2870
darren-amd merged 4 commits intomainfrom
darren-amd/fix-hipconfig-link

Conversation

@darren-amd
Copy link
Copy Markdown
Contributor

@darren-amd darren-amd commented Jan 12, 2026

PR based on #2428.

Motivation

We'd like hipconfig --rocmpath to point towards _rocm_sdk_devel if the rocm[devel] packages are installed. This is useful for code that depends on hipconfig --rocmpath to resolve paths for ROCm files. Aimed as a fix for #1880 and other PyTorch issues that require the develop packages.

Technical Details

Test Plan

Linux:

  • The unit test testCLIUsesDevelRootPath passes (rocm-sdk test passes)
  • Tested by installing without the devel packages and with the devel packages
pip install --index-url https://rocm.devreleases.amd.com/v2-staging/gfx1151/ "rocm[libraries]==7.11.0.dev0+5d4dfe88517275760144e58af2e70af3dff5d2bc"
hipconfig --rocmpath
# /home/rocm/darren/hipconfig-test/.venv/lib/python3.12/site-packages/_rocm_sdk_core
pip install --index-url https://rocm.devreleases.amd.com/v2-staging/gfx1151/ "rocm[libraries,devel]==7.11.0.dev0+5d4dfe88517275760144e58af2e70af3dff5d2bc"
hipconfig --rocmpath
# /home/rocm/darren/hipconfig-test/.venv/lib/python3.12/site-packages/_rocm_sdk_devel

Test Result

On Linux, the unit test passes and without the develop packages hipconfig --rocmpath correctly points at the core packages. When the develop packages are installed, it correctly expands and points tot he develop packages.

Submission Checklist

@darren-amd
Copy link
Copy Markdown
Contributor Author

Have not tested on Windows yet, will do so after build completes.

@marbre
Copy link
Copy Markdown
Member

marbre commented Jan 13, 2026

We had an issue with a history rewrite which confused the GH UI and the commits it is showing on your PR. Please make sure to update your branch e.g. in the GH UI via

image

Afterwards you need update your local branch via git pull.

Alternative git rebase solution

Alternatively you can manually update your branch locally by following the below instructions:

git checkout <yourbranch>
git fetch origin main
git rebase origin/main
git push --force-with-lease origin <yourbranch>

@darren-amd darren-amd force-pushed the darren-amd/fix-hipconfig-link branch from 5d4dfe8 to 3aad9ba Compare January 13, 2026 19:14
@darren-amd
Copy link
Copy Markdown
Contributor Author

Thanks, just verified with build 7.11.0.dev0+5d4dfe88517275760144e58af2e70af3dff5d2bc that tests pass on windows as well.

@darren-amd darren-amd marked this pull request as ready for review January 13, 2026 21:43
@darren-amd darren-amd requested a review from ScottTodd January 13, 2026 21:44
Comment on lines -198 to +205
if _is_windows() and ti.issym():
# Convert symlinks into hardlinks on Windows.
# This saves disk space while improving compatibility
# on systems without as robust symlink support.
if ti.issym():
# Convert file symlinks into hardlinks on all platforms.
# This saves disk space while improving compatibility.
# On Windows: symlinks require admin privileges.
# On Linux: native binaries that use readlink(/proc/self/exe)
# to determine their location will resolve symlinks and
# report the wrong path (e.g., _rocm_sdk_core instead of
# _rocm_sdk_devel). Hardlinks avoid this issue.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, this change looks good to me by I would also like to hear @stellaraccident 's opinion. I was on the fence about making it and discussed a bit with @marbre before and the comment helps justify it, at least to me.

We should probably also update the documentation at https://github.com/ROCm/TheRock/blob/main/docs/packaging/python_packaging.md, specifically this section:

  • Devel package: The rocm-sdk-devel package is the catch-all for everything.
    For any file already populated in a runtime package, it will include it as
    a relative symlink (also rewriting shared library soname links as needed).
    Since symlinks and non-standard attributes cannot be included in a wheel file,
    the platform contents are stored in a _devel.tar or _devel.tar.xz file.
    The installed package is extended in response to requesting a path to it
    via the rocm-sdk tool.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks Scott, I will update the docs

Copy link
Copy Markdown
Member

@ScottTodd ScottTodd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, but I'm a bit worried this may have some unintended side effects on Linux. We have been using hardlinks on Windows though, so 🤷

Comment thread build_tools/packaging/python/templates/rocm/src/rocm_sdk/tests/devel_test.py Outdated
Comment thread build_tools/packaging/python/templates/rocm-sdk-core/src/rocm_sdk_core/_cli.py Outdated
Comment thread build_tools/packaging/python/templates/rocm-sdk-core/src/rocm_sdk_core/_cli.py Outdated
Comment thread build_tools/packaging/python/templates/rocm-sdk-core/src/rocm_sdk_core/_cli.py Outdated
Comment thread build_tools/packaging/python/templates/rocm-sdk-core/src/rocm_sdk_core/_cli.py Outdated
Comment thread build_tools/packaging/python/templates/rocm-sdk-core/src/rocm_sdk_core/_cli.py Outdated
Comment thread build_tools/packaging/python/templates/rocm/src/rocm_sdk/_devel.py
@amd-aakash amd-aakash requested a review from WBobby February 25, 2026 16:14
ScottTodd and others added 4 commits February 25, 2026 15:37
…stalled (#2428)

Fixes #1880.

Many projects (such as llama.cpp) look up paths to ROCm files using
`hipconfig --rocmpath`. Previously, our CLI scripts would always
trampoline to e.g. `_rocm_sdk_core/bin/hipconfig`, even if the
development files were available in `_rocm_sdk_devel` (which is a
superset of `_rocm_sdk_core`). This trampolines to `_rocm_sdk_devel` if
the devel package is installed.

* Added a new unit test
* Ran various local tests like:

    ```bash
    py -V:3.12 -m venv 3.12.venv && .\3.12.venv\Scripts\activate.bat

pip install --index-url https://rocm.nightlies.amd.com/v2/gfx110X-all/
--pre rocm[libraries]
    hipconfig --rocmpath
    # D:\scratch\therock\3.12.venv\Lib\site-packages\_rocm_sdk_core

pip install --index-url https://rocm.nightlies.amd.com/v2/gfx110X-all/
--pre rocm[libraries,devel]
    hipconfig --rocmpath
(Initialized automatically)
    hipconfig --rocmpath
shows no redundant init)
    ```

- [x] Look over the contributing guidelines at
https://github.com/ROCm/ROCm/blob/develop/CONTRIBUTING.md#pull-requests.
Makes Linux use hardlinks like Windows does. Fixes hipconfig binary
path detection.
@darren-amd darren-amd force-pushed the darren-amd/fix-hipconfig-link branch from c68a677 to e2907e7 Compare February 25, 2026 20:40
Copy link
Copy Markdown
Collaborator

@stellaraccident stellaraccident left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm good with this. We probably should have done this from the get-go as symlink indirection can cause many problems.

@darren-amd darren-amd merged commit bf4e415 into main Mar 4, 2026
217 of 228 checks passed
@darren-amd darren-amd deleted the darren-amd/fix-hipconfig-link branch March 4, 2026 22:09
@github-project-automation github-project-automation Bot moved this from TODO to Done in TheRock Triage Mar 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

5 participants