Skip to content

Commit 31d9f04

Browse files
authored
Fix header include path for HIP float16.h (#74461)
1 parent e6f68e7 commit 31d9f04

File tree

2 files changed

+20
-6
lines changed

2 files changed

+20
-6
lines changed

cmake/cinn.cmake

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,21 @@ else()
2626
endif()
2727

2828
if(NOT DEFINED ENV{runtime_include_dir})
29-
message(
30-
STATUS
31-
"set runtime_include_dir: ${CMAKE_SOURCE_DIR}/paddle/cinn/runtime/cuda")
32-
set(ENV{runtime_include_dir} "${CMAKE_SOURCE_DIR}/paddle/cinn/runtime/cuda")
33-
add_definitions(
34-
-DRUNTIME_INCLUDE_DIR="${CMAKE_SOURCE_DIR}/paddle/cinn/runtime/cuda")
29+
if(WITH_GPU)
30+
message(
31+
STATUS
32+
"set runtime_include_dir: ${CMAKE_SOURCE_DIR}/paddle/cinn/runtime/cuda")
33+
set(ENV{runtime_include_dir} "${CMAKE_SOURCE_DIR}/paddle/cinn/runtime/cuda")
34+
add_definitions(
35+
-DRUNTIME_INCLUDE_DIR="${CMAKE_SOURCE_DIR}/paddle/cinn/runtime/cuda")
36+
elseif(WITH_ROCM)
37+
message(
38+
STATUS
39+
"set runtime_include_dir: ${CMAKE_SOURCE_DIR}/paddle/cinn/runtime/hip")
40+
set(ENV{runtime_include_dir} "${CMAKE_SOURCE_DIR}/paddle/cinn/runtime/hip")
41+
add_definitions(
42+
-DRUNTIME_INCLUDE_DIR="${CMAKE_SOURCE_DIR}/paddle/cinn/runtime/hip")
43+
endif()
3544
endif()
3645

3746
if(WITH_TESTING)
@@ -118,6 +127,10 @@ if(WITH_ROCM)
118127
add_definitions(-DCINN_WITH_HIP)
119128
endif()
120129
link_libraries(${ROCM_HIPRTC_LIB})
130+
131+
message(
132+
STATUS "copy paddle/cinn/common/float16.h to $ENV{runtime_include_dir}")
133+
file(COPY paddle/cinn/common/float16.h DESTINATION $ENV{runtime_include_dir})
121134
endif()
122135

123136
set(cinnapi_src CACHE INTERNAL "" FORCE)

python/setup_cinn.py.in

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,7 @@ if '${WITH_GPU}' == 'ON':
156156

157157
if '${WITH_ROCM}' == 'ON':
158158
cinnlibs.append('${CMAKE_BINARY_DIR}/dist/cinn/include/paddle/cinn/runtime/hip/cinn_hip_runtime_source.h')
159+
cinnlibs.append('${CMAKE_BINARY_DIR}/dist/cinn/include/paddle/cinn/runtime/hip/float16.h')
159160

160161
if '${CINN_WITH_SYCL}' == 'ON':
161162
cinnlibs.append('${CMAKE_BINARY_DIR}/dist/cinn/include/paddle/cinn/runtime/sycl/cinn_sycl_runtime_source.h')

0 commit comments

Comments
 (0)