Files
rocm-systems/cmake/Modules/rocprofiler-sdk-utilities.cmake
T
Elwazir, Ammar aeb1621c2b [SDK] Support CMake option for using internal RCCL tracing + (temporary) enable in CI (#457)
* Temp: disable RCCL tracing

* Update continuous_integration.yml

* Update continuous_integration.yml

* Update continuous_integration.yml

* Adding option to disable rccl tracing from CMake

* Update codeql.yml

* Misc updates

- ROCPROFILER_BUILD_RCCL -> ROCPROFILER_INTERNAL_RCCL_API_TRACE
- env.EXTRA_TEMP_CMAKE_OPTIONS -> env.GLOBAL_CMAKE_OPTIONS
- add (advanced) option ROCPROFILER_INTERNAL_RCCL_API_TRACE

* Fix rocprofiler::sdk::get_enum_label

- missing enum labels for HIP_RUNTIME_API_TABLE_STEP_VERSION > 8

* Update tests/rocprofv3/advanced-thread-trace/CMakeLists.txt

- improve various aspect of cmake -- particularly echoing where attdecoder_LIBRARY was found

* Use CMAKE_MESSAGE_INDENT

- add prefix to cmake messages to help indicate where messages are coming from
- make find_package(Python3 ...) QUIET for bindings

* Fix rocprofiler::sdk::get_enum_label

- handle HSA_AMD_EXT_API_TABLE_MAJOR_VERSION

* Fix rocprofv3 message for att library path

* Fix tests/rocprofv3/advanced-thread-trace/att_input.yml config

* Fix rocprofv3 check_att_capability + soversion/version library resolution

- Account for ROCPROF_ATT_LIBRARY_PATH in env in check_att_capability
- Add resolve_library_path
  - supports resolution of library names to SOVERSION and VERSION paths

* Fix python linting error (unused import)

---------

Co-authored-by: Ammar ELWazir <aelwazir@amd.com>
Co-authored-by: Jonathan R. Madsen <jonathanrmadsen@gmail.com>
2025-06-17 08:32:54 -05:00

111 líneas
3.9 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]$")
# 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]$")
# 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()