From f50f30f4e3e1d1d36c9948875eb55183e378c935 Mon Sep 17 00:00:00 2001 From: Lauren Wrubleski Date: Thu, 13 Mar 2025 15:03:32 -0600 Subject: [PATCH 1/7] Add rocm-core dependency to all generated packages, not just the root one. (#257) --- share/rocmcmakebuildtools/cmake/ROCMCreatePackage.cmake | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/share/rocmcmakebuildtools/cmake/ROCMCreatePackage.cmake b/share/rocmcmakebuildtools/cmake/ROCMCreatePackage.cmake index 8e176031..d3fc9d52 100755 --- a/share/rocmcmakebuildtools/cmake/ROCMCreatePackage.cmake +++ b/share/rocmcmakebuildtools/cmake/ROCMCreatePackage.cmake @@ -139,6 +139,11 @@ macro(rocm_package_add_rocm_core_dependency) endif() rocm_join_if_set(", " CPACK_DEBIAN_PACKAGE_DEPENDS ${_rocm_core_pkg}) rocm_join_if_set(", " CPACK_RPM_PACKAGE_REQUIRES ${_rocm_core_pkg}) + foreach(COMPONENT IN LISTS ROCM_PACKAGE_COMPONENTS) + rocm_package_add_dependencies(COMPONENT ${COMPONENT} DEPENDS ${_rocm_core_pkg}) + endforeach() + rocm_package_add_dependencies(COMPONENT runtime DEPENDS ${_rocm_core_pkg}) + rocm_package_add_dependencies(COMPONENT devel DEPENDS ${_rocm_core_pkg}) unset(_rocm_core_pkg) endif() endmacro() From 32bc14114aa4b95a8b8d467bc780884d771318c7 Mon Sep 17 00:00:00 2001 From: Lauren Wrubleski Date: Fri, 14 Mar 2025 13:22:18 -0600 Subject: [PATCH 2/7] Fix handling of generic targets * Fix handling of hyphens in base target ID * Fixup and comment _rocm_sanitize_target_id * Handle empty target feature list --------- Co-authored-by: Cordell Bloor --- .../cmake/ROCMCheckTargetIds.cmake | 23 ++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/share/rocmcmakebuildtools/cmake/ROCMCheckTargetIds.cmake b/share/rocmcmakebuildtools/cmake/ROCMCheckTargetIds.cmake index 8eaf7ab8..8b71fcb8 100644 --- a/share/rocmcmakebuildtools/cmake/ROCMCheckTargetIds.cmake +++ b/share/rocmcmakebuildtools/cmake/ROCMCheckTargetIds.cmake @@ -33,9 +33,26 @@ function(_rocm_sanitize_target_id TARGET_ID VARIABLE) # CMake defines a preprocessor macro with this value, so it must be a valid C identifier # Handle + and - for xnack and sramecc so that e.g. xnack+ and xnack- doesn't get folded to # the same string by MAKE_C_IDENTIFIER - string(REPLACE "_" "__" TARGET_ID "${TARGET_ID}") - string(REPLACE "+" "_on" TARGET_ID "${TARGET_ID}") - string(REPLACE "-" "_off" TARGET_ID "${TARGET_ID}") + + # Target ID syntax: + # ::== ( ":" ( "+" | "-" ) )* + + # split target id by colon into a list of components + string(REPLACE ":" ";" _components "${TARGET_ID}") + list(GET _components 0 _processor) + list(REMOVE_AT _components 0) + # remove '-' from processor name + string(REPLACE "-" "_" _processor "${_processor}") + if(_components) + # remove '+' or '-' from target features + string(REPLACE "+" "_on" _components "${_components}") + string(REPLACE "-" "_off" _components "${_components}") + # join components with a colon + string(REPLACE ";" ":" TARGET_ID "${_processor}:${_components}") + else() + set(TARGET_ID "${_processor}") + endif() + string(MAKE_C_IDENTIFIER "${TARGET_ID}" TARGET_ID) set(${VARIABLE} "${TARGET_ID}" PARENT_SCOPE) endfunction() From 753c9cd2262b107b9082fdd9f25fecca876a0b6a Mon Sep 17 00:00:00 2001 From: Lauren Wrubleski Date: Thu, 10 Apr 2025 15:13:08 -0600 Subject: [PATCH 3/7] Remove macOS runner (#266) --- .github/workflows/test.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 6d8e68bb..7d428f32 100755 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -33,7 +33,6 @@ jobs: matrix: platform: - ubuntu-20.04 - - macos-12 - windows-2019 cmake-version: - 3.20.0 From d0aa73b9118d8ecac13c8e579041a69c49cadc6a Mon Sep 17 00:00:00 2001 From: Lauren Wrubleski Date: Thu, 10 Apr 2025 15:37:48 -0600 Subject: [PATCH 4/7] Update upper end of cmake_minimum_required range (#241) * Update upper end of cmake_minimum_required range CMake 3.31 is dropping support for cmake_minimum_required for versions less than 3.10, but adding 3.25 (which is tested on math-ci) indicates that we test compatibility with 3.25, which causes those warnings to be suppressed. * Add CMake version 3.31.0 to testing * Change CMP0079 behaviour * Update upper end of range to latest version tested (3.31.0) * Update CMake versions in test.yml --- .github/workflows/test.yml | 5 +++-- CMakeLists.txt | 2 +- share/rocmcmakebuildtools/cmake/ROCMTest.cmake | 2 +- test/analyze/CMakeLists.txt | 2 +- test/docsphinx/CMakeLists.txt | 2 +- test/findpackagecheck/CMakeLists.txt | 2 +- test/libbasic/CMakeLists.txt | 2 +- test/libheaderonly/CMakeLists.txt | 2 +- test/libprivate/CMakeLists.txt | 2 +- test/libsimple/CMakeLists.txt | 2 +- test/libsimple2/CMakeLists.txt | 2 +- test/libsimplecompat/CMakeLists.txt | 2 +- test/libsimpletest/CMakeLists.txt | 2 +- test/libwrapper/CMakeLists.txt | 2 +- test/pass/rocm-package-setup-component.cmake | 2 +- test/toolchain-var/CMakeLists.txt | 2 +- test/version/CMakeLists.txt | 2 +- 17 files changed, 19 insertions(+), 18 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 7d428f32..ed4059f5 100755 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -35,8 +35,9 @@ jobs: - ubuntu-20.04 - windows-2019 cmake-version: - - 3.20.0 - - 3.10.2 + - 3.31.0 + - 3.22.1 + - 3.16.3 exclude: - platform: windows-2019 cmake-version: 3.10.2 diff --git a/CMakeLists.txt b/CMakeLists.txt index 4100ac21..11f0e62d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -2,7 +2,7 @@ # Copyright (C) 2017 Advanced Micro Devices, Inc. ################################################################################ -cmake_minimum_required (VERSION 3.6) +cmake_minimum_required (VERSION 3.6...3.31.0) set(CMAKE_INSTALL_PREFIX "/opt/rocm" CACHE PATH "") diff --git a/share/rocmcmakebuildtools/cmake/ROCMTest.cmake b/share/rocmcmakebuildtools/cmake/ROCMTest.cmake index f534ea42..ccaa3a0b 100644 --- a/share/rocmcmakebuildtools/cmake/ROCMTest.cmake +++ b/share/rocmcmakebuildtools/cmake/ROCMTest.cmake @@ -31,7 +31,7 @@ macro(rocm_enable_test_package NAME) endmacro() if(POLICY CMP0079) - cmake_policy(SET CMP0079 OLD) + cmake_policy(SET CMP0079 NEW) endif() add_library(rocm_test_dependencies INTERFACE) diff --git a/test/analyze/CMakeLists.txt b/test/analyze/CMakeLists.txt index 53aeb92b..cfe1b2ba 100755 --- a/test/analyze/CMakeLists.txt +++ b/test/analyze/CMakeLists.txt @@ -3,7 +3,7 @@ ################################################################################ -cmake_minimum_required (VERSION 3.5) +cmake_minimum_required (VERSION 3.5...3.31.0) project(simple LANGUAGES CXX) find_package(ROCmCMakeBuildTools) diff --git a/test/docsphinx/CMakeLists.txt b/test/docsphinx/CMakeLists.txt index c55fe59f..b49aaace 100644 --- a/test/docsphinx/CMakeLists.txt +++ b/test/docsphinx/CMakeLists.txt @@ -2,7 +2,7 @@ # Copyright (C) 2023 Advanced Micro Devices, Inc. ################################################################################ -cmake_minimum_required (VERSION 3.5) +cmake_minimum_required (VERSION 3.5...3.31.0) project(useful LANGUAGES CXX) # Ideally should be NONE, but GNUInstallDirs detects platform arch using try_compile # https://stackoverflow.com/questions/43379311/why-does-project-affect-cmakes-opinion-on-cmake-sizeof-void-p diff --git a/test/findpackagecheck/CMakeLists.txt b/test/findpackagecheck/CMakeLists.txt index b26282d6..4f643807 100644 --- a/test/findpackagecheck/CMakeLists.txt +++ b/test/findpackagecheck/CMakeLists.txt @@ -1,5 +1,5 @@ -cmake_minimum_required (VERSION 3.5) +cmake_minimum_required (VERSION 3.5...3.31.0) project(findpackagecheck CXX) message(STATUS "PKG: ${PKG}") diff --git a/test/libbasic/CMakeLists.txt b/test/libbasic/CMakeLists.txt index 8ef39883..7548eb43 100644 --- a/test/libbasic/CMakeLists.txt +++ b/test/libbasic/CMakeLists.txt @@ -3,7 +3,7 @@ ################################################################################ -cmake_minimum_required (VERSION 3.5) +cmake_minimum_required (VERSION 3.5...3.31.0) project(basic CXX) find_package(ROCmCMakeBuildTools) diff --git a/test/libheaderonly/CMakeLists.txt b/test/libheaderonly/CMakeLists.txt index 4a6d6b33..99052174 100644 --- a/test/libheaderonly/CMakeLists.txt +++ b/test/libheaderonly/CMakeLists.txt @@ -3,7 +3,7 @@ ################################################################################ -cmake_minimum_required (VERSION 3.5) +cmake_minimum_required (VERSION 3.5...3.31.0) project(headeronly LANGUAGES NONE) find_package(ROCmCMakeBuildTools) diff --git a/test/libprivate/CMakeLists.txt b/test/libprivate/CMakeLists.txt index 42d68594..60819173 100644 --- a/test/libprivate/CMakeLists.txt +++ b/test/libprivate/CMakeLists.txt @@ -3,7 +3,7 @@ ################################################################################ -cmake_minimum_required (VERSION 3.5) +cmake_minimum_required (VERSION 3.5...3.31.0) project(libprivate CXX) find_package(ROCmCMakeBuildTools) diff --git a/test/libsimple/CMakeLists.txt b/test/libsimple/CMakeLists.txt index 1968a9a1..2eebe1e1 100644 --- a/test/libsimple/CMakeLists.txt +++ b/test/libsimple/CMakeLists.txt @@ -3,7 +3,7 @@ ################################################################################ -cmake_minimum_required (VERSION 3.5) +cmake_minimum_required (VERSION 3.5...3.31.0) project(simple CXX) find_package(ROCmCMakeBuildTools) diff --git a/test/libsimple2/CMakeLists.txt b/test/libsimple2/CMakeLists.txt index 10ed4f0c..28b16b96 100644 --- a/test/libsimple2/CMakeLists.txt +++ b/test/libsimple2/CMakeLists.txt @@ -3,7 +3,7 @@ ################################################################################ -cmake_minimum_required (VERSION 3.5) +cmake_minimum_required (VERSION 3.5...3.31.0) project(simple2 CXX) find_package(ROCmCMakeBuildTools) diff --git a/test/libsimplecompat/CMakeLists.txt b/test/libsimplecompat/CMakeLists.txt index 572c5aa5..1a3688a0 100644 --- a/test/libsimplecompat/CMakeLists.txt +++ b/test/libsimplecompat/CMakeLists.txt @@ -3,7 +3,7 @@ ################################################################################ -cmake_minimum_required (VERSION 3.5) +cmake_minimum_required (VERSION 3.5...3.31.0) project(simple CXX) find_package(ROCM) diff --git a/test/libsimpletest/CMakeLists.txt b/test/libsimpletest/CMakeLists.txt index 86a41cc4..893db1c3 100644 --- a/test/libsimpletest/CMakeLists.txt +++ b/test/libsimpletest/CMakeLists.txt @@ -3,7 +3,7 @@ ################################################################################ -cmake_minimum_required (VERSION 3.5) +cmake_minimum_required (VERSION 3.5...3.31.0) project(simple CXX) find_package(ROCmCMakeBuildTools) diff --git a/test/libwrapper/CMakeLists.txt b/test/libwrapper/CMakeLists.txt index 161407ff..74f79c29 100644 --- a/test/libwrapper/CMakeLists.txt +++ b/test/libwrapper/CMakeLists.txt @@ -3,7 +3,7 @@ ################################################################################ -cmake_minimum_required (VERSION 3.5) +cmake_minimum_required (VERSION 3.5...3.31.0) project(test-wrapper CXX) find_package(ROCmCMakeBuildTools) diff --git a/test/pass/rocm-package-setup-component.cmake b/test/pass/rocm-package-setup-component.cmake index b8ed8cd8..89c079ff 100644 --- a/test/pass/rocm-package-setup-component.cmake +++ b/test/pass/rocm-package-setup-component.cmake @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.10) +cmake_minimum_required(VERSION 3.10...3.31.0) use_rocm_cmake() include(ROCMCreatePackage) diff --git a/test/toolchain-var/CMakeLists.txt b/test/toolchain-var/CMakeLists.txt index 98810d08..bb3dc465 100644 --- a/test/toolchain-var/CMakeLists.txt +++ b/test/toolchain-var/CMakeLists.txt @@ -3,7 +3,7 @@ ################################################################################ -cmake_minimum_required (VERSION 3.5) +cmake_minimum_required (VERSION 3.5...3.31.0) find_package(ROCmCMakeBuildTools) project(toolchain-var CXX) diff --git a/test/version/CMakeLists.txt b/test/version/CMakeLists.txt index 6c73766a..16f96b7b 100644 --- a/test/version/CMakeLists.txt +++ b/test/version/CMakeLists.txt @@ -2,7 +2,7 @@ # Copyright (C) 2017 Advanced Micro Devices, Inc. ################################################################################ -cmake_minimum_required (VERSION 3.5) +cmake_minimum_required (VERSION 3.5...3.31.0) project(simple LANGUAGES NONE) find_package(ROCmCMakeBuildTools) From 03bf7eb6e3d2e85f7dcc31f6342ed80f5cc196ad Mon Sep 17 00:00:00 2001 From: Eiden Yoshida <47196116+eidenyoshida@users.noreply.github.com> Date: Thu, 19 Jun 2025 15:16:27 -0600 Subject: [PATCH 5/7] Revert "Add rocm-core dependency to all generated packages, not just the root one. (#257)" (#270) This reverts commit f50f30f4e3e1d1d36c9948875eb55183e378c935. --- share/rocmcmakebuildtools/cmake/ROCMCreatePackage.cmake | 5 ----- 1 file changed, 5 deletions(-) diff --git a/share/rocmcmakebuildtools/cmake/ROCMCreatePackage.cmake b/share/rocmcmakebuildtools/cmake/ROCMCreatePackage.cmake index d3fc9d52..8e176031 100755 --- a/share/rocmcmakebuildtools/cmake/ROCMCreatePackage.cmake +++ b/share/rocmcmakebuildtools/cmake/ROCMCreatePackage.cmake @@ -139,11 +139,6 @@ macro(rocm_package_add_rocm_core_dependency) endif() rocm_join_if_set(", " CPACK_DEBIAN_PACKAGE_DEPENDS ${_rocm_core_pkg}) rocm_join_if_set(", " CPACK_RPM_PACKAGE_REQUIRES ${_rocm_core_pkg}) - foreach(COMPONENT IN LISTS ROCM_PACKAGE_COMPONENTS) - rocm_package_add_dependencies(COMPONENT ${COMPONENT} DEPENDS ${_rocm_core_pkg}) - endforeach() - rocm_package_add_dependencies(COMPONENT runtime DEPENDS ${_rocm_core_pkg}) - rocm_package_add_dependencies(COMPONENT devel DEPENDS ${_rocm_core_pkg}) unset(_rocm_core_pkg) endif() endmacro() From 10155d7272ea1bf79f6b5a9dbc339657af1aa372 Mon Sep 17 00:00:00 2001 From: Jacob Lambert Date: Wed, 20 Aug 2025 09:59:29 -0700 Subject: [PATCH 6/7] Add --hip-link to target_id check (#275) * Add --hip-link to target_id check The new driver in clang does not automatically link against the HIP libraries, so we need to add a --hip-link option here to enforce linking. Otherwise we'll get an error on the link stem of check_cxx_compiler_flag() when calling with "-xhip" and "--offload-arch" Note: The link step isn't really needed for this use case, as invalid targets will fail the compilation step. But check_cxx_compiler_flag() performs both compiling and linking by default * Update test.yml --- .github/workflows/test.yml | 6 +++--- share/rocmcmakebuildtools/cmake/ROCMCheckTargetIds.cmake | 1 + 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index ed4059f5..31fba3a4 100755 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -11,7 +11,7 @@ jobs: with: access_token: ${{ github.token }} lint: - runs-on: ubuntu-20.04 + runs-on: ubuntu-24.04 steps: - uses: actions/checkout@v1 - name: Set up Python 3.10 @@ -32,8 +32,8 @@ jobs: max-parallel: 4 matrix: platform: - - ubuntu-20.04 - - windows-2019 + - ubuntu-24.04 + - windows-2022 cmake-version: - 3.31.0 - 3.22.1 diff --git a/share/rocmcmakebuildtools/cmake/ROCMCheckTargetIds.cmake b/share/rocmcmakebuildtools/cmake/ROCMCheckTargetIds.cmake index 8b71fcb8..6f008bf0 100644 --- a/share/rocmcmakebuildtools/cmake/ROCMCheckTargetIds.cmake +++ b/share/rocmcmakebuildtools/cmake/ROCMCheckTargetIds.cmake @@ -21,6 +21,7 @@ function(rocm_check_target_ids VARIABLE) foreach(_target_id ${PARSE_TARGETS}) _rocm_sanitize_target_id("${_target_id}" _result_var) set(_result_var "COMPILER_HAS_TARGET_ID_${_result_var}") + set(CMAKE_REQUIRED_LINK_OPTIONS "--hip-link") check_cxx_compiler_flag("-xhip --offload-arch=${_target_id}" "${_result_var}") if(${_result_var}) list(APPEND _supported_target_ids "${_target_id}") From bb18c61579e46741ad8c6d663fedfcd76aa621be Mon Sep 17 00:00:00 2001 From: arvindcheru <90783369+arvindcheru@users.noreply.github.com> Date: Tue, 26 Aug 2025 14:43:22 -0400 Subject: [PATCH 7/7] Fix Lintian warning for empty pre/post install scripts (#273) * Lintian Warning Fix, License Folder Name Update * Prioritizing Lintian Warning Fixes * UT FIX Update * Update comments --- .../cmake/ROCMCreatePackage.cmake | 23 +++++++++++++++---- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/share/rocmcmakebuildtools/cmake/ROCMCreatePackage.cmake b/share/rocmcmakebuildtools/cmake/ROCMCreatePackage.cmake index 8e176031..d399a0f6 100755 --- a/share/rocmcmakebuildtools/cmake/ROCMCreatePackage.cmake +++ b/share/rocmcmakebuildtools/cmake/ROCMCreatePackage.cmake @@ -402,10 +402,6 @@ macro(rocm_create_package) file(WRITE ${PROJECT_BINARY_DIR}/debian/postinst "") file(WRITE ${PROJECT_BINARY_DIR}/debian/prerm "") - set(CPACK_DEBIAN_PACKAGE_CONTROL_EXTRA "${PROJECT_BINARY_DIR}/debian/postinst;${PROJECT_BINARY_DIR}/debian/prerm") - set(CPACK_RPM_POST_INSTALL_SCRIPT_FILE "${PROJECT_BINARY_DIR}/debian/postinst") - set(CPACK_RPM_PRE_UNINSTALL_SCRIPT_FILE "${PROJECT_BINARY_DIR}/debian/prerm") - if(PARSE_LDCONFIG AND NOT ${ROCM_DISABLE_LDCONFIG}) set(LDCONFIG_DIR ${LIB_DIR}) if(PARSE_LDCONFIG_DIR) @@ -417,7 +413,6 @@ macro(rocm_create_package) echo \"${LDCONFIG_DIR}\" > /etc/ld.so.conf.d/${PARSE_NAME}.conf ldconfig ") - file( APPEND ${PROJECT_BINARY_DIR}/debian/prerm " @@ -433,10 +428,28 @@ macro(rocm_create_package) if(PARSE_COMPONENTS) rocm_set_comp_cpackvar(PARSE_HEADER_ONLY "${PARSE_SUFFIX}" "${PARSE_COMPONENTS}") endif() + + # Lintian Warning Fix: Enable post/pre scripts only if non empty + rocm_check_and_configure_script_files("${PROJECT_BINARY_DIR}/debian/prerm" "${PROJECT_BINARY_DIR}/debian/postinst") + include(CPack) set(ROCM_PACKAGE_CREATED TRUE CACHE INTERNAL "Track whether rocm_create_package has been called.") endmacro() +# Check script File Size and then configure +macro(rocm_check_and_configure_script_files PS_SCRIPT_FILE PR_SCRIPT_FILE) + file(SIZE ${PS_SCRIPT_FILE} _postinst_file_sz) + if(${_postinst_file_sz} GREATER 0) + set(CPACK_RPM_POST_INSTALL_SCRIPT_FILE "${PS_SCRIPT_FILE}") + set(CPACK_DEBIAN_PACKAGE_CONTROL_EXTRA "${PS_SCRIPT_FILE}") + endif() + file(SIZE ${PR_SCRIPT_FILE} _prerm_file_sz) + if(${_prerm_file_sz} GREATER 0) + set(CPACK_RPM_PRE_UNINSTALL_SCRIPT_FILE "${PR_SCRIPT_FILE}") + set(CPACK_DEBIAN_PACKAGE_CONTROL_EXTRA "${CPACK_DEBIAN_PACKAGE_CONTROL_EXTRA};${PR_SCRIPT_FILE}") + endif() +endmacro() + macro(rocm_setup_license HEADER_ONLY) if(NOT CPACK_RESOURCE_FILE_LICENSE) file(GLOB _license_files LIST_DIRECTORIES FALSE "${CMAKE_SOURCE_DIR}/LICENSE*")