Skip to content
This repository was archived by the owner on Apr 6, 2026. It is now read-only.

Commit a8945b5

Browse files
committed
Hipified files should also get offload arch args
1 parent 6029e51 commit a8945b5

2 files changed

Lines changed: 8 additions & 1 deletion

File tree

build2cmake/src/templates/cuda/kernel.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ elseif(GPU_LANG STREQUAL "HIP")
5353
message(STATUS "Archs for kernel {{kernel_name}}: {{ '${' + kernel_name + '_ARCHS}'}}")
5454

5555
foreach(_KERNEL_SRC {{'${' + kernel_name + '_SRC}'}})
56-
if(_KERNEL_SRC MATCHES ".*\\.hip$")
56+
if(_KERNEL_SRC MATCHES ".*\\.(cu|hip)$")
5757
foreach(_ROCM_ARCH {{ '${' + kernel_name + '_ARCHS}'}})
5858
set_property(
5959
SOURCE ${_KERNEL_SRC}

build2cmake/src/templates/utils.cmake

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ function (hipify_sources_target OUT_SRCS NAME ORIG_SRCS)
7474
set(HIP_SRCS)
7575
foreach (SRC ${SRCS})
7676
get_source_file_property(include_dirs "${SRC}" INCLUDE_DIRECTORIES)
77+
get_source_file_property(compile_options "${SRC}" COMPILE_OPTIONS)
7778
string(REGEX REPLACE "\.cu$" "\.hip" SRC ${SRC})
7879
string(REGEX REPLACE "cuda" "hip" SRC ${SRC})
7980

@@ -84,6 +85,12 @@ function (hipify_sources_target OUT_SRCS NAME ORIG_SRCS)
8485
PROPERTIES INCLUDE_DIRECTORIES "${include_dirs}")
8586
endif()
8687

88+
if(compile_options)
89+
set_source_files_properties(
90+
${SRC}
91+
PROPERTIES COMPILE_OPTIONS "${compile_options}")
92+
endif()
93+
8794
list(APPEND HIP_SRCS "${CMAKE_CURRENT_BINARY_DIR}/${SRC}")
8895
endforeach()
8996

0 commit comments

Comments
 (0)