Skip to content

add ROCm/HIP build instructions for AMD GPUs#109

Open
Kaihui-AMD wants to merge 1 commit into
Dao-AILab:mainfrom
Kaihui-AMD:rocm_support
Open

add ROCm/HIP build instructions for AMD GPUs#109
Kaihui-AMD wants to merge 1 commit into
Dao-AILab:mainfrom
Kaihui-AMD:rocm_support

Conversation

@Kaihui-AMD
Copy link
Copy Markdown

Summary

Add build instructions for AMD GPUs via ROCm/HIP. The project already
supports HIP (setup.py detects torch.version.hip and configures HIP
compile flags), but the README only documents a ROCm 6.0 patch without
explaining how to build on AMD hardware.

This addresses #99.

Test environment

  • GPU: AMD Radeon R9700 Pro (gfx1201, RDNA 4), 32 GB VRAM
  • OS: Ubuntu 24.04, kernel 6.17.0-20-generic
  • ROCm: 7.2.3 (container: rocm/pytorch:rocm7.2.3_ubuntu24.04_py3.12_pytorch_release_2.9.1)
  • PyTorch: 2.9.1+rocm7.2.3

Build steps

docker run -it --device /dev/kfd --device /dev/dri \
  -e ROCBLAS_USE_HIPBLASLT=0 -e HIP_VISIBLE_DEVICES=0 \
  rocm/pytorch:rocm7.2.3_ubuntu24.04_py3.12_pytorch_release_2.9.1

# inside container
git clone https://github.com/Dao-AILab/causal-conv1d.git
cd causal-conv1d
pip install einops
HIP_ARCHITECTURES=gfx1201 CAUSAL_CONV1D_FORCE_BUILD=TRUE \
  pip install --no-build-isolation -e .

Test results

Functional test:

import torch
from causal_conv1d import causal_conv1d_fn
x = torch.randn(2, 64, 128, device="cuda", dtype=torch.float16)
weight = torch.randn(64, 4, device="cuda", dtype=torch.float16)
out = causal_conv1d_fn(x, weight)
print(out.shape, torch.isnan(out).any(), torch.isinf(out).any())
# torch.Size([2, 64, 128]) tensor(False) tensor(False)

Full test suite:

python3 -m pytest tests/test_causal_conv1d.py -v
================ 9412 passed, 3888 skipped in 166.05s (0:02:46) ======

Signed-off-by: Kaihui-AMD <Kaihui.Tang@amd.com>
@Kaihui-AMD
Copy link
Copy Markdown
Author

Hi @tridao @ko3n1g, would you mind taking a look when you get a chance? This is a small README-only change adding ROCm/HIP build instructions — the HIP codepath already works, just undocumented. Thanks!

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.

1 participant