Skip to content

[release/2.11.0.3] Implement ROCm version check (installed vs torch) - #21

Merged
jithunnair-amd merged 3 commits into
release/2.11.0.3from
rraminen/cherrypick_pr15_release_2.11.0.3
Oct 2, 2026
Merged

jithunnair-amd merged 3 commits into
release/2.11.0.3from
rraminen/cherrypick_pr15_release_2.11.0.3

Conversation

@rraminen

@rraminen rraminen commented Oct 2, 2026

Copy link
Copy Markdown

This PR is to cherry-pick the commits from #15 PR into release/2.11.0.3 branch.

Summary

  • On ROCm, cuda_version() now reports the installed ROCm version from rocm-core/rocm_version.h (ROCM_VERSION_MAJOR * 100 + ROCM_VERSION_MINOR), instead of TORCH_HIP_VERSION.
  • _check_cuda_version() compares that value to torch.version.rocm (major.minor) and raises a clear error if PyTorch and TorchAudio were built for different ROCm versions, mirroring the existing CUDA check.
  • Removed unused -DTORCH_HIP_VERSION compile flags from tools/setup_helpers/extension.py.

Testing

Tested on ROCm 10.1. TorchAudio's native extension reported version 1001 (ROCm 10.1).
I simulated a mismatched PyTorch build by temporarily overriding torch.version.rocm:

python
from unittest import mock

import torch
import torchaudio
from torchaudio._extension.utils import _check_cuda_version

print("TorchAudio ROCm:", torch.ops._torchaudio.cuda_version())
print("PyTorch ROCm:", torch.version.rocm)

with mock.patch.object(torch.version, "rocm", "9.0.0"):
    _check_cuda_version()

Output:

TorchAudio ROCm: 1001
PyTorch ROCm: 10.1.0
Traceback (most recent call last):
  File "<stdin>", line 10, in <module>
  File "/opt/venv/lib/python3.12/site-packages/torchaudio/_extension/utils.py", line 136, in _check_cuda_version
    raise RuntimeError(
RuntimeError: Detected that PyTorch and TorchAudio were compiled with different ROCm versions. PyTorch has ROCm version 9.0 whereas TorchAudio has ROCm version 10.1. Please install the TorchAudio version that matches your PyTorch version.

@jithunnair-amd
jithunnair-amd merged commit 4c8abfd into release/2.11.0.3 Oct 2, 2026
@jithunnair-amd
jithunnair-amd deleted the rraminen/cherrypick_pr15_release_2.11.0.3 branch October 2, 2026 21:51
pablo-garay pushed a commit that referenced this pull request Oct 14, 2026
…21)

* Use TORCH_HIP_VERSION

* Remove rocm version logic in extensions.py

* Compare installed ROCm to torch.version.rocm via rocm_version.h

(cherry picked from commit 4c8abfd)
Signed-off-by: pablo-garay <[email protected]>
jithunnair-amd pushed a commit to ROCm/pytorch that referenced this pull request Oct 16, 2026
## Summary

Bringup step for `release/2.15`: add `related_commits` pinning the ROCm
dependency builds.

- apex: new `ROCm/apex` `release/1.15.0` (cut from master, version
1.15.0)
- torchvision: upstream `pytorch/vision` `release/0.29`
- torchaudio: new `ROCm/audio` `release/2.11.1`: upstream
`pytorch/audio` `release/2.11.1` plus the ROCm build support from
`release/2.11.0.3` and the ROCm version check (ROCm/audio#21)

Same layout as the `release/2.14` `related_commits` (#3573). Tracking:
AIPYTORCH-1326

---------

Signed-off-by: pablo-garay <[email protected]>
jithunnair-amd pushed a commit to ROCm/pytorch that referenced this pull request Nov 4, 2026
## Summary

Bringup step for `release/2.15`: add `related_commits` pinning the ROCm
dependency builds.

- apex: new `ROCm/apex` `release/1.15.0` (cut from master, version
1.15.0)
- torchvision: upstream `pytorch/vision` `release/0.29`
- torchaudio: new `ROCm/audio` `release/2.11.1`: upstream
`pytorch/audio` `release/2.11.1` plus the ROCm build support from
`release/2.11.0.3` and the ROCm version check (ROCm/audio#21)

Same layout as the `release/2.14` `related_commits` (#3573). Tracking:
AIPYTORCH-1326

---------

Signed-off-by: pablo-garay <[email protected]>
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.

2 participants