Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion HIP
9 changes: 9 additions & 0 deletions tests/post-install/FindHIPLegacySpirvTarget/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
cmake_minimum_required(VERSION 3.16 FATAL_ERROR)
project(FindHIPLegacySpirvTarget LANGUAGES CXX)
find_package(HIP REQUIRED)
# Force compilation through run_hipcc.cmake (same as SeisSol's Device submodule)
set_source_files_properties(foo.hip PROPERTIES HIP_SOURCE_PROPERTY_FORMAT 1)
# SHARED triggers --shared -Xcompiler '-fPIC' in HIP_NVCC_FLAGS, which clang
# cannot understand when run_hipcc.cmake falls through to the nvcc branch
hip_add_library(foo SHARED foo.hip)
set_property(TARGET foo PROPERTY HIP_ARCHITECTURES OFF)
3 changes: 3 additions & 0 deletions tests/post-install/FindHIPLegacySpirvTarget/foo.hip
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#include <hip/hip_runtime.h>
__global__ void k() {}
int main() { return 0; }
18 changes: 18 additions & 0 deletions tests/post-install/cmake-tests.bash
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,24 @@ make VERBOSE=1
echo "Success"
echo

echo "### Check legacy FindHIP cmake integration on SPIR-V platform (run_hipcc.cmake spirv branch)"
# Regression test: when HIP_PLATFORM=spirv, run_hipcc.cmake must use the clang
# branch, not the nvcc branch. The nvcc branch inserts '--compiler-options -fPIC'
# which clang does not understand, causing compilation to fail.
setup-test-dir
cmake @CMAKE_CURRENT_SOURCE_DIR@/FindHIPLegacySpirvTarget \
-DCMAKE_PREFIX_PATH=@CMAKE_INSTALL_PREFIX@ \
-DCMAKE_MODULE_PATH=@CMAKE_INSTALL_PREFIX@/lib/cmake/hip \
-DCMAKE_CXX_COMPILER=${CXX}
# Build only the compilation step (linking requires hipcc_cmake_linker_helper, tested separately).
# run_hipcc.cmake names the output file foo_generated_foo.hip.o
ninja -v "CMakeFiles/foo.dir/foo_generated_foo.hip.o" 2>&1 | tee build.log
if grep -qF "''-fPIC''" build.log; then
echo "FAIL: NVCC-style quoted -fPIC found — run_hipcc.cmake spirv branch missing"
exit 1
fi
if [ ! -f CMakeFiles/foo.dir/foo_generated_foo.hip.o ]; then
echo "FAIL: foo_generated_foo.hip.o was not produced — compilation failed"
echo "### check CMake-CUDA"
setup-test-dir

Expand Down
Loading