[rocprofiler-systems] Add build option for "examples" to specify gfx-arch (#2626)

## Motivation
 - Added `check_rocminfo` function that returns true if the provided regex was found, false otherwise. Can also use `GET_OUTPUT` to get the raw output filtered with or without a regex.
 - Moved `rocprofiler_systems_get_gfx_archs()` to `MacroUtilities.cmake` 
 - Added `rocprofiler_systems_lookup_gfx()`, which detects whether a given `gfx` is from the `instinct`, `radeon` or `apu` family.
 - Added `ROCPROFSYS_GFX_TARGETS` as a build argument. Used to specify the offloading architectures that GPU examples should compile for. If empty, defaults to whatever your system has.
 - GPU examples now check if the given `gfx` targets (from `ROCPROFSYS_GFX_TARGETS`) are supported.
 - OMPVV offload tests now only compile if `amdflang` version is `>= 20`
 - Improve link time by reducing the number of GFX targets that binaries need to support.
   - RCCL is now passed a `GPU_TARGETS` var specifying the architectures to build/link against.
This commit is contained in:
Kian Cossettini
2026-01-20 12:13:21 -05:00
committed by GitHub
parent 4a5cbbfba5
commit 698ac6b8bc
13 changed files with 352 additions and 162 deletions
@@ -118,6 +118,16 @@ if("${CMAKE_BUILD_TYPE}" MATCHES "Release")
target_compile_options(transferBench PRIVATE -g1)
endif()
# Specify GPU architectures to compile for
foreach(arch IN LISTS ROCPROFSYS_GFX_TARGETS)
rocprofiler_systems_lookup_gfx(${arch} GPU_CATEGORIES)
if("apu" IN_LIST GPU_CATEGORIES AND NOT "instinct" IN_LIST GPU_CATEGORIES)
continue()
endif()
target_compile_options(transferBench PRIVATE --offload-arch=${arch})
target_link_options(transferBench PUBLIC --offload-arch=${arch})
endforeach()
if(NOT CMAKE_CXX_COMPILER_IS_HIPCC AND HIPCC_EXECUTABLE)
# defined in MacroUtilities.cmake
rocprofiler_systems_custom_compilation(COMPILER ${HIPCC_EXECUTABLE} TARGET transferBench)