Build libtorchaudio GPU extensions on ROCm via HIPIFY (torchvision-style)#17
Draft
ethanwee1 wants to merge 2 commits into
Draft
Build libtorchaudio GPU extensions on ROCm via HIPIFY (torchvision-style)#17ethanwee1 wants to merge 2 commits into
ethanwee1 wants to merge 2 commits into
Conversation
…yle) Mirror torchvision's setup.py approach: run hipify_python.hipify() over the libtorchaudio sources when building for ROCm and compile the generated .hip outputs, instead of relying solely on the torch CUDAExtension HIPIFY (which only processes listed source files and left torchaudio headers/symbols like cuda_runtime_api.h, cudaSetDevice and cub un-converted). HIPIFY cannot rewrite preprocessor guards, so the #ifdef USE_CUDA gates around the rnnt/forced_align GPU headers, macros.h, and Options::stream_ are widened to `#if defined(USE_CUDA) || defined(USE_ROCM)`. Reference: https://github.com/ROCm/vision/blob/release/0.27/setup.py
ethanwee1
added a commit
to ROCm/pytorch
that referenced
this pull request
Jul 1, 2026
Author
|
TheRock test build (Windows gfx110X-all) via ROCm/pytorch#3382: |
ethanwee1
added a commit
to ROCm/pytorch
that referenced
this pull request
Jul 6, 2026
…io#16) Revert the temporary HIPIFY-based pin (ROCm/audio#17) back to the compat-shim port commit that passed TheRock Windows validation (28529085509). The HIPIFY setup.py approach still leaves CUDA headers unconverted; the cuda_compat.h port in ROCm/audio#16 is the validated path. The Windows cross-drive HIPIFY fix remains in torch/utils/cpp_extension.py (this PR); it is unrelated to the audio-side port strategy.
Author
…yle) Mirror torchvision's setup.py approach: run hipify_python.hipify() over libtorchaudio CUDA sources and headers, then compile the generated .hip outputs. Fixes vs the first HIPIFY attempt (TheRock 28538325024): 1. Do not widen `#ifdef USE_CUDA` to `USE_ROCM` in headers — that pulled `cuda_fp16.h` into CPU `.cpp` compiles because PyTorch defines USE_ROCM globally on ROCm extension builds. Keep upstream USE_CUDA guards; pass `-DUSE_CUDA` on hipcc/nvcc only for GPU translation units. 2. Hipify with `os.path.realpath()` paths and depth-aware include globs so headers like `cuda_utils.h` are rewritten on the same inode Windows runners use when B: is a subst alias of the C: checkout (otherwise the compiler reads un-hipified headers from the underlying path). 3. Include `cuctc/` in the hipify scope. Reference: https://github.com/ROCm/vision/blob/release/0.27/setup.py Paired with ROCm/pytorch#3382 (torchaudio pin + Windows cross-drive HIPIFY fix in torch/utils/cpp_extension.py — that fix is in PyTorch, not here).
ethanwee1
added a commit
to ROCm/pytorch
that referenced
this pull request
Jul 6, 2026
Update ethanwee1/audio ew/rocm-24803-hipify-gpu-ext to 0c7509ef with: - realpath-based hipify (Windows B:/C: alias) - reverted USE_ROCM header guard widening - -DUSE_CUDA on hipcc for GPU units only
Author
|
HIPIFY v2 pushed (
ROCm/pytorch#3382 pin updated to this commit. |
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.
Build libtorchaudio GPU extensions on ROCm via HIPIFY (torchvision-style)
Mirror torchvision's setup.py approach: run hipify_python.hipify() over
libtorchaudio CUDA sources and headers, then compile the generated .hip
outputs.
Fixes vs the first HIPIFY attempt (TheRock 28538325024):
#ifdef USE_CUDAtoUSE_ROCMin headers — that pulledcuda_fp16.hinto CPU.cppcompiles because PyTorch defines USE_ROCMglobally on ROCm extension builds. Keep upstream USE_CUDA guards; pass
-DUSE_CUDAon hipcc/nvcc only for GPU translation units.os.path.realpath()paths and depth-aware include globs soheaders like
cuda_utils.hare rewritten on the same inode Windows runnersuse when B: is a subst alias of the C: checkout (otherwise the compiler
reads un-hipified headers from the underlying path).
cuctc/in the hipify scope.Reference: https://github.com/ROCm/vision/blob/release/0.27/setup.py
Paired with ROCm/pytorch#3382 (torchaudio pin + Windows cross-drive HIPIFY fix
in torch/utils/cpp_extension.py — that fix is in PyTorch, not here).