2d072f9217
* Add rocprofiler-sdk-utilities.cmake - contains cmake function rocprofiler_sdk_get_gfx_architectures * Update perfetto_reader.py - fix hash collision * Update project names in tests folders - rocprofiler-tests -> rocprofiler-sdk-tests * Fix incorrect allocation-error handling * [CI] Disable openmp tests for navi2, navi3, and navi4 * Suppress leaks by omptarget and llvm --------- Co-authored-by: Jonathan R. Madsen <jonathanrmadsen@gmail.com>
52 lines
1.6 KiB
CMake
52 lines
1.6 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()
|
|
|
|
if(NOT DEFINED ARG_PREFIX)
|
|
set(ARG_PREFIX "[${PROJECT_NAME}] ")
|
|
endif()
|
|
|
|
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} failed with error code ${rocminfo_RET}\nstderr:\n${rocminfo_ERR}\nstdout:\n${rocminfo_OUT}"
|
|
)
|
|
endif()
|
|
endif()
|
|
endfunction()
|