Skip to content

Commit 3527d42

Browse files
authored
[HIP] Add Kokkos for versions >= 4.2.00 (#214)
It uses whichever CXX/C compiler is passed to the LLVM test suite as CMAKE_CXX_COMPILER or CMAKE_C_COMPILER to compile kokkos. The inclusion of kokkos to build and test is enabled via CMake flag EXTERNAL_HIP_TESTS_KOKKOS=ON. Version tag can be given via EXTERNAL_HIP_TESTS_KOKKOS_TAG to specify the specific tag that the system should use to download, build, and test. If not specified otherwise the version will default to 4.5.01 (currently most recent version available).
1 parent 589a966 commit 3527d42

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

External/HIP/CMakeLists.txt

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
include(ExternalProject)
2+
13
include(External)
24
include(GPUTestVariant)
35
llvm_externals_find(TEST_SUITE_HIP_ROOT "hip" "HIP prerequisites")
@@ -121,6 +123,27 @@ macro(create_hip_tests)
121123
create_hip_test(${_HIP_Suffix})
122124
endforeach()
123125

126+
if (EXTERNAL_HIP_TESTS_KOKKOS)
127+
set(EXTERNAL_HIP_TESTS_KOKKOS_TAG "4.5.01" CACHE STRING "Kokkos tag to download and test")
128+
ExternalProject_Add(TestKokkosHIP
129+
GIT_REPOSITORY https://github.com/kokkos/kokkos.git
130+
GIT_TAG ${EXTERNAL_HIP_TESTS_KOKKOS_TAG}
131+
CMAKE_ARGS -DCMAKE_BUILD_TYPE=Release
132+
-DCMAKE_CXX_STANDARD=17
133+
-DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER}
134+
-DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}
135+
-DKokkos_ENABLE_HIP=ON
136+
-DKokkos_ARCH_AMD_GFX90A=ON
137+
-DCMAKE_PREFIX_PATH=/opt/rocm
138+
-DKokkos_ENABLE_TESTS=ON
139+
INSTALL_COMMAND ""
140+
TEST_COMMAND ""
141+
)
142+
add_custom_target(build-kokkos DEPENDS TestKokkosHIP)
143+
ExternalProject_Get_Property(TestKokkosHIP BINARY_DIR)
144+
add_custom_target(test-kokkos COMMAND "ctest" WORKING_DIRECTORY "${BINARY_DIR}" DEPENDS build-kokkos)
145+
endif()
146+
124147
add_custom_target(hip-tests-all DEPENDS hip-tests-simple
125148
COMMENT "Build all HIP tests.")
126149

0 commit comments

Comments
 (0)