diff --git a/cmake/hip/CMakeDetermineHIPCompiler.cmake b/cmake/hip/CMakeDetermineHIPCompiler.cmake deleted file mode 100644 index d74b0ae1..00000000 --- a/cmake/hip/CMakeDetermineHIPCompiler.cmake +++ /dev/null @@ -1,105 +0,0 @@ -# VecMem project, part of the ACTS project (R&D line) -# -# (c) 2021-2023 CERN for the benefit of the ACTS project -# -# Mozilla Public License Version 2.0 - -# The HIP language code only works with the Ninja, and the different kinds -# of Makefile generators. -if( NOT ( ( "${CMAKE_GENERATOR}" MATCHES "Make" ) OR - ( "${CMAKE_GENERATOR}" MATCHES "Ninja" ) ) ) - message( FATAL_ERROR "HIP language not currently supported by " - "\"${CMAKE_GENERATOR}\" generator" ) -endif() - -# Use the HIPCXX environment variable preferably as the HIP compiler. -if( NOT "$ENV{HIPCXX}" STREQUAL "" ) - # Interpret the contents of HIPCXX. - get_filename_component( CMAKE_HIP_COMPILER_INIT "$ENV{HIPCXX}" - PROGRAM PROGRAM_ARGS CMAKE_HIP_FLAGS_ENV_INIT ) - if( NOT EXISTS ${CMAKE_HIP_COMPILER_INIT} ) - message( FATAL_ERROR - "Could not find compiler set in environment variable HIPCXX:\n$ENV{HIPCXX}.\n${CMAKE_HIP_COMPILER_INIT}") - endif() -else() - # Find the HIP compiler. - find_program( CMAKE_HIP_COMPILER_INIT NAMES "hipcc" - PATHS "${HIP_ROOT_DIR}" - ENV ROCM_PATH - ENV HIP_PATH - "/opt/rocm" - "/opt/rocm/hip" - PATH_SUFFIXES "bin" ) - set( CMAKE_HIP_FLAGS_ENV_INIT "" ) -endif() -if( CMAKE_HIP_COMPILER_INIT ) - # Determine the type and version of the SYCL compiler. - execute_process( COMMAND "${CMAKE_HIP_COMPILER_INIT}" "--version" - OUTPUT_VARIABLE _hipVersionOutput - ERROR_VARIABLE _hipVersionError - RESULT_VARIABLE _hipVersionResult ) - if( ${_hipVersionResult} EQUAL 0 ) - if( "${_hipVersionOutput}" MATCHES "HIP version:" ) - set( CMAKE_HIP_COMPILER_ID "AMD" CACHE STRING - "Identifier for the HIP compiler in use" ) - set( _hipVersionRegex "HIP version: ([0-9\.]+)" ) - else() - set( CMAKE_HIP_COMPILER_ID "Unknown" CACHE STRING - "Identifier for the HIP compiler in use" ) - set( _hipVersionRegex "[a-zA-Z]+ version ([0-9\.]+)" ) - endif() - string( REPLACE "\n" ";" _hipVersionOutputList "${_hipVersionOutput}" ) - foreach( _line ${_hipVersionOutputList} ) - if( _line MATCHES "${_hipVersionRegex}" ) - set( CMAKE_HIP_COMPILER_VERSION "${CMAKE_MATCH_1}" ) - break() - endif() - endforeach() - unset( _hipVersionOutputList ) - unset( _hipVersionRegex ) - else() - message( WARNING - "Failed to execute: ${CMAKE_HIP_COMPILER_INIT} --version" ) - set( CMAKE_HIP_COMPILER_VERSION "Unknown" ) - endif() - unset( _hipVersionOutput ) - unset( _hipVersionResult ) -endif() - -# Set up the compiler as a cache variable. -set( CMAKE_HIP_COMPILER "${CMAKE_HIP_COMPILER_INIT}" CACHE FILEPATH - "The HIP compiler to use" ) - -# Tell the user what was found for the HIP compiler. -message( STATUS "The HIP compiler identification is " - "${CMAKE_HIP_COMPILER_ID} ${CMAKE_HIP_COMPILER_VERSION}" ) - -# Set up what source/object file names to use. -set( CMAKE_HIP_SOURCE_FILE_EXTENSIONS "hip" ) -set( CMAKE_HIP_OUTPUT_EXTENSION ".o" ) -set( CMAKE_HIP_COMPILER_ENV_VAR "HIPCXX" ) - -# Set up the linker used for components holding HIP source code. -set( CMAKE_HIP_HOST_LINKER "${CMAKE_CXX_COMPILER}" ) - -# Decide whether to generate AMD or NVidia code using HIP. -set( CMAKE_HIP_PLATFORM_DEFAULT "amd" ) -if( NOT "$ENV{HIP_PLATFORM}" STREQUAL "" ) - set( CMAKE_HIP_PLATFORM_DEFAULT "$ENV{HIP_PLATFORM}" ) -endif() -set( CMAKE_HIP_PLATFORM "${CMAKE_HIP_PLATFORM_DEFAULT}" CACHE STRING - "Platform to build all HIP code for in the project" ) -set_property( CACHE CMAKE_HIP_PLATFORM - PROPERTY STRINGS "hcc" "nvcc" "amd" "nvidia" ) - -# Set up C++14 by default for HIP. -set( CMAKE_HIP_STANDARD 14 CACHE STRING "C++ standard to use with HIP" ) -set_property( CACHE CMAKE_HIP_STANDARD PROPERTY STRINGS 11 14 17 20 23 ) - -# Look for the HIP toolkit. Its variables are needed for setting up the build -# of HIP source files. -find_package( HIPToolkit REQUIRED QUIET ) - -# Configure variables set in this file for fast reload later on. -configure_file( ${CMAKE_CURRENT_LIST_DIR}/CMakeHIPCompiler.cmake.in - ${CMAKE_PLATFORM_INFO_DIR}/CMakeHIPCompiler.cmake ) diff --git a/cmake/hip/CMakeHIPCompiler.cmake.in b/cmake/hip/CMakeHIPCompiler.cmake.in deleted file mode 100644 index f6aa3a0a..00000000 --- a/cmake/hip/CMakeHIPCompiler.cmake.in +++ /dev/null @@ -1,22 +0,0 @@ -# VecMem project, part of the ACTS project (R&D line) -# -# (c) 2021-2023 CERN for the benefit of the ACTS project -# -# Mozilla Public License Version 2.0 - -# Store all variables determined in CMakeDetermineHIPCompiler.cmake. -set( CMAKE_HIP_COMPILER "@CMAKE_HIP_COMPILER@" ) -set( CMAKE_HIP_COMPILER_ID "@CMAKE_HIP_COMPILER_ID@" ) -set( CMAKE_HIP_COMPILER_VERSION "@CMAKE_HIP_COMPILER_VERSION@" ) -set( CMAKE_HIP_SOURCE_FILE_EXTENSIONS @CMAKE_HIP_SOURCE_FILE_EXTENSIONS@ ) -set( CMAKE_HIP_OUTPUT_EXTENSION "@CMAKE_HIP_OUTPUT_EXTENSION@" ) -set( CMAKE_HIP_COMPILER_ENV_VAR "@CMAKE_HIP_COMPILER_ENV_VAR@" ) -set( CMAKE_HIP_HOST_LINKER "@CMAKE_HIP_HOST_LINKER@" ) -set( CMAKE_HIP_PLATFORM "@CMAKE_HIP_PLATFORM@" ) -set( HIPToolkit_INCLUDE_DIRS "@HIPToolkit_INCLUDE_DIRS@" ) -set( CUDAToolkit_INCLUDE_DIRS "@CUDAToolkit_INCLUDE_DIRS@" ) -set( HIPToolkit_RUNTIME_LIBRARY "@HIPToolkit_RUNTIME_LIBRARY@" ) -set( CMAKE_HIP_ARCHITECTURES FALSE ) - -# Mark the HIP compiler as "loaded". -set( CMAKE_HIP_COMPILER_LOADED TRUE ) diff --git a/cmake/hip/CMakeHIPInformation.cmake b/cmake/hip/CMakeHIPInformation.cmake deleted file mode 100644 index 9e48c860..00000000 --- a/cmake/hip/CMakeHIPInformation.cmake +++ /dev/null @@ -1,139 +0,0 @@ -# VecMem project, part of the ACTS project (R&D line) -# -# (c) 2021-2023 CERN for the benefit of the ACTS project -# -# Mozilla Public License Version 2.0 - -# Common CMake include(s). -include( CMakeCommonLanguageInclude ) - -# Set up platform specific flags. -include( Platform/${CMAKE_EFFECTIVE_SYSTEM_NAME}-${CMAKE_HIP_COMPILER_ID}-HIP - OPTIONAL ) - -# Set up how HIP object file compilation should go. -if( NOT DEFINED CMAKE_HIP_COMPILE_OBJECT ) - set( CMAKE_HIP_COMPILE_OBJECT - " -o -c " ) -endif() - -# Set up how shared library building should go. -if( NOT DEFINED CMAKE_SHARED_LIBRARY_CREATE_HIP_FLAGS ) - set( CMAKE_SHARED_LIBRARY_CREATE_HIP_FLAGS - "${CMAKE_SHARED_LIBRARY_CREATE_CXX_FLAGS}" ) -endif() -if( NOT DEFINED CMAKE_SHARED_LIBRARY_HIP_FLAGS ) - set( CMAKE_SHARED_LIBRARY_HIP_FLAGS - "${CMAKE_SHARED_LIBRARY_CXX_FLAGS}" ) -endif() -if( NOT DEFINED CMAKE_SHARED_LIBRARY_LINK_HIP_FLAGS ) - set( CMAKE_SHARED_LIBRARY_LINK_HIP_FLAGS - "${CMAKE_SHARED_LIBRARY_LINK_CXX_FLAGS}" ) -endif() -if( NOT DEFINED CMAKE_SHARED_LIBRARY_RUNTIME_HIP_FLAG ) - set( CMAKE_SHARED_LIBRARY_RUNTIME_HIP_FLAG - "${CMAKE_SHARED_LIBRARY_RUNTIME_CXX_FLAG}" ) -endif() -if( NOT DEFINED CMAKE_SHARED_LIBRARY_RUNTIME_HIP_FLAG_SEP ) - set( CMAKE_SHARED_LIBRARY_RUNTIME_HIP_FLAG_SEP - "${CMAKE_SHARED_LIBRARY_RUNTIME_CXX_FLAG_SEP}" ) -endif() -if( NOT DEFINED CMAKE_SHARED_LIBRARY_RPATH_LINK_HIP_FLAG ) - set( CMAKE_SHARED_LIBRARY_RPATH_LINK_HIP_FLAG - "${CMAKE_SHARED_LIBRARY_RPATH_LINK_CXX_FLAG}" ) -endif() -if( NOT DEFINED CMAKE_SHARED_LIBRARY_EXPORTS_HIP_FLAG ) - set( CMAKE_SHARED_LIBRARY_EXPORTS_HIP_FLAG - "${CMAKE_SHARED_LIBRARY_EXPORTS_CXX_FLAG}" ) -endif() -if( NOT DEFINED CMAKE_SHARED_LIBRARY_SONAME_HIP_FLAG ) - set( CMAKE_SHARED_LIBRARY_SONAME_HIP_FLAG - "${CMAKE_SHARED_LIBRARY_SONAME_CXX_FLAG}" ) -endif() -if( NOT DEFINED CMAKE_HIP_CREATE_SHARED_LIBRARY ) - set( CMAKE_HIP_CREATE_SHARED_LIBRARY - "\"${CMAKE_HIP_HOST_LINKER}\" -o " ) -endif() - -# Set up how module library building should go. -if( NOT DEFINED CMAKE_SHARED_MODULE_CREATE_HIP_FLAGS ) - set( CMAKE_SHARED_MODULE_CREATE_HIP_FLAGS - "${CMAKE_SHARED_MODULE_CREATE_CXX_FLAGS}" ) -endif() -if( NOT DEFINED CMAKE_SHARED_MODULE_HIP_FLAGS ) - set( CMAKE_SHARED_MODULE_HIP_FLAGS - "${CMAKE_SHARED_MODULE_CXX_FLAGS}" ) -endif() -if( NOT DEFINED CMAKE_SHARED_MODULE_LINK_HIP_FLAGS ) - set( CMAKE_SHARED_MODULE_LINK_HIP_FLAGS - "${CMAKE_SHARED_MODULE_LINK_CXX_FLAGS}" ) -endif() -if( NOT DEFINED CMAKE_SHARED_MODULE_RUNTIME_HIP_FLAG ) - set( CMAKE_SHARED_MODULE_RUNTIME_HIP_FLAG - "${CMAKE_SHARED_MODULE_RUNTIME_CXX_FLAG}" ) -endif() -if( NOT DEFINED CMAKE_SHARED_MODULE_RUNTIME_HIP_FLAG_SEP ) - set( CMAKE_SHARED_MODULE_RUNTIME_HIP_FLAG_SEP - "${CMAKE_SHARED_MODULE_RUNTIME_CXX_FLAG_SEP}" ) -endif() -if( NOT DEFINED CMAKE_SHARED_MODULE_RPATH_LINK_HIP_FLAG ) - set( CMAKE_SHARED_MODULE_RPATH_LINK_HIP_FLAG - "${CMAKE_SHARED_MODULE_RPATH_LINK_CXX_FLAG}" ) -endif() -if( NOT DEFINED CMAKE_SHARED_MODULE_EXPORTS_HIP_FLAG ) - set( CMAKE_SHARED_MODULE_EXPORTS_HIP_FLAG - "${CMAKE_SHARED_MODULE_EXPORTS_CXX_FLAG}" ) -endif() -if( NOT DEFINED CMAKE_SHARED_MODULE_SONAME_HIP_FLAG ) - set( CMAKE_SHARED_MODULE_SONAME_HIP_FLAG - "${CMAKE_SHARED_MODULE_SONAME_CXX_FLAG}" ) -endif() -if( NOT DEFINED CMAKE_HIP_CREATE_SHARED_MODULE ) - set( CMAKE_HIP_CREATE_SHARED_MODULE - "\"${CMAKE_HIP_HOST_LINKER}\" -o " ) -endif() - -# Set up how static library building should go. -if( NOT DEFINED CMAKE_HIP_CREATE_STATIC_LIBRARY ) - set( CMAKE_HIP_CREATE_STATIC_LIBRARY "${CMAKE_CXX_CREATE_STATIC_LIBRARY}" ) -endif() - -# Set up how executable building should go. -if( NOT DEFINED CMAKE_HIP_LINK_FLAGS ) - set( CMAKE_HIP_LINK_FLAGS - "${CMAKE_CXX_LINK_FLAGS}" ) -endif() -if( NOT DEFINED CMAKE_EXECUTABLE_RUNTIME_HIP_FLAG ) - set( CMAKE_EXECUTABLE_RUNTIME_HIP_FLAG - "${CMAKE_EXECUTABLE_RUNTIME_CXX_FLAG}" ) -endif() -if( NOT DEFINED CMAKE_EXECUTABLE_RUNTIME_HIP_FLAG_SEP ) - set( CMAKE_EXECUTABLE_RUNTIME_HIP_FLAG_SEP - "${CMAKE_EXECUTABLE_RUNTIME_CXX_FLAG_SEP}" ) -endif() -if( NOT DEFINED CMAKE_EXECUTABLE_RPATH_LINK_HIP_FLAG ) - set( CMAKE_EXECUTABLE_RPATH_LINK_HIP_FLAG - "${CMAKE_EXECUTABLE_RPATH_LINK_CXX_FLAG}" ) -endif() -if( NOT DEFINED CMAKE_HIP_LINK_EXECUTABLE ) - set( CMAKE_HIP_LINK_EXECUTABLE - "\"${CMAKE_HIP_HOST_LINKER}\" -o " ) -endif() - -# Set the include flag(s). -if( NOT DEFINED CMAKE_INCLUDE_FLAG_HIP ) - set( CMAKE_INCLUDE_FLAG_HIP "${CMAKE_INCLUDE_FLAG_CXX}" ) -endif() -if( NOT DEFINED CMAKE_INCLUDE_SYSTEM_FLAG_HIP ) - set( CMAKE_INCLUDE_SYSTEM_FLAG_HIP "${CMAKE_INCLUDE_SYSTEM_FLAG_CXX}" ) -endif() - -# Set up the flags for the HIP build. -set( CMAKE_HIP_FLAGS_INIT "${CMAKE_HIP_FLAGS_INIT} $ENV{HIPFLAGS}" ) -cmake_initialize_per_config_variable( CMAKE_HIP_FLAGS - "Flags used by the HIP compiler" ) -set( CMAKE_HIP_FLAGS - "${CMAKE_HIP_FLAGS} ${CMAKE_HIP${CMAKE_HIP_STANDARD}_STANDARD_COMPILE_OPTION}" ) - -# Tell CMake that the information was loaded. -set( CMAKE_HIP_INFORMATION_LOADED TRUE ) diff --git a/cmake/hip/CMakeTestHIPCompiler.cmake b/cmake/hip/CMakeTestHIPCompiler.cmake deleted file mode 100644 index f0da57f2..00000000 --- a/cmake/hip/CMakeTestHIPCompiler.cmake +++ /dev/null @@ -1,48 +0,0 @@ -# VecMem project, part of the ACTS project (R&D line) -# -# (c) 2021 CERN for the benefit of the ACTS project -# -# Mozilla Public License Version 2.0 - -# CMake include(s). -include( CMakeTestCompilerCommon ) - -# Start with the correct status message. -if( ${CMAKE_VERSION} VERSION_LESS 3.17 ) - PrintTestCompilerStatus( "HIP" "" ) -else() - PrintTestCompilerStatus( "HIP" ) -endif() - -# Try to use the HIP compiler. -file( WRITE - "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/main.hip" - "#include \n" - "int main() { return 0; }\n" ) -try_compile( CMAKE_HIP_COMPILER_WORKS "${CMAKE_BINARY_DIR}" - "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/main.hip" - OUTPUT_VARIABLE __CMAKE_HIP_COMPILER_OUTPUT ) - -# Move the results of the test into a regular variable. -set( CMAKE_HIP_COMPILER_WORKS ${CMAKE_HIP_COMPILER_WORKS} ) -unset( CMAKE_HIP_COMPILER_WORKS CACHE ) - -# Check the results of the test. -if( NOT CMAKE_HIP_COMPILER_WORKS ) - if( ${CMAKE_VERSION} VERSION_LESS 3.17 ) - PrintTestCompilerStatus( "HIP" " -- broken" ) - else() - PrintTestCompilerResult( CHECK_FAIL "broken" ) - endif() - message( FATAL_ERROR "The HIP compiler\n" - " \"${CMAKE_HIP_COMPILER}\"\n" - "is not able to compile a simple test program.\n" - "It fails with the following output:\n" - " ${__CMAKE_HIP_COMPILER_OUTPUT}\n\n" - "CMake will not be able to correctly generate this project." ) -endif() -if( ${CMAKE_VERSION} VERSION_LESS 3.17 ) - PrintTestCompilerStatus( "HIP" " -- works" ) -else() - PrintTestCompilerResult( CHECK_PASS "works" ) -endif() diff --git a/cmake/hip/Platform/Linux-AMD-HIP.cmake b/cmake/hip/Platform/Linux-AMD-HIP.cmake deleted file mode 100644 index 7ac21e40..00000000 --- a/cmake/hip/Platform/Linux-AMD-HIP.cmake +++ /dev/null @@ -1,77 +0,0 @@ -# VecMem project, part of the ACTS project (R&D line) -# -# (c) 2023 CERN for the benefit of the ACTS project -# -# Mozilla Public License Version 2.0 - -# Use the standard GNU compiler options for AMD's HIP. -include( Platform/Linux-GNU ) -__linux_compiler_gnu( HIP ) -include( Compiler/GNU ) -__compiler_gnu( HIP ) - -# Set up the dependency file generation for this platform. Note that HIP -# compilation only works with Makefile and Ninja generators, so no check is made -# here for the current generator. -set( CMAKE_HIP_DEPENDS_USE_COMPILER TRUE ) -set( CMAKE_HIP_DEPFILE_FORMAT gcc ) - -# Decide how to do the build for the AMD (hcc) and NVidia (nvcc) backends. -set( CMAKE_INCLUDE_FLAG_HIP "-I" ) -set( CMAKE_INCLUDE_SYSTEM_FLAG_HIP "-isystem " ) -set( CMAKE_HIP_STANDARD_LIBRARIES "${HIPToolkit_RUNTIME_LIBRARY}" ) -if( ( "${CMAKE_HIP_PLATFORM}" STREQUAL "hcc" ) OR - ( "${CMAKE_HIP_PLATFORM}" STREQUAL "amd" ) ) - - if( "${CMAKE_HIP_COMPILER_VERSION}" VERSION_LESS "3.7" ) - set( CMAKE_HIP_COMPILE_SOURCE_TYPE_FLAG "-x c++" ) - else() - set( CMAKE_HIP_COMPILE_SOURCE_TYPE_FLAG "" ) - endif() - set( CMAKE_HIP_STANDARD_INCLUDE_DIRECTORIES ${HIPToolkit_INCLUDE_DIRS} ) - -elseif( ( "${CMAKE_HIP_PLATFORM}" STREQUAL "nvcc" ) OR - ( "${CMAKE_HIP_PLATFORM}" STREQUAL "nvidia" ) ) - - include( Compiler/NVIDIA-CUDA ) - - set( CMAKE_HIP_COMPILE_SOURCE_TYPE_FLAG "-x cu" ) - set( CMAKE_HIP_STANDARD_INCLUDE_DIRECTORIES ${HIPToolkit_INCLUDE_DIRS} - ${CUDAToolkit_INCLUDE_DIRS} ) - set( CMAKE_HIP_COMPILE_OPTIONS_PIC "${CMAKE_CUDA_COMPILE_OPTIONS_PIC}" ) - set( CMAKE_HIP_COMPILE_OPTIONS_PIE "${CMAKE_CUDA_COMPILE_OPTIONS_PIE}" ) - set( CMAKE_HIP_COMPILE_OPTIONS_VISIBILITY - "${CMAKE_CUDA_COMPILE_OPTIONS_VISIBILITY}" ) - set( CMAKE_HIP_FLAGS_DEBUG_INIT "${CMAKE_CUDA_FLAGS_DEBUG_INIT}" ) - set( CMAKE_HIP_FLAGS_RELEASE_INIT "${CMAKE_CUDA_FLAGS_RELEASE_INIT}" ) - set( CMAKE_HIP_FLAGS_RELWITHDEBINFO_INIT - "${CMAKE_CUDA_FLAGS_RELWITHDEBINFO_INIT}" ) - -else() - message( FATAL_ERROR - "Invalid setting for CMAKE_HIP_PLATFORM (\"${CMAKE_HIP_PLATFORM}\").\n" ) -endif() - -# Set a compiler command from scratch for this platform. -set( CMAKE_HIP_COMPILE_OBJECT - "HIP_PLATFORM=${CMAKE_HIP_PLATFORM} ${CMAKE_HIP_COMPILE_SOURCE_TYPE_FLAG} -o -c " ) - -# Set the archive (static library) creation command explicitly for this platform. -set( CMAKE_HIP_CREATE_STATIC_LIBRARY - " qc " ) - -# Set the flags controlling the C++ standard used by the HIP compiler. -set( CMAKE_HIP11_STANDARD_COMPILE_OPTION "-std=c++11" ) -set( CMAKE_HIP11_EXTENSION_COMPILE_OPTION "-std=c++11" ) - -set( CMAKE_HIP14_STANDARD_COMPILE_OPTION "-std=c++14" ) -set( CMAKE_HIP14_EXTENSION_COMPILE_OPTION "-std=c++14" ) - -set( CMAKE_HIP17_STANDARD_COMPILE_OPTION "-std=c++17" ) -set( CMAKE_HIP17_EXTENSION_COMPILE_OPTION "-std=c++17" ) - -set( CMAKE_HIP20_STANDARD_COMPILE_OPTION "-std=c++20" ) -set( CMAKE_HIP20_EXTENSION_COMPILE_OPTION "-std=c++20" ) - -set( CMAKE_HIP23_STANDARD_COMPILE_OPTION "-std=c++23" ) -set( CMAKE_HIP23_EXTENSION_COMPILE_OPTION "-std=c++23" ) diff --git a/cmake/vecmem-check-language.cmake b/cmake/vecmem-check-language.cmake index 982c51d3..6705a193 100644 --- a/cmake/vecmem-check-language.cmake +++ b/cmake/vecmem-check-language.cmake @@ -1,6 +1,6 @@ # VecMem project, part of the ACTS project (R&D line) # -# (c) 2021-2024 CERN for the benefit of the ACTS project +# (c) 2021-2026 CERN for the benefit of the ACTS project # # Mozilla Public License Version 2.0 @@ -15,7 +15,6 @@ mark_as_advanced( VECMEM_LANGUAGE_DIR ) # Teach CMake about VecMem's custom language files. list( INSERT CMAKE_MODULE_PATH 0 "${VECMEM_LANGUAGE_DIR}" - "${VECMEM_LANGUAGE_DIR}/hip" "${VECMEM_LANGUAGE_DIR}/sycl" ) # Code mimicking CMake's CheckLanguage.cmake module. But making sure that the @@ -26,9 +25,8 @@ macro( vecmem_check_language lang ) # don't look for it again. Also ignore anything but the HIP "language". if( NOT DEFINED CMAKE_${lang}_COMPILER ) - # Handle the HIP and SYCL cases. - if( ( "${lang}" STREQUAL "HIP" ) OR - ( "${lang}" STREQUAL "SYCL" ) ) + # Handle the SYCL case. + if( "${lang}" STREQUAL "SYCL" ) # Greet the user. set( _desc "Looking for a ${lang} compiler" ) diff --git a/cmake/vecmem-compiler-options-hip.cmake b/cmake/vecmem-compiler-options-hip.cmake index 811b2057..5d552f50 100644 --- a/cmake/vecmem-compiler-options-hip.cmake +++ b/cmake/vecmem-compiler-options-hip.cmake @@ -1,6 +1,6 @@ # VecMem project, part of the ACTS project (R&D line) # -# (c) 2021-2023 CERN for the benefit of the ACTS project +# (c) 2021-2026 CERN for the benefit of the ACTS project # # Mozilla Public License Version 2.0 @@ -11,8 +11,7 @@ include( vecmem-functions ) set( CMAKE_HIP_STANDARD 14 CACHE STRING "The (HIP) C++ standard to use" ) # Basic flags for all build modes. -if( ( "${CMAKE_HIP_PLATFORM}" STREQUAL "hcc" ) OR - ( "${CMAKE_HIP_PLATFORM}" STREQUAL "amd" ) ) +if( "${CMAKE_HIP_PLATFORM}" STREQUAL "amd" ) vecmem_add_flag( CMAKE_HIP_FLAGS "-Wall" ) vecmem_add_flag( CMAKE_HIP_FLAGS "-Wextra" ) vecmem_add_flag( CMAKE_HIP_FLAGS "-Wshadow" ) @@ -21,18 +20,15 @@ if( ( "${CMAKE_HIP_PLATFORM}" STREQUAL "hcc" ) OR endif() # Generate debug symbols for the device code as well in a debug build. -if( ( "${CMAKE_HIP_PLATFORM}" STREQUAL "nvcc" ) OR - ( "${CMAKE_HIP_PLATFORM}" STREQUAL "nvidia" ) ) +if( "${CMAKE_HIP_PLATFORM}" STREQUAL "nvidia" ) vecmem_add_flag( CMAKE_HIP_FLAGS_DEBUG "-G" ) endif() # Fail on warnings, if asked for that behaviour. if( VECMEM_FAIL_ON_WARNINGS ) - if( ( "${CMAKE_HIP_PLATFORM}" STREQUAL "hcc" ) OR - ( "${CMAKE_HIP_PLATFORM}" STREQUAL "amd" ) ) + if( "${CMAKE_HIP_PLATFORM}" STREQUAL "amd" ) vecmem_add_flag( CMAKE_HIP_FLAGS "-Werror" ) - elseif( ( "${CMAKE_HIP_PLATFORM}" STREQUAL "nvcc" ) OR - ( "${CMAKE_HIP_PLATFORM}" STREQUAL "nvidia" ) ) + elseif( "${CMAKE_HIP_PLATFORM}" STREQUAL "nvidia" ) vecmem_add_flag( CMAKE_HIP_FLAGS "-Werror all-warnings" ) endif() endif() diff --git a/cmake/vecmem-config.cmake.in b/cmake/vecmem-config.cmake.in index d9001f57..6e9160b6 100644 --- a/cmake/vecmem-config.cmake.in +++ b/cmake/vecmem-config.cmake.in @@ -21,7 +21,6 @@ include( "${vecmem_CMAKE_DIR}/vecmem-config-targets.cmake" ) # Add the project's CMake directories to CMAKE_MODULE_PATH. list( APPEND CMAKE_MODULE_PATH "${vecmem_CMAKE_DIR}" - "${vecmem_CMAKE_DIR}/hip" "${vecmem_CMAKE_DIR}/sycl" ) # Set up additional variables, based on the imported targets. These are mostly diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 9651c1ef..5f9f8696 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -1,6 +1,6 @@ # VecMem project, part of the ACTS project (R&D line) # -# (c) 2021-2024 CERN for the benefit of the ACTS project +# (c) 2021-2026 CERN for the benefit of the ACTS project # # Mozilla Public License Version 2.0 @@ -48,7 +48,8 @@ add_library( vecmem_testing_common STATIC target_link_libraries( vecmem_testing_common PUBLIC vecmem::core GTest::gtest ) set_target_properties( vecmem_testing_common PROPERTIES - FOLDER "vecmem/tests" ) + FOLDER "vecmem/tests" + POSITION_INDEPENDENT_CODE TRUE ) # Include the library specific tests. add_subdirectory( core ) diff --git a/tests/hip/CMakeLists.txt b/tests/hip/CMakeLists.txt index e408ef55..6ee4eb8b 100644 --- a/tests/hip/CMakeLists.txt +++ b/tests/hip/CMakeLists.txt @@ -1,9 +1,12 @@ # VecMem project, part of the ACTS project (R&D line) # -# (c) 2021-2024 CERN for the benefit of the ACTS project +# (c) 2021-2026 CERN for the benefit of the ACTS project # # Mozilla Public License Version 2.0 +# CMake's built-in HIP support requires at lease version 3.21. +cmake_minimum_required( VERSION 3.21 ) + # Enable HIP as a language. enable_language( HIP ) @@ -30,7 +33,9 @@ vecmem_add_test( hip # Add UBSAN for the tests, if it's available. include( CheckCXXCompilerFlag ) check_cxx_compiler_flag( "-fsanitize=undefined" VECMEM_HAVE_UBSAN ) -if( VECMEM_HAVE_UBSAN AND VECMEM_TEST_UBSAN ) +include( CheckLinkerFlag ) +check_linker_flag( HIP "-fsanitize=undefined" VECMEM_HAVE_HIP_UBSAN ) +if( VECMEM_HAVE_UBSAN AND VECMEM_TEST_UBSAN AND VECMEM_HAVE_HIP_UBSAN ) target_compile_options( vecmem_test_hip PRIVATE $<$:-fsanitize=undefined> ) target_link_options( vecmem_test_hip PRIVATE "-fsanitize=undefined" )