Draft
Conversation
Co-authored-by: albertandaluz <176801700+albertandaluz@users.noreply.github.com>
…NFO) Co-authored-by: albertandaluz <176801700+albertandaluz@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Review and suggest changes for CMake scripts to support HIP
Add AMD ROCm/HIP platform support
Mar 13, 2026
# Conflicts: # include/fused_kernel/algorithms/image_processing/image.h # include/fused_kernel/core/data/ptr_nd.h # include/fused_kernel/core/execution_model/data_parallel_patterns.h # include/fused_kernel/core/execution_model/executor_details/executor_kernels.h # include/fused_kernel/core/execution_model/executors.h # include/fused_kernel/core/execution_model/parallel_architectures.h # include/fused_kernel/core/utils/compiler_macros.h # include/fused_kernel/core/utils/utils.h
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.
The library only supported NVIDIA CUDA and CPU backends. This adds AMD GPU support via CMake 4.x native HIP language, using HIP's built-in CUDA compatibility layer so existing CUDA API calls in headers work transparently without touching
.cusource files.New CMake infrastructure
cmake/hip_init.cmake— callsenable_language(HIP), wires up HIP cmake modulescmake/libs/hip/hip.cmake—find_package(hip), definesadd_hip_to_target(),ENABLE_HIP_LINE_INFO/ENABLE_HIP_DEBUGoptionscmake/libs/hip/archs.cmake— GPU arch selection viaHIP_ARCHcache var (defaults tonative)cmake/libs/hip/target_generation.cmake— target properties, debug/lineinfo helpersCMakeLists.txt & test discovery
CMakeLists.txt:check_language(HIP)+ENABLE_HIPoption; includescmake/hip_init.cmakewhen foundcmake/discover_tests.cmake,cmake/tests/discover_tests.cmake,cmake/tests/add_generated_test.cmake: generate.hiplaunchers alongside.cu/.cppwhenCMAKE_HIP_COMPILER AND ENABLE_HIPbenchmarks/CMakeLists.txt,utest_saturate/CMakeLists.txt: HIP equivalents added alongside existing CUDA blockscmake/discover_tests.cmake: scopedCUDA::cuda_driverlink to CUDA-only targetsHeader changes
All changes are additive
#elif HIP_HOST_DEVICE/|| HIP_HOST_DEVICEguards; no existing CUDA paths modified.compiler_macros.h—HIP_HOST_DEVICEmacro (1 when__HIP__defined)utils.h—#include <hip/hip_runtime.h>+gpuAssert(hipError_t)/gpuErrchkfor HIPparallel_architectures.h—defaultParArch = GPU_AMDwhen HIP; addsHIP_HOST_DEVICEinclude-guard checkstream.h—Stream_<ParArch::GPU_AMD>specialisation usinghipStream_texecutor_kernels.h— addsHIP_HOST_DEVICEto compile guard (HIP supports__grid_constant__since ROCm 5.4)data_parallel_patterns.h—TransformDPP<GPU_AMD>andDivergentBatchTransformDPP<GPU_AMD>specialisations;DivergentBatchTransformDPPBasetemplated onParArchsolaunchTransformDPPdispatches to the correct archexecutors.h—Executor<TransformDPP<GPU_AMD>>andExecutor<DivergentBatchTransformDPP<GPU_AMD>>specialisations; static_assert updated to allowGPU_AMDptr_nd.h—defaultMemType = DeviceAndPinnedfor HIP; alloc/free/copy functions extended;upload/downloadoverloads forStream_<GPU_AMD>vector_types.h— skips CPU-sidefk::aliases when HIP (HIP runtime already provides them viahip_vector_types.h)ptr_utils.h—GPU_AMDbranch insetToimage.h— HIPupload/downloadoverloadsInvocation (Windows, ROCm 7.1)
🔒 GitHub Advanced Security automatically protects Copilot coding agent pull requests. You can protect all pull requests by enabling Advanced Security for your repositories. Learn more about Advanced Security.