Files
TheRock/rocm-systems/projects/rocprofiler-sdk/cmake/Modules/rocprofiler-sdk-utilities.cmake
T
derek.holloway 7502bf64a4
CodeQL / Analyze (actions) (push) Canceled after 0s
CodeQL / Analyze (python) (push) Canceled after 0s
pre-commit / pre-commit (push) Canceled after 0s
Multi-Arch CI / setup (push) Canceled after 0s
Publish build_manylinux_x86_64 images / publish_build_manylinux_x86_64 (push) Canceled after 0s
Setup (Multi-Arch) / setup (push) Canceled after 0s
Multi-Arch CI / Linux::${{ fromJSON(needs.setup.outputs.linux_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubi10 image / publish_no_rocm_image_ubi10 (push) Canceled after 0s
Multi-Arch CI / Windows::${{ fromJSON(needs.setup.outputs.windows_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Multi-Arch CI / Manifest Diff (push) Canceled after 0s
TheRock Manifest Diff Report / Generate Manifest Diff Report (push) Canceled after 0s
Multi-Arch CI / CI Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_ocl_rt images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_rocgdb images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Unit Tests / Unit Tests :: ubuntu-24.04 (push) Canceled after 0s
Unit Tests / Unit Tests :: windows-2022 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_media (push) Canceled after 0s
Unit Tests / Unit Tests Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_openmpi (push) Canceled after 0s
Flatten subprojects into a single base monorepo
2026-09-02 16:34:47 -07:00

160 lines
5.4 KiB
CMake

#
# Miscellaneous cmake functions for rocprofiler-sdk
#
include_guard(GLOBAL)
function(rocprofiler_sdk_get_gfx_architectures _VAR)
cmake_parse_arguments(ARG "ECHO" "PREFIX;DELIM" "" ${ARGN})
if(NOT DEFINED ARG_DELIM)
set(ARG_DELIM ", ")
endif()
set(CMAKE_MESSAGE_INDENT "[${PROJECT_NAME}]${ARG_PREFIX} ")
find_program(
rocminfo_EXECUTABLE
NAMES rocminfo
HINTS ${rocprofiler-sdk_ROOT_DIR} ${rocm_version_DIR} ${ROCM_PATH} /opt/rocm
PATHS ${rocprofiler-sdk_ROOT_DIR} ${rocm_version_DIR} ${ROCM_PATH} /opt/rocm
PATH_SUFFIXES bin)
if(rocminfo_EXECUTABLE)
execute_process(
COMMAND ${rocminfo_EXECUTABLE}
RESULT_VARIABLE rocminfo_RET
OUTPUT_VARIABLE rocminfo_OUT
ERROR_VARIABLE rocminfo_ERR
OUTPUT_STRIP_TRAILING_WHITESPACE ERROR_STRIP_TRAILING_WHITESPACE)
if(rocminfo_RET EQUAL 0)
string(REGEX MATCHALL "gfx([0-9A-Fa-f]+)" rocminfo_GFXINFO "${rocminfo_OUT}")
list(REMOVE_DUPLICATES rocminfo_GFXINFO)
set(${_VAR}
"${rocminfo_GFXINFO}"
PARENT_SCOPE)
if(ARG_ECHO)
string(REPLACE ";" "${ARG_DELIM}" _GFXINFO_ECHO "${rocminfo_GFXINFO}")
message(STATUS "${ARG_PREFIX}System architectures: ${_GFXINFO_ECHO}")
endif()
else()
message(
AUTHOR_WARNING
"${rocminfo_EXECUTABLE} returned ${rocminfo_RET}\nstderr:\n${rocminfo_ERR}\nstdout:\n${rocminfo_OUT}"
)
endif()
endif()
endfunction()
# In case the underlying architecture does not support PC sampling, this function will
# tell us whether the PC sampling is disabled
function(rocprofiler_sdk_pc_sampling_disabled _VAR)
cmake_parse_arguments(ARG "ECHO" "PREFIX" "" ${ARGN})
set(CMAKE_MESSAGE_INDENT "[${PROJECT_NAME}]${ARG_PREFIX} ")
rocprofiler_sdk_get_gfx_architectures(rocprofiler-sdk-tests-gfx-info ECHO)
list(GET rocprofiler-sdk-tests-gfx-info 0 pc-sampling-gpu-0-gfx-info)
if("${pc-sampling-gpu-0-gfx-info}" MATCHES "^gfx90a$"
OR "${pc-sampling-gpu-0-gfx-info}" MATCHES "^gfx94[0-9]$"
OR "${pc-sampling-gpu-0-gfx-info}" MATCHES "^gfx95[0-9]$"
OR "${pc-sampling-gpu-0-gfx-info}" MATCHES "^gfx12[0-9][0-9]$")
# PC sampling is enabled on this architecture.
set(${_VAR}
FALSE
PARENT_SCOPE)
if(ARG_ECHO)
message(STATUS "PC Sampling is enabled for ${pc-sampling-gpu-0-gfx-info}")
endif()
else()
# PC sampling is disabled on this architecture.
set(${_VAR}
TRUE
PARENT_SCOPE)
if(ARG_ECHO)
message(STATUS "PC Sampling is disabled for ${pc-sampling-gpu-0-gfx-info}")
endif()
endif()
endfunction()
# In case the underlying architecture does not support stochastic PC sampling, this
# function will tell us whether the PC sampling is disabled
function(rocprofiler_sdk_pc_sampling_stochastic_disabled _VAR)
cmake_parse_arguments(ARG "ECHO" "PREFIX" "" ${ARGN})
set(CMAKE_MESSAGE_INDENT "[${PROJECT_NAME}]${ARG_PREFIX} ")
rocprofiler_sdk_get_gfx_architectures(rocprofiler-sdk-tests-gfx-info ECHO)
list(GET rocprofiler-sdk-tests-gfx-info 0 pc-sampling-gpu-0-gfx-info)
if("${pc-sampling-gpu-0-gfx-info}" MATCHES "^gfx94[0-9]$"
OR "${pc-sampling-gpu-0-gfx-info}" MATCHES "^gfx95[0-9]$"
OR "${pc-sampling-gpu-0-gfx-info}" MATCHES "^gfx1250$")
# PC sampling is enabled on this architecture.
set(${_VAR}
FALSE
PARENT_SCOPE)
if(ARG_ECHO)
message(STATUS "PC Sampling is enabled for ${pc-sampling-gpu-0-gfx-info}")
endif()
else()
# PC sampling is disabled on this architecture.
set(${_VAR}
TRUE
PARENT_SCOPE)
if(ARG_ECHO)
message(STATUS "PC Sampling is disabled for ${pc-sampling-gpu-0-gfx-info}")
endif()
endif()
endfunction()
# Checks whether triple buffer is implemented for architecture: MI3xx and gfx12
function(rocprofiler_sdk_sqtt_triple_buffer_disabled _VAR)
cmake_parse_arguments(ARG "ECHO" "PREFIX" "" ${ARGN})
set(CMAKE_MESSAGE_INDENT "[${PROJECT_NAME}]${ARG_PREFIX} ")
rocprofiler_sdk_get_gfx_architectures(rocprofiler-sdk-tests-gfx-info ECHO)
list(GET rocprofiler-sdk-tests-gfx-info 0 gpu-0-gfx-info)
if("${gpu-0-gfx-info}" MATCHES "^gfx(9[4-5][0-9]|12[0-9][0-9])$")
set(${_VAR}
FALSE
PARENT_SCOPE)
else()
set(${_VAR}
TRUE
PARENT_SCOPE)
endif()
endfunction()
function(rocprofiler_sdk_spm_disabled _VAR)
cmake_parse_arguments(ARG "ECHO" "PREFIX" "" ${ARGN})
set(CMAKE_MESSAGE_INDENT "[${PROJECT_NAME}]${ARG_PREFIX} ")
rocprofiler_sdk_get_gfx_architectures(rocprofiler-sdk-tests-gfx-info ECHO)
list(GET rocprofiler-sdk-tests-gfx-info 0 spm-gpu-0-gfx-info)
if("${spm-gpu-0-gfx-info}" MATCHES "^gfx94[0-9]$")
# spm is enabled on this architecture.
set(${_VAR}
FALSE
PARENT_SCOPE)
if(ARG_ECHO)
message(STATUS "SPM is enabled for ${spm-gpu-0-gfx-info}")
endif()
else()
# SPM is disabled on this architecture.
set(${_VAR}
TRUE
PARENT_SCOPE)
if(ARG_ECHO)
message(STATUS "SPM is disabled for ${spm-gpu-0-gfx-info}")
endif()
endif()
endfunction()