Skip to content

Add ROCm-compatible source build fixes#3

Open
ZJLi2013 wants to merge 1 commit into
trianglesplatting:mainfrom
PhysicalAI-AIM:rocm_support
Open

Add ROCm-compatible source build fixes#3
ZJLi2013 wants to merge 1 commit into
trianglesplatting:mainfrom
PhysicalAI-AIM:rocm_support

Conversation

@ZJLi2013

Copy link
Copy Markdown

Summary

This PR makes the existing CUDA source tree buildable with PyTorch ROCm/hipify while keeping the CUDA build path unchanged. It only modifies existing source and packaging files; it does not add generated HIP sources.

Changes

  • Skip the CUDA-only --use_fast_math nvcc flag when building with a ROCm PyTorch runtime.
  • Remove CUDA-only headers that are unavailable in the ROCm toolchain.
  • Normalize CUDA kernel launch syntax so hipify can parse the existing .cu sources.
  • Replace CUDA-only trap / pointer type usage with forms accepted by ROCm hipcc.

Reproduction

git clone https://github.com/ZJLi2013/diff-triangle-rasterization.git
cd diff-triangle-rasterization
git checkout rocm_support
git submodule update --init --recursive

export PYTORCH_ROCM_ARCH=gfx942
pip install . --no-build-isolation

python - <<'PY'
import torch
import diff_triangle_rasterization
print(torch.__version__, torch.version.hip)
print("diff_triangle_rasterization import ok")
PY

Tested On

  • GPU: AMD Instinct MI300X
  • ROCm: 6.4.3
  • PyTorch: 2.6.0 ROCm Docker build
  • Docker: rocm/pytorch:rocm6.4.3_ubuntu24.04_py3.12_pytorch_release_2.6.0

Notes

  • CUDA builds still use the existing cuda_rasterizer/*.cu source path.
  • This PR intentionally avoids checking in generated hip_rasterizer sources.

Adjust the existing CUDA sources and setup flags so PyTorch ROCm hipify can build the extension without adding generated HIP source files.
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