Skip to content

[ROCm] Enable hipFile - #191069

Closed
zjliu-amd wants to merge 4 commits into
pytorch:mainfrom
zjliu-amd:hipfile-enablement
Closed

zjliu-amd wants to merge 4 commits into
pytorch:mainfrom
zjliu-amd:hipfile-enablement

Conversation

@zjliu-amd

@zjliu-amd zjliu-amd commented Jul 24, 2026 •

Copy link
Copy Markdown
Contributor

This PR enables hipFile in PyTorch by adding mappings to hipify and updating cmake files, adds more tests for GDS, and also adds a helper variable and a function to facilitate tests' skip condition.
hipFile only ships with ROCm on ROCm 7.14 and later, therefore hipFile is only required after that version.

Authored with Claude.

cc @jeffdaily @sunway513 @jithunnair-amd @pruthvistony @ROCmSupport @jataylo @hongxiayang @naromero77amd @pragupta @jerrymannil @xinyazhang

@pytorch-bot

pytorch-bot Bot commented Jul 24, 2026 •

Copy link
Copy Markdown

🔗 Helpful Links

🧪 See artifacts and rendered test results at hud.pytorch.org/pr/191069

Note: Links to docs will display an error until the docs builds have been completed.

✅ You can merge normally! (2 Unrelated Failures)

As of commit 5457d15 with merge base 2033053 (image):

FLAKY - The following jobs failed but were likely due to flakiness present on trunk:

This comment was automatically generated by Dr. CI and updates every 15 minutes.

@pytorch-bot pytorch-bot Bot added the module: rocm AMD GPU support for Pytorch label Jul 24, 2026
@jithunnair-amd jithunnair-amd added ciflow/trunk Trigger trunk jobs on your pull request ciflow/rocm-nightly Trigger "default" config CI on a nightly build of ROCm from theRock on MI300 labels Jul 24, 2026
@zjliu-amd

Copy link
Copy Markdown
Contributor Author

@pytorchbot rebase

@pytorchmergebot

Copy link
Copy Markdown
Collaborator

@pytorchbot started a rebase job onto refs/remotes/origin/viable/strict. Check the current status here

@pytorchmergebot

Copy link
Copy Markdown
Collaborator

Rebase failed due to Command git -C /home/runner/work/pytorch/pytorch rebase --onto refs/remotes/origin/viable/strict e5c7cf18b844e7cf4c45f991bd74d083038e556f pull/191069/head returned non-zero exit code 1

Rebasing (1/2)
Auto-merging .ci/manywheel/repair_wheel.py
Auto-merging cmake/Dependencies.cmake
CONFLICT (content): Merge conflict in cmake/Dependencies.cmake
Auto-merging cmake/public/LoadHIP.cmake
Auto-merging torch/utils/hipify/cuda_to_hip_mappings.py
error: could not apply b9eb1573744... enable hipfile
hint: Resolve all conflicts manually, mark them as resolved with
hint: "git add/rm <conflicted_files>", then run "git rebase --continue".
hint: You can instead skip this commit: run "git rebase --skip".
hint: To abort and get back to the state before "git rebase", run "git rebase --abort".
hint: Disable this message with "git config set advice.mergeConflict false"
Could not apply b9eb1573744... # enable hipfile

Raised by https://github.com/pytorch/pytorch/actions/runs/30137436118

@zjliu-amd
zjliu-amd force-pushed the hipfile-enablement branch from 3fc2806 to fc689cd Compare July 25, 2026 01:02
@pytorch-bot

pytorch-bot Bot commented Jul 25, 2026 •

Copy link
Copy Markdown

Workflows were awaiting approval. CI has now been triggered for the ciflow labels on this PR.

@zjliu-amd

Copy link
Copy Markdown
Contributor Author

@pytorchbot rebase

@zjliu-amd

Copy link
Copy Markdown
Contributor Author

@pytorchbot fix-lint

@pytorch-bot

pytorch-bot Bot commented Jul 25, 2026

Copy link
Copy Markdown

You don't have permissions to trigger lint fixes on this PR since it requires write access to the repository. If you think this is a mistake, please contact PyTorch Dev Infra.

@pytorchmergebot

Copy link
Copy Markdown
Collaborator

@pytorchbot started a rebase job onto refs/remotes/origin/viable/strict. Check the current status here

@pytorchmergebot

Copy link
Copy Markdown
Collaborator

Successfully rebased hipfile-enablement onto refs/remotes/origin/viable/strict, please pull locally before adding more changes (for example, via git checkout hipfile-enablement && git pull --rebase)

@zjliu-amd zjliu-amd changed the title [ROCm] Enable HipFile [ROCm] Enable hipFile Jul 25, 2026
@zjliu-amd

Copy link
Copy Markdown
Contributor Author

@pytorchbot rebase

@pytorchmergebot

Copy link
Copy Markdown
Collaborator

@pytorchbot started a rebase job onto refs/remotes/origin/viable/strict. Check the current status here

@pytorchmergebot

Copy link
Copy Markdown
Collaborator

Successfully rebased hipfile-enablement onto refs/remotes/origin/viable/strict, please pull locally before adding more changes (for example, via git checkout hipfile-enablement && git pull --rebase)

@zjliu-amd
zjliu-amd marked this pull request as ready for review July 27, 2026 15:01
@pragupta

Copy link
Copy Markdown
Collaborator

Overall, the changes are fine. But, I think instead of making hipFile optional. We should make it required for ROCm > 7.14.

@ezyang ezyang added the triaged This issue has been looked at a team member, and triaged and prioritized into an appropriate module label Jul 27, 2026
@jithunnair-amd jithunnair-amd added the ciflow/rocm-preview Trigger unit tests CI on a preview build of ROCm from theRock on MI300 label Aug 7, 2026
@pytorch-bot

pytorch-bot Bot commented Aug 7, 2026

Copy link
Copy Markdown

Warning: Unknown label ciflow/rocm-preview.
Currently recognized labels are

  • ciflow/b200
  • ciflow/b200-distributed
  • ciflow/b200-symm-mem
  • ciflow/binaries
  • ciflow/binaries_libtorch
  • ciflow/binaries_wheel
  • ciflow/docker
  • ciflow/dtensor
  • ciflow/h100
  • ciflow/h100-cutlass-backend
  • ciflow/h100-distributed
  • ciflow/h100-symm-mem
  • ciflow/inductor
  • ciflow/inductor-cu126
  • ciflow/inductor-micro-benchmark
  • ciflow/inductor-micro-benchmark-cpu-x86
  • ciflow/inductor-pallas
  • ciflow/inductor-perf-compare
  • ciflow/inductor-perf-test-nightly-rocm-mi300
  • ciflow/inductor-perf-test-nightly-rocm-mi350
  • ciflow/inductor-perf-test-nightly-x86-zen
  • ciflow/inductor-perf-test-nightly-xpu
  • ciflow/inductor-periodic
  • ciflow/inductor-rocm-mi200
  • ciflow/inductor-rocm-mi300
  • ciflow/mps
  • ciflow/nightly
  • ciflow/op-benchmark
  • ciflow/periodic
  • ciflow/periodic-rocm-mi200
  • ciflow/periodic-rocm-mi300
  • ciflow/pull
  • ciflow/riscv64
  • ciflow/rocm-mi200
  • ciflow/rocm-mi300
  • ciflow/rocm-navi31
  • ciflow/rocm-nightly
  • ciflow/s390
  • ciflow/slow
  • ciflow/slow-rocm-mi200
  • ciflow/torchtitan
  • ciflow/triton_binaries
  • ciflow/trunk
  • ciflow/tsan
  • ciflow/unstable
  • ciflow/win-arm64
  • ciflow/xpu

Please add the new label to .github/pytorch-probot.yml

@zjliu-amd

Copy link
Copy Markdown
Contributor Author

#188429
Waiting for this PR to bump rocm nightly version

@zjliu-amd

Copy link
Copy Markdown
Contributor Author

@pytorchbot rebase -b main

@pytorchmergebot

Copy link
Copy Markdown
Collaborator

@pytorchbot started a rebase job onto refs/remotes/origin/main. Check the current status here

@pytorchmergebot

Copy link
Copy Markdown
Collaborator

Successfully rebased hipfile-enablement onto refs/remotes/origin/main, please pull locally before adding more changes (for example, via git checkout hipfile-enablement && git pull --rebase)

@jeffdaily jeffdaily added the release notes: rocm mandatorylabel label Aug 8, 2026
@jeffdaily

Copy link
Copy Markdown
Collaborator

@pytorchbot merge

@pytorchmergebot

Copy link
Copy Markdown
Collaborator

Merge started

Your change will be merged once all checks pass (ETA 0-4 Hours).

Learn more about merging in the wiki.

Questions? Feedback? Please reach out to the PyTorch DevX Team

Advanced Debugging
Check the merge workflow status
here

@pytorchmergebot

Copy link
Copy Markdown
Collaborator

Merge failed

Reason: 1 jobs have failed, first few of them are: rocm-preview / linux-noble-rocm-preview-py3.12-mi350 / test (distributed, 3, 3, linux.rocm.gpu.gfx950.2, module:rocm, oncall:distributed)

Details for Dev Infra team Raised by workflow job

@jeffdaily

Copy link
Copy Markdown
Collaborator

PR is blocked by a known failing test that was just DISABLED via issue. Merging and ignoring the unrelated failures here.

@pytorchbot merge -i

@pytorchmergebot

Copy link
Copy Markdown
Collaborator

Merge started

Your change will be merged while ignoring the following 2 checks: .github/workflows/trunk.yml / linux-jammy-rocm-py3.10-mi350 / test (distributed, 3, 3, linux.rocm.gpu.gfx950.2), rocm-preview / linux-noble-rocm-preview-py3.12-mi350 / test (distributed, 3, 3, linux.rocm.gpu.gfx950.2, module:rocm, oncall:distributed)

Learn more about merging in the wiki.

Questions? Feedback? Please reach out to the PyTorch DevX Team

Advanced Debugging
Check the merge workflow status
here

ankitbhrdwj pushed a commit to ankitbhrdwj/pytorch that referenced this pull request Aug 12, 2026
This PR enables hipFile in PyTorch by adding mappings to hipify and updating cmake files, adds more tests for GDS, and also adds a helper variable and a function to facilitate tests' skip condition.
hipFile only ships with ROCm on ROCm 7.14 and later, therefore hipFile is only required after that version.

Authored with Claude.

Pull Request resolved: pytorch#191069
Approved by: https://github.com/jeffdaily
amd-maradosa added a commit to ROCm/TheRock that referenced this pull request Aug 13, 2026
Issue link: #7329

## Motivation

Nightly PyTorch smoke tests fail and are blocked on Linux ROCm arches
(observed on gfx1153) at `import torch` with:

`[ERROR] Failed to retrieve GPU info: ERROR:libhipfile.so.0: cannot open
shared object file: No such file or directory
`
This started with the `10.1.0a20260811` nightly and is deterministic
(not flaky) —`import torch` never succeeds, so it also masks any real
underlying test failures.

Failing CI jobs (rockrel run 31452759725, torch nightly, gfx1153):
- py 3.12:
https://github.com/ROCm/rockrel/actions/runs/31452759725/job/93678340937
- py 3.10:
https://github.com/ROCm/rockrel/actions/runs/31452759725/job/93677958469
- py 3.13:
https://github.com/ROCm/rockrel/actions/runs/31452759725/job/93678622649

<!-- GitHub issue: add tracking issue link here if one exists -->

## Technical Details

Upstream PyTorch PR pytorch/pytorch#191069 ("[ROCm] Enable hipFile",
commit `4c5b5ab032f2a4f3c7807925ea92fffa457423c2`, in nightly source
since ~Aug 8) added `hip::hipfile` to `TORCH_PYTHON_LINK_LIBRARIES`. As
a result `libtorch_python.so` now carries `NEEDED libhipfile.so.0`.

In wheel installs, torch resolves its ROCm deps via the preload list we
generate into `torch/_rocm_init.py` (loaded RTLD_GLOBAL on `import
torch`), because torch's RUNPATH points at build-only paths.
`libhipfile.so.0` does ship in the `rocm-sdk-core` wheel, but `hipfile`
was never added to `LINUX_LIBRARY_PRELOADS`, so it is never preloaded
and `import torch` fails to load it.

This PR adds `"hipfile"` to `LINUX_LIBRARY_PRELOADS` in
`external-builds/pytorch/build_prod_wheels.py`. `hipfile` is already
declared as a core `LibraryEntry` in the rocm_sdk `_dist_info.py`, so
the shortname resolves. Windows is unaffected (hipFile is Linux-only),
so `WINDOWS_LIBRARY_PRELOADS` is left unchanged.

## Test Plan

- Confirm `torch/_rocm_init.py` includes `'hipfile'` in
`preload_shortnames`.
- Recommended before merge: nightly gfx1153 PyTorch smoke test against
this branch.

## Test Result

Validated locally in a ROCm container with the TheRock `rocm-sdk`
wheels:
- Without fix: `ctypes.CDLL('libhipfile.so.0')` fails with `cannot open
shared object file` (the CI error).
- With the fix's preload
(`initialize_process(preload_shortnames=[...,'hipfile'])`):
`libhipfile.so.0` loads from rocm-sdk-core and resolves.

## Submission Checklist

- [x] Look over the contributing guidelines at
https://github.com/ROCm/TheRock/blob/main/CONTRIBUTING.md.
lumachad pushed a commit to ROCm/TheRock that referenced this pull request Aug 18, 2026
Issue link: #7329

## Motivation

Nightly PyTorch smoke tests fail and are blocked on Linux ROCm arches
(observed on gfx1153) at `import torch` with:

`[ERROR] Failed to retrieve GPU info: ERROR:libhipfile.so.0: cannot open
shared object file: No such file or directory
`
This started with the `10.1.0a20260811` nightly and is deterministic
(not flaky) —`import torch` never succeeds, so it also masks any real
underlying test failures.

Failing CI jobs (rockrel run 31452759725, torch nightly, gfx1153):
- py 3.12:
https://github.com/ROCm/rockrel/actions/runs/31452759725/job/93678340937
- py 3.10:
https://github.com/ROCm/rockrel/actions/runs/31452759725/job/93677958469
- py 3.13:
https://github.com/ROCm/rockrel/actions/runs/31452759725/job/93678622649

<!-- GitHub issue: add tracking issue link here if one exists -->

## Technical Details

Upstream PyTorch PR pytorch/pytorch#191069 ("[ROCm] Enable hipFile",
commit `4c5b5ab032f2a4f3c7807925ea92fffa457423c2`, in nightly source
since ~Aug 8) added `hip::hipfile` to `TORCH_PYTHON_LINK_LIBRARIES`. As
a result `libtorch_python.so` now carries `NEEDED libhipfile.so.0`.

In wheel installs, torch resolves its ROCm deps via the preload list we
generate into `torch/_rocm_init.py` (loaded RTLD_GLOBAL on `import
torch`), because torch's RUNPATH points at build-only paths.
`libhipfile.so.0` does ship in the `rocm-sdk-core` wheel, but `hipfile`
was never added to `LINUX_LIBRARY_PRELOADS`, so it is never preloaded
and `import torch` fails to load it.

This PR adds `"hipfile"` to `LINUX_LIBRARY_PRELOADS` in
`external-builds/pytorch/build_prod_wheels.py`. `hipfile` is already
declared as a core `LibraryEntry` in the rocm_sdk `_dist_info.py`, so
the shortname resolves. Windows is unaffected (hipFile is Linux-only),
so `WINDOWS_LIBRARY_PRELOADS` is left unchanged.

## Test Plan

- Confirm `torch/_rocm_init.py` includes `'hipfile'` in
`preload_shortnames`.
- Recommended before merge: nightly gfx1153 PyTorch smoke test against
this branch.

## Test Result

Validated locally in a ROCm container with the TheRock `rocm-sdk`
wheels:
- Without fix: `ctypes.CDLL('libhipfile.so.0')` fails with `cannot open
shared object file` (the CI error).
- With the fix's preload
(`initialize_process(preload_shortnames=[...,'hipfile'])`):
`libhipfile.so.0` loads from rocm-sdk-core and resolves.

## Submission Checklist

- [x] Look over the contributing guidelines at
https://github.com/ROCm/TheRock/blob/main/CONTRIBUTING.md.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ciflow/rocm-nightly Trigger "default" config CI on a nightly build of ROCm from theRock on MI300 ciflow/rocm-preview Trigger unit tests CI on a preview build of ROCm from theRock on MI300 ciflow/trunk Trigger trunk jobs on your pull request Merged module: rocm AMD GPU support for Pytorch open source release notes: rocm mandatorylabel triaged This issue has been looked at a team member, and triaged and prioritized into an appropriate module

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants