File tree Expand file tree Collapse file tree 1 file changed +16
-6
lines changed
Expand file tree Collapse file tree 1 file changed +16
-6
lines changed Original file line number Diff line number Diff line change @@ -30,14 +30,24 @@ if(NOT DEFINED GPUCA_HIP_HIPIFY_FROM_CUDA OR "${GPUCA_HIP_HIPIFY_FROM_CUDA}")
3030 foreach (file ${GPUCA_HIP_FILE_LIST} )
3131 get_filename_component (ABS_CUDA_SORUCE ../cuda/${file} ABSOLUTE )
3232 get_filename_component (CUDA_SOURCE ${file} NAME )
33+ get_filename_component (CUDA_SOURCE_EXT ${file} EXT )
3334 string (REPLACE ".cu" ".hip" HIP_SOURCE1 ${CUDA_SOURCE} )
3435 string (REPLACE "CUDA" "HIP" HIP_SOURCE ${HIP_SOURCE1} )
35- add_custom_command (
36- OUTPUT ${GPUCA_HIP_SOURCE_DIR} /${HIP_SOURCE}
37- COMMAND ${hip_HIPIFY_PERL_EXECUTABLE} --quiet -warnings ${ABS_CUDA_SORUCE} | sed -e 's/CUDA/HIP/g' -e 's/cuda/hip/g' > ${GPUCA_HIP_SOURCE_DIR} /${HIP_SOURCE}
38- DEPENDS ${ABS_CUDA_SORUCE}
39- COMMENT "Hippifying ${HIP_SOURCE} "
40- )
36+ if (CUDA_SOURCE_EXT STREQUAL ".cu" OR CUDA_SOURCE_EXT STREQUAL ".h" )
37+ add_custom_command (
38+ OUTPUT ${GPUCA_HIP_SOURCE_DIR} /${HIP_SOURCE}
39+ COMMAND ${hip_HIPIFY_PERL_EXECUTABLE} --quiet -warnings ${ABS_CUDA_SORUCE} | sed -e 's/CUDA/HIP/g' -e 's/cuda/hip/g' > ${GPUCA_HIP_SOURCE_DIR} /${HIP_SOURCE}
40+ DEPENDS ${ABS_CUDA_SORUCE}
41+ COMMENT "Hippifying ${HIP_SOURCE} "
42+ )
43+ else ()
44+ add_custom_command (
45+ OUTPUT ${GPUCA_HIP_SOURCE_DIR} /${HIP_SOURCE}
46+ COMMAND sed -e 's/CUDA/HIP/g' -e 's/cuda/hip/g' ${ABS_CUDA_SORUCE} > ${GPUCA_HIP_SOURCE_DIR} /${HIP_SOURCE}
47+ DEPENDS ${ABS_CUDA_SORUCE}
48+ COMMENT "Generating HIP source ${HIP_SOURCE} "
49+ )
50+ endif ()
4151 list (APPEND HIP_SOURCES "${GPUCA_HIP_SOURCE_DIR} /${HIP_SOURCE} " )
4252 endforeach ()
4353 foreach (file ${GPUCA_HIP_LOCAL_FILE_LIST} )
You can’t perform that action at this time.
0 commit comments