%global upstreamname hip-tests %global rocm_release 6.4 %global rocm_patch 2 %global rocm_version %{rocm_release}.%{rocm_patch} %global toolchain rocm # hipcc does not support some clang flags %global build_cxxflags %(echo %{optflags} | sed -e 's/-fstack-protector-strong/-Xarch_host -fstack-protector-strong/' -e 's/-fcf-protection/-Xarch_host -fcf-protection/' -e 's/-mtls-dialect=gnu2//' -e 's/flto=thin//' ) # What gpu's we are testing %global gpu_offload_list "--offload-arch=gfx1100 --offload-arch=gfx1101 --offload-arch=gfx1102 --offload-arch=gfx1151 --offload-arch=gfx1200 --offload-arch=gfx1201" # Option to test suite for testing on real HW: # May have to set gpu under test with # export HIP_VISIBLE_DEVICES= - 0, 1 etc. %bcond_with check %bcond_with debug %if %{with debug} %global build_type DEBUG %else %global build_type RelWithDebInfo %endif # Some lto issues # ld.lld: error: undefined hidden symbol: __hip_gpubin_handle_8e42c98bcbd90dcf # >>> referenced by memoryCommon.cc # >>> /tmp/InlineVarTest.lto.memoryCommon-13d8cd.o:(__hip_module_ctor) # Also had to step on the cxx flags in the cmake step. %global _lto_cflags %{nil} Name: hip-tests Version: %{rocm_version} Release: 1%{?dist} Summary: HIP tests License: MIT URL: https://github.com/ROCm/%{upstreamname} Source0: %{url}/archive/rocm-%{version}.tar.gz#/%{upstreamname}-%{rocm_version}.tar.gz Patch1: 0001-hip-tests-build-on-fedora.patch ExclusiveArch: x86_64 BuildRequires: boost-devel BuildRequires: cmake BuildRequires: fdupes BuildRequires: freeglut-devel BuildRequires: gcc-c++ BuildRequires: make BuildRequires: pkgconfig(opengl) BuildRequires: rocm-comgr-devel BuildRequires: rocm-compilersupport-macros BuildRequires: rocm-hip-devel BuildRequires: rocm-rpm-macros BuildRequires: rocm-runtime-devel >= %{rocm_release}.0 %if %{with check} BuildRequires: rocminfo %endif Requires: cmake Requires: rocminfo %description This repository provides unit tests for HIP implementation. %prep %autosetup -n %{name}-rocm-%{version} -p1 # Change path to clang-cpp sed -i -e 's@${ROCM_PATH}/llvm/bin/clang-cpp@%{rocmllvm_bindir}/clang-cpp@' catch/CMakeLists.txt # Change install to libexec sed -i -e 's@INSTALL_DIR ${CMAKE_INSTALL_DATADIR}/hip@INSTALL_DIR libexec/hip-tests@' catch/packaging/CMakeLists.txt %build cd catch %cmake \ -DCMAKE_BUILD_TYPE=%{build_type} \ -DCMAKE_C_COMPILER=%{rocmllvm_bindir}/clang \ -DCMAKE_CXX_COMPILER=%{rocmllvm_bindir}/clang++ \ -DCMAKE_CXX_FLAGS="-O2" \ -DCMAKE_AR=%{rocmllvm_bindir}/llvm-ar \ -DCMAKE_RANLIB=%{rocmllvm_bindir}/llvm-ranlib \ -DHIP_PLATFORM=amd \ -DOFFLOAD_ARCH_STR=%{gpu_offload_list} \ -DROCM_PATH=%{_prefix} %cmake_build -t build_tests # Need to be run locally with rpmbuild on a system with one of the GPU's # in the gpu_offload_list. # %if %{with check} %check cd catch %ctest --output-on-failure %endif %install cd catch %cmake_install # rpmlint will have several issues with # hip-tests.x86_64: W: unused-direct-shlib-dependency /usr/libexec/hip-tests/catch_tests/libLazyLoad.so /lib64/libgcc_s.so.1 # hip-tests.x86_64: W: unstripped-binary-or-object /usr/libexec/hip-tests/catch_tests/libLazyLoad.so # libLazyLoad.so is only used by a dlopen as part of a unit test # From unit/dynamicLoading/complex_loading_behavior.cc # static bool launch_dynamically_loaded_kernel() { # bool testResult = true; # int ret = 1; # # void* handle = dlopen("./libLazyLoad.so", RTLD_LAZY); # Remove devel things rm -rf %{buildroot}%{_libexecdir}/hip-tests/catch_tests/headers rm -rf %{buildroot}%{_libexecdir}/hip-tests/catch_tests/saxpy.h # Clean up dupes: %fdupes %{buildroot}%{_prefix} %files %doc README.md %license LICENSE.txt %{_libexecdir}/hip-tests/ %changelog * Fri Aug 1 2025 Tom Rix - 6.4.2-1 - Initial package