[ROCm] Include ROCM support for CUDA extensions#4180
[ROCm] Include ROCM support for CUDA extensions#4180amd-sriram wants to merge 24 commits intopytorch:mainfrom
Conversation
* fix build error on ROCM * Update CMakeLists.txt Co-authored-by: Nikita Shulga <nikita.shulga@gmail.com> * address comments and fix cuda detction on rocm Co-authored-by: Nikita Shulga <nikita.shulga@gmail.com>
* disable mvdr test * skip more tests * update script * fix kaldi import * add more skips
Co-authored-by: Cursor <cursoragent@cursor.com>
…ip rocm so it is the same as upstream
Rocm rnnt loss feature
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/audio/4180
Note: Links to docs will display an error until the docs builds have been completed. ❗ 1 Active SEVsThere are 1 currently active SEVs. If your PR is affected, please view them below: This comment was automatically generated by Dr. CI and updates every 15 minutes. |
remove hipblas flags
Remove hip namespace shim
|
@NicolasHug Could you please review this PR. Thanks. |
This comment was marked as spam.
This comment was marked as spam.
|
@amd-sriram @jithunnair-amd could we get this merged upstream? |
@srinivamd Thanks for bumping this up, I have reached out to @malfet to see if he can help us get some traction on this one. |
|
Hi folks, thanks for the PR but sorry, the TorchAudio codebase is frozen now and we won't be able to merge any new change or features |
|
@NicolasHug Thanks for your response. |
Motivation
Port cuda extensions to ROCm:
Technical Details
Changes to tools/setup_helpers/extension.py
cuda source files are added for _USE_ROCM flag.
e.g.
if _USE_CUDA or _USE_ROCM:
sources.append("iir_cuda.cu")
Fixing compilation issues
The following fixes have been made to fix the following errors:
1. TORCH_HIP_VERSION is not defined
TORCH_HIP_VERSION is defined in tools/setup_helpers/extension.py , similiar to ttps://github.com/ROCm/pytorch/blob/develop/cmake/public/LoadHIP.cmake#L166
math(EXPR TORCH_HIP_VERSION "(${HIP_VERSION_MAJOR} * 100) + ${HIP_VERSION_MINOR}")2. kernel launch parameters are not proper
Correct the parameters in THO_DISPATCH_V2 based on https://github.com/ROCm/pytorch/blob/develop/test/cpp_extensions/libtorch_agn_2_9_extension/csrc/kernel.cpp#L361
Test Plan
Run this branch in both Nvidia machine and AMD machine, check if it installs and run the unit tests for the cuda extensions:
Test Result
Number of passed unit tests:
Attached log for torch 2.11
torch211_log.txt
Doesn't support torch 2.10