[ROCm] Add HIP support for AMD Instinct GPUs#31
Open
andyluo7 wants to merge 1 commit intoJeffreyXiang:mainfrom
Open
[ROCm] Add HIP support for AMD Instinct GPUs#31andyluo7 wants to merge 1 commit intoJeffreyXiang:mainfrom
andyluo7 wants to merge 1 commit intoJeffreyXiang:mainfrom
Conversation
Port all CUDA-specific code to work on both CUDA and ROCm via HIP: - Headers: #ifdef __HIP_PLATFORM_AMD__ guards for cuda.h → hip/hip_runtime.h, cub/cub.cuh → hipcub/hipcub.hpp - API: cudaMalloc/Free/Memcpy → hipMalloc/Free/Memcpy (guarded) - CUB → hipcub namespace mapping - ::cuda::std::tuple → ::rocprim::tuple (for DeviceRadixSort decomposer) - ::cuda::std::plus → hipcub::Sum() - Vec3f: add default __host__ __device__ constructor for hipcub compatibility - ATen/cuda → ATen/hip (in cubvh submodule) - setup.py: default arch gfx942, gate CUDA-only flags behind IS_HIP check Tested on AMD MI300X (gfx942) with ROCm 7.0.2 + PyTorch 2.9.1. All code remains cross-compilable for CUDA. Signed-off-by: Andy Luo <andyluo7@users.noreply.github.com>
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.
Summary
Port CuMesh to support AMD ROCm GPUs (MI300X / gfx942) via HIP.
Changes
#ifdef __HIP_PLATFORM_AMD__guards for cross-compilation::cuda::std::tuple→::rocprim::tuplefor DeviceRadixSort decomposerVec3fdefault constructor added for hipcubDeviceSegmentedReducecompatibilitygfx942, CUDA-only flags gated behindIS_HIPTesting
import cumeshsucceeds on AMD MI300X__HIP_PLATFORM_AMD__)Motivation
TRELLIS.2's
setup.shalready detects ROCm and installs ROCm PyTorch, but CuMesh's CUDA-specific code prevents it from building on AMD GPUs. This PR enables the full TRELLIS.2 pipeline on AMD hardware.