Files
rocm-systems/tests/common/CMakeLists.txt
T
Gopesh Bhardwaj 348d740388 hsa multiqueue application (#618)
* hsa multiqueuw application

* cmake formatting (cmake-format) (#619)

Co-authored-by: bgopesh <7112102+bgopesh@users.noreply.github.com>

* source formatting (clang-format v11) (#620)

Co-authored-by: bgopesh <7112102+bgopesh@users.noreply.github.com>

* comppialtion fix

* Update tests/bin/CMakeLists.txt

Reorder `add_subdirectory` to fix (recurrent) issues with ROCTx in `CMAKE_BUILD_RPATH`

* addressing early feedback

* cmake updates

* more cmake updates

* adding queue dependency test

* updating test

* test updates

* removed hsa_api_trace header

* reformating headers to prevent clang from reordering

* Fixing packaging

* Fixes for hangs

* source formatting (clang-format v11) (#676)

Co-authored-by: bwelton <1683479+bwelton@users.noreply.github.com>

* cmake formatting (cmake-format) (#673)

Co-authored-by: bwelton <1683479+bwelton@users.noreply.github.com>

* structure change

* cmake formatting (cmake-format) (#680)

Co-authored-by: bgopesh <7112102+bgopesh@users.noreply.github.com>

* Adding kernel trace to test hang fix

* rebased and fixed kernel-trace test

* rhel clang fixes

* source formatting (clang-format v11) (#685)

Co-authored-by: bgopesh <7112102+bgopesh@users.noreply.github.com>

* Update lib/rocprofiler-sdk-tool/helper.hpp

- remove suppression of -Wshadow

* Update tests/bin/hsa-queue-dependency/CMakeLists.txt

- cleanup unnecessary code
- GPU_LIST -> GPU_TARGETS

* GPU_LIST -> GPU_TARGETS

* Remove installation of test executable and libraries

---------

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: bgopesh <7112102+bgopesh@users.noreply.github.com>
Co-authored-by: Jonathan R. Madsen <jrmadsen@users.noreply.github.com>
Co-authored-by: Benjamin Welton <bewelton@amd.com>
Co-authored-by: bwelton <1683479+bwelton@users.noreply.github.com>
Co-authored-by: Jonathan R. Madsen <jonathanrmadsen@gmail.com>
2024-04-09 10:19:16 -05:00

134 lines
4.8 KiB
CMake

#
# common utilities for tests
#
include(FetchContent)
set(FETCHCONTENT_BASE_DIR ${PROJECT_BINARY_DIR}/external)
# default FAIL_REGULAR_EXPRESSION for tests
set(ROCPROFILER_DEFAULT_FAIL_REGEX
"threw an exception|Permission denied|Could not create logging file"
CACHE STRING "Default FAIL_REGULAR_EXPRESSION for tests")
set(DEFAULT_GPU_TARGETS
"gfx900"
"gfx906"
"gfx908"
"gfx90a"
"gfx940"
"gfx941"
"gfx942"
"gfx1030"
"gfx1010"
"gfx1100"
"gfx1101"
"gfx1102")
set(GPU_TARGETS
"${DEFAULT_GPU_TARGETS}"
CACHE STRING "GPU targets to compile for")
# build flags
add_library(rocprofiler-tests-build-flags INTERFACE)
add_library(rocprofiler::tests-build-flags ALIAS rocprofiler-tests-build-flags)
target_compile_options(rocprofiler-tests-build-flags INTERFACE -W -Wall -Wextra -Wshadow)
target_compile_features(rocprofiler-tests-build-flags INTERFACE cxx_std_17)
if(ROCPROFILER_BUILD_CI OR ROCPROFILER_BUILD_WERROR)
target_compile_options(rocprofiler-tests-build-flags INTERFACE -Werror)
endif()
# serialization library
if(NOT TARGET rocprofiler::cereal)
get_filename_component(ROCPROFILER_SOURCE_DIR "${PROJECT_SOURCE_DIR}/.." REALPATH)
add_library(rocprofiler-cereal INTERFACE)
add_library(rocprofiler::cereal ALIAS rocprofiler-cereal)
target_compile_definitions(rocprofiler-cereal
INTERFACE $<BUILD_INTERFACE:CEREAL_THREAD_SAFE=1>)
if(EXISTS ${ROCPROFILER_SOURCE_DIR}/external AND COMMAND
rocprofiler_checkout_git_submodule)
rocprofiler_checkout_git_submodule(
RECURSIVE
RELATIVE_PATH external/cereal
WORKING_DIRECTORY ${ROCPROFILER_SOURCE_DIR}
REPO_URL https://github.com/jrmadsen/cereal.git
REPO_BRANCH "rocprofiler")
target_include_directories(
rocprofiler-cereal SYSTEM
INTERFACE $<BUILD_INTERFACE:${ROCPROFILER_SOURCE_DIR}/external/cereal/include>
)
else()
fetchcontent_declare(
cereal
GIT_REPOSITORY https://github.com/jrmadsen/cereal.git
GIT_TAG rocprofiler
SOURCE_DIR ${PROJECT_BINARY_DIR}/external/cereal BINARY_DIR
${PROJECT_BINARY_DIR}/external/build/cereal-build SUBBUILD_DIR
${PROJECT_BINARY_DIR}/external/build/cereal-subdir)
# This particular version of projD requires workarounds
fetchcontent_getproperties(cereal)
if(NOT cereal_POPULATED)
fetchcontent_populate(cereal)
endif()
target_include_directories(
rocprofiler-cereal SYSTEM
INTERFACE $<BUILD_INTERFACE:${PROJECT_BINARY_DIR}/external/cereal/include>)
endif()
endif()
# perfetto
fetchcontent_declare(
perfetto
GIT_REPOSITORY https://android.googlesource.com/platform/external/perfetto
GIT_TAG v42.0
SOURCE_DIR ${PROJECT_BINARY_DIR}/external/perfetto BINARY_DIR
${PROJECT_BINARY_DIR}/external/build/perfetto-build SUBBUILD_DIR
${PROJECT_BINARY_DIR}/external/build/perfetto-subdir)
fetchcontent_getproperties(perfetto)
if(NOT perfetto_POPULATED)
fetchcontent_populate(perfetto)
endif()
add_library(rocprofiler-tests-perfetto STATIC)
add_library(rocprofiler::tests-perfetto ALIAS rocprofiler-tests-perfetto)
target_sources(
rocprofiler-tests-perfetto
PRIVATE ${PROJECT_BINARY_DIR}/external/perfetto/sdk/perfetto.h
${PROJECT_BINARY_DIR}/external/perfetto/sdk/perfetto.cc)
target_include_directories(
rocprofiler-tests-perfetto SYSTEM
INTERFACE $<BUILD_INTERFACE:${PROJECT_BINARY_DIR}/external/perfetto/sdk>)
set_target_properties(rocprofiler-tests-perfetto PROPERTIES POSITION_INDEPENDENT_CODE ON)
# common utilities
cmake_path(GET CMAKE_CURRENT_SOURCE_DIR PARENT_PATH COMMON_LIBRARY_INCLUDE_DIR)
add_library(rocprofiler-tests-common-library INTERFACE)
add_library(rocprofiler::tests-common-library ALIAS rocprofiler-tests-common-library)
target_link_libraries(rocprofiler-tests-common-library
INTERFACE rocprofiler::tests-build-flags rocprofiler::cereal)
target_compile_features(rocprofiler-tests-common-library INTERFACE cxx_std_17)
target_include_directories(rocprofiler-tests-common-library
INTERFACE ${COMMON_LIBRARY_INCLUDE_DIR})
set(EXTERNAL_SUBMODULE_DIR "${PROJECT_SOURCE_DIR}/../external")
cmake_path(ABSOLUTE_PATH EXTERNAL_SUBMODULE_DIR NORMALIZE)
if(EXISTS ${EXTERNAL_SUBMODULE_DIR}/filesystem/include/ghc/filesystem.hpp)
target_compile_definitions(
rocprofiler-tests-common-library
INTERFACE $<BUILD_INTERFACE:ROCPROFILER_SAMPLES_HAS_GHC_LIB_FILESYSTEM=1>)
target_include_directories(
rocprofiler-tests-common-library SYSTEM
INTERFACE $<BUILD_INTERFACE:${EXTERNAL_SUBMODULE_DIR}/filesystem/include>)
endif()