Skip to content

Commit c11e4fd

Browse files
committed
[SYCL][UR] Add CMake logic for PI plugin
Signed-off-by: Lukas Sommer <[email protected]>
1 parent 7885584 commit c11e4fd

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

sycl/plugins/hip/CMakeLists.txt

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,21 @@ if("${SYCL_BUILD_PI_HIP_PLATFORM}" STREQUAL "AMD")
134134
target_link_libraries(pi_hip PUBLIC rocmdrv)
135135

136136
if(SYCL_ENABLE_COMGR)
137+
set(PI_COMGR_VERSION5_HEADER "${PI_HIP_INCLUDE_DIR}/amd_comgr/amd_comgr.h")
138+
set(PI_COMGR_VERSION4_HEADER "${PI_HIP_INCLUDE_DIR}/amd_comgr.h")
139+
# The COMGR header changed location between ROCm version 4 and 5.
140+
# Check for the existence in the version 5 location or fallback to version 4
141+
if(NOT EXISTS "${PI_COMGR_VERSION5_HEADER}")
142+
if(NOT EXISTS "${PI_COMGR_VERSION4_HEADER}")
143+
message(FATAL_ERROR "Could not find AMD COMGR header at "
144+
"${PI_COMGR_VERSION5_HEADER} or "
145+
"${PI_COMGR_VERSION4_HEADER}, "
146+
"check ROCm installation")
147+
else()
148+
target_compile_definitions(pi_hip PRIVATE UR_COMGR_VERSION4_INCLUDE)
149+
endif()
150+
endif()
151+
137152
add_library(amd_comgr SHARED IMPORTED GLOBAL)
138153
set_target_properties(
139154
amd_comgr PROPERTIES

0 commit comments

Comments
 (0)