diff --git a/cmake/Modules/Findlibdw.cmake b/cmake/Modules/Findlibdw.cmake index 2f1dd63714..c0517a39db 100644 --- a/cmake/Modules/Findlibdw.cmake +++ b/cmake/Modules/Findlibdw.cmake @@ -30,13 +30,24 @@ if(PkgConfig_FOUND) if(DW_FOUND AND DW_INCLUDE_DIRS - AND DW_LIBRARIES) + AND DW_LINK_LIBRARIES) set(libdw_INCLUDE_DIR "${DW_INCLUDE_DIRS}" CACHE FILEPATH "libdw include directory") set(libdw_LIBRARY - "${DW_LIBRARIES}" + "${DW_LINK_LIBRARIES}" CACHE FILEPATH "libdw libraries") + if(DW_PREFIX) + set(libdw_ROOT_DIR + "${DW_PREFIX}" + CACHE FILEPATH "libdw root directory") + endif() + + if(DW_VERSION) + set(libdw_VERSION + "${DW_VERSION}" + CACHE FILEPATH "libdw version") + endif() endif() endif() @@ -70,13 +81,13 @@ find_package_handle_standard_args(libdw DEFAULT_MSG libdw_LIBRARY libdw_INCLUDE_ if(libdw_FOUND) if(NOT TARGET libdw::libdw) add_library(libdw::libdw INTERFACE IMPORTED) - endif() - if(TARGET PkgConfig::DW AND DW_FOUND) - target_link_libraries(libdw::libdw INTERFACE PkgConfig::DW) - else() - target_link_libraries(libdw::libdw INTERFACE ${libdw_LIBRARY}) - target_include_directories(libdw::libdw SYSTEM INTERFACE ${libdw_INCLUDE_DIR}) + if(TARGET PkgConfig::DW AND DW_FOUND) + target_link_libraries(libdw::libdw INTERFACE PkgConfig::DW) + else() + target_link_libraries(libdw::libdw INTERFACE ${libdw_LIBRARY}) + target_include_directories(libdw::libdw SYSTEM INTERFACE ${libdw_INCLUDE_DIR}) + endif() endif() endif() diff --git a/cmake/Templates/rocprofiler-sdk/config.cmake.in b/cmake/Templates/rocprofiler-sdk/config.cmake.in index 48013bb5f6..51ceaba334 100644 --- a/cmake/Templates/rocprofiler-sdk/config.cmake.in +++ b/cmake/Templates/rocprofiler-sdk/config.cmake.in @@ -129,6 +129,17 @@ else() endforeach() endif() + if(EXISTS ${@PACKAGE_NAME@_CMAKE_DIR}/Modules) + list(INSERT CMAKE_MODULE_PATH 0 ${@PACKAGE_NAME@_CMAKE_DIR}/Modules) + find_package(libdw) + list(REMOVE_AT CMAKE_MODULE_PATH 0) + endif() + + if(libdw_FOUND AND TARGET libdw::libdw) + rocprofiler_config_nolink_target(@PACKAGE_NAME@::@PACKAGE_NAME@-external-nolink + libdw::libdw) + endif() + target_link_libraries(@PACKAGE_NAME@::@PACKAGE_NAME@ INTERFACE @PACKAGE_NAME@::@PACKAGE_NAME@-external-nolink) endif() @@ -136,7 +147,8 @@ endif() add_executable(@PACKAGE_NAME@::rocprofv3 IMPORTED) set_property( TARGET @PACKAGE_NAME@::rocprofv3 - PROPERTY IMPORTED_LOCATION ${@PACKAGE_NAME@_ROOT_DIR}/@CMAKE_INSTALL_BINDIR@/rocprofv3) + PROPERTY IMPORTED_LOCATION + ${@PACKAGE_NAME@_ROOT_DIR}/@CMAKE_INSTALL_BINDIR@/rocprofv3) include(FindPackageHandleStandardArgs) find_package_handle_standard_args( @@ -155,4 +167,7 @@ endif() add_executable(@PACKAGE_NAME@::convert-counters-collection-format IMPORTED) set_property( TARGET @PACKAGE_NAME@::convert-counters-collection-format - PROPERTY IMPORTED_LOCATION ${@PACKAGE_NAME@_ROOT_DIR}/share/@PACKAGE_NAME@/convert-counters-collection-format.py) + PROPERTY + IMPORTED_LOCATION + ${@PACKAGE_NAME@_ROOT_DIR}/share/@PACKAGE_NAME@/convert-counters-collection-format.py + ) diff --git a/cmake/rocprofiler_config_install.cmake b/cmake/rocprofiler_config_install.cmake index 5b067e8957..f42d55873d 100644 --- a/cmake/rocprofiler_config_install.cmake +++ b/cmake/rocprofiler_config_install.cmake @@ -46,7 +46,8 @@ install( install( FILES ${PROJECT_SOURCE_DIR}/cmake/Modules/rocprofiler-sdk-custom-compilation.cmake - FILES ${PROJECT_SOURCE_DIR}/cmake/Modules/rocprofiler-sdk-utilities.cmake + ${PROJECT_SOURCE_DIR}/cmake/Modules/rocprofiler-sdk-utilities.cmake + ${PROJECT_SOURCE_DIR}/cmake/Modules/Findlibdw.cmake DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/${PACKAGE_NAME}/Modules COMPONENT development) @@ -94,7 +95,8 @@ configure_file( ${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_LIBDIR}/cmake/${PACKAGE_NAME}/${PACKAGE_NAME}-config-nolink-target.cmake COPYONLY) -foreach(_FILE rocprofiler-sdk-custom-compilation.cmake rocprofiler-sdk-utilities.cmake) +foreach(_FILE rocprofiler-sdk-custom-compilation.cmake rocprofiler-sdk-utilities.cmake + Findlibdw.cmake) configure_file( ${PROJECT_SOURCE_DIR}/cmake/Modules/${_FILE} ${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_LIBDIR}/cmake/${PACKAGE_NAME}/Modules/${_FILE} @@ -118,7 +120,7 @@ set(${PACKAGE_NAME}_BUILD_TREE ON CACHE BOOL "" FORCE) -set(PROJECT_BUILD_TREE_TARGETS headers shared-library build-flags stack-protector) +set(PROJECT_BUILD_TREE_TARGETS headers shared-library build-flags stack-protector dw) configure_file( ${PROJECT_SOURCE_DIR}/cmake/Templates/${PACKAGE_NAME}/build-config.cmake.in diff --git a/samples/code_object_isa_decode/CMakeLists.txt b/samples/code_object_isa_decode/CMakeLists.txt index f3ae85abfb..6b7afa49e6 100644 --- a/samples/code_object_isa_decode/CMakeLists.txt +++ b/samples/code_object_isa_decode/CMakeLists.txt @@ -25,63 +25,6 @@ foreach(_TYPE DEBUG MINSIZEREL RELEASE RELWITHDEBINFO) endif() endforeach() -find_package(PkgConfig) - -if(PkgConfig_FOUND) - set(ENV{PKG_CONFIG_SYSTEM_INCLUDE_PATH} "") - pkg_check_modules(DW libdw) - - if(DW_FOUND - AND DW_INCLUDE_DIRS - AND DW_LIBRARIES) - set(libdw_INCLUDE_DIR - "${DW_INCLUDE_DIRS}" - CACHE FILEPATH "libdw include directory") - set(libdw_LIBRARY - "${DW_LIBRARIES}" - CACHE FILEPATH "libdw libraries") - endif() -endif() - -if(NOT libdw_INCLUDE_DIR OR NOT libdw_LIBRARY) - find_path( - libdw_ROOT_DIR - NAMES include/elfutils/libdw.h - HINTS ${libdw_ROOT} - PATHS ${libdw_ROOT}) - - mark_as_advanced(libdw_ROOT_DIR) - - find_path( - libdw_INCLUDE_DIR - NAMES elfutils/libdw.h - HINTS ${libdw_ROOT} - PATHS ${libdw_ROOT} - PATH_SUFFIXES include) - - find_library( - libdw_LIBRARY - NAMES dw - HINTS ${libdw_ROOT} - PATHS ${libdw_ROOT} - PATH_SUFFIXES lib lib64) -endif() - -include(FindPackageHandleStandardArgs) -find_package_handle_standard_args(libdw DEFAULT_MSG libdw_LIBRARY libdw_INCLUDE_DIR) - -if(libdw_FOUND AND NOT TARGET libdw::libdw) - add_library(libdw::libdw INTERFACE IMPORTED) - if(TARGET PkgConfig::DW AND DW_FOUND) - target_link_libraries(libdw::libdw INTERFACE PkgConfig::DW) - else() - target_link_libraries(libdw::libdw INTERFACE ${libdw_LIBRARY}) - target_include_directories(libdw::libdw SYSTEM INTERFACE ${libdw_INCLUDE_DIR}) - endif() -endif() - -mark_as_advanced(libdw_INCLUDE_DIR libdw_LIBRARY) - find_package(rocprofiler-sdk REQUIRED) find_package( amd_comgr @@ -92,9 +35,7 @@ find_package( ${ROCM_PATH} PATHS ${rocm_version_DIR} - ${ROCM_PATH} - PATH_SUFFIXES - lib/cmake/amd_comgr) + ${ROCM_PATH}) set_source_files_properties(main.cpp PROPERTIES LANGUAGE HIP) set_source_files_properties(main.cpp PROPERTIES COMPILE_FLAGS "-g") diff --git a/samples/common/CMakeLists.txt b/samples/common/CMakeLists.txt index 363fbe3108..12e61616fb 100644 --- a/samples/common/CMakeLists.txt +++ b/samples/common/CMakeLists.txt @@ -2,62 +2,10 @@ # common utilities for samples # -find_package(PkgConfig) +find_package(rocprofiler-sdk REQUIRED) -if(PkgConfig_FOUND) - set(ENV{PKG_CONFIG_SYSTEM_INCLUDE_PATH} "") - pkg_check_modules(DW libdw) - - if(DW_FOUND - AND DW_INCLUDE_DIRS - AND DW_LIBRARIES) - set(libdw_INCLUDE_DIR - "${DW_INCLUDE_DIRS}" - CACHE FILEPATH "libdw include directory") - set(libdw_LIBRARY - "${DW_LIBRARIES}" - CACHE FILEPATH "libdw libraries") - endif() -endif() - -if(NOT libdw_INCLUDE_DIR OR NOT libdw_LIBRARY) - find_path( - libdw_ROOT_DIR - NAMES include/elfutils/libdw.h - HINTS ${libdw_ROOT} - PATHS ${libdw_ROOT}) - - mark_as_advanced(libdw_ROOT_DIR) - - find_path( - libdw_INCLUDE_DIR - NAMES elfutils/libdw.h - HINTS ${libdw_ROOT} - PATHS ${libdw_ROOT} - PATH_SUFFIXES include) - - find_library( - libdw_LIBRARY - NAMES dw - HINTS ${libdw_ROOT} - PATHS ${libdw_ROOT} - PATH_SUFFIXES lib lib64) -endif() - -include(FindPackageHandleStandardArgs) -find_package_handle_standard_args(libdw DEFAULT_MSG libdw_LIBRARY libdw_INCLUDE_DIR) - -if(libdw_FOUND AND NOT TARGET libdw::libdw) - add_library(libdw::libdw INTERFACE IMPORTED) - if(TARGET PkgConfig::DW AND DW_FOUND) - target_link_libraries(libdw::libdw INTERFACE PkgConfig::DW) - else() - target_link_libraries(libdw::libdw INTERFACE ${libdw_LIBRARY}) - target_include_directories(libdw::libdw SYSTEM INTERFACE ${libdw_INCLUDE_DIR}) - endif() -endif() - -mark_as_advanced(libdw_INCLUDE_DIR libdw_LIBRARY) +# rocprofiler-sdk provides a Findlibdw.cmake +find_package(libdw REQUIRED) # default FAIL_REGULAR_EXPRESSION for tests set(ROCPROFILER_DEFAULT_FAIL_REGEX diff --git a/source/lib/att-tool/tests/CMakeLists.txt b/source/lib/att-tool/tests/CMakeLists.txt index ed5555b8de..08755e0438 100644 --- a/source/lib/att-tool/tests/CMakeLists.txt +++ b/source/lib/att-tool/tests/CMakeLists.txt @@ -10,7 +10,8 @@ target_link_libraries( att-parser-tool-v3 PRIVATE rocprofiler-sdk::rocprofiler-sdk-att-parser rocprofiler-sdk::rocprofiler-sdk-json - rocprofiler-sdk::rocprofiler-sdk-common-library) + rocprofiler-sdk::rocprofiler-sdk-common-library + rocprofiler-sdk::rocprofiler-sdk-dw) add_executable(att-decoder-test) target_sources(att-decoder-test PRIVATE att_decoder_test.cpp) @@ -21,6 +22,7 @@ target_link_libraries( rocprofiler-sdk::rocprofiler-sdk-common-library rocprofiler-sdk::rocprofiler-sdk-glog rocprofiler-sdk::rocprofiler-sdk-static-library + rocprofiler-sdk::rocprofiler-sdk-dw GTest::gtest GTest::gtest_main) diff --git a/source/lib/output/CMakeLists.txt b/source/lib/output/CMakeLists.txt index 0946715971..a9a1c32030 100644 --- a/source/lib/output/CMakeLists.txt +++ b/source/lib/output/CMakeLists.txt @@ -61,4 +61,7 @@ target_link_libraries( rocprofiler-sdk::rocprofiler-sdk-common-library rocprofiler-sdk::rocprofiler-sdk-cereal rocprofiler-sdk::rocprofiler-sdk-perfetto - rocprofiler-sdk::rocprofiler-sdk-otf2) + rocprofiler-sdk::rocprofiler-sdk-otf2 + rocprofiler-sdk::rocprofiler-sdk-amd-comgr + rocprofiler-sdk::rocprofiler-sdk-dw + rocprofiler-sdk::rocprofiler-sdk-elf) diff --git a/source/lib/rocprofiler-sdk/CMakeLists.txt b/source/lib/rocprofiler-sdk/CMakeLists.txt index 880645a7c6..c4945d3914 100644 --- a/source/lib/rocprofiler-sdk/CMakeLists.txt +++ b/source/lib/rocprofiler-sdk/CMakeLists.txt @@ -70,7 +70,8 @@ target_link_libraries( rocprofiler-sdk::rocprofiler-sdk-amd-comgr rocprofiler-sdk::rocprofiler-sdk-hsa-aql rocprofiler-sdk::rocprofiler-sdk-drm - rocprofiler-sdk::rocprofiler-sdk-hsakmt-nolink) + rocprofiler-sdk::rocprofiler-sdk-hsakmt-nolink + rocprofiler-sdk::rocprofiler-sdk-dw) target_compile_definitions(rocprofiler-sdk-object-library PRIVATE rocprofiler_EXPORTS=1) @@ -140,6 +141,7 @@ target_link_libraries( PUBLIC rocprofiler-sdk::rocprofiler-sdk-headers rocprofiler-sdk::rocprofiler-sdk-hsa-runtime-nolink rocprofiler-sdk::rocprofiler-sdk-hip-nolink + $ PRIVATE rocprofiler-sdk::rocprofiler-sdk-common-library rocprofiler-sdk::rocprofiler-sdk-object-library) diff --git a/source/lib/rocprofiler-sdk/context/correlation_id.cpp b/source/lib/rocprofiler-sdk/context/correlation_id.cpp index 51d348f979..979cfb2386 100644 --- a/source/lib/rocprofiler-sdk/context/correlation_id.cpp +++ b/source/lib/rocprofiler-sdk/context/correlation_id.cpp @@ -26,6 +26,7 @@ #include "lib/common/utility.hpp" #include "lib/rocprofiler-sdk/buffer.hpp" #include "lib/rocprofiler-sdk/context/context.hpp" +#include "lib/rocprofiler-sdk/registration.hpp" #include @@ -63,7 +64,8 @@ correlation_id::add_ref_count() { auto _ret = m_ref_count.fetch_add(1); - ROCP_FATAL_IF(_ret == 0) << "correlation id already retired"; + ROCP_CI_LOG_IF(WARNING, _ret == 0) + << fmt::format("correlation id {} already retired", internal); return _ret; } @@ -71,9 +73,19 @@ correlation_id::add_ref_count() uint32_t correlation_id::sub_ref_count() { + if(m_ref_count == 0) + { + ROCP_CI_LOG(WARNING) << fmt::format( + "attempt to decrement correlation id {} reference count but reference count is zero", + internal); + return 0; + } + auto _ret = m_ref_count.fetch_sub(1); - ROCP_FATAL_IF(_ret == 0) << "correlation id underflow"; + if(registration::get_fini_status() > 0) return 0; + + ROCP_CI_LOG_IF(WARNING, _ret == 0) << fmt::format("correlation id underflow on {}", internal); if(_ret == 1) { @@ -101,7 +113,8 @@ correlation_id::sub_ref_count() ROCPROFILER_BUFFER_TRACING_CORRELATION_ID_RETIREMENT, record); - ROCP_FATAL_IF(!success) << "failed to emplace correlation id retirement"; + ROCP_CI_LOG_IF(WARNING, !success) + << fmt::format("failed to emplace correlation id retirement for {}", internal); } } } diff --git a/source/lib/rocprofiler-sdk/tests/agent.cpp b/source/lib/rocprofiler-sdk/tests/agent.cpp index af071307bb..60b1bc1afc 100644 --- a/source/lib/rocprofiler-sdk/tests/agent.cpp +++ b/source/lib/rocprofiler-sdk/tests/agent.cpp @@ -267,7 +267,7 @@ TEST(rocprofiler_lib, agent) EXPECT_EQ(agent->workgroup_max_dim.z, hsa_agent->workgroup_max_dim[2]) << msg; EXPECT_EQ(agent->grid_max_size, hsa_agent->grid_max_size) << msg; // Skip the checks for older grid x, y, z dimension values. - if(hsa_agent->grid_max_dim.x == std::numeric_limits::max()) + if(hsa_agent->grid_max_dim.x != std::numeric_limits::max()) { EXPECT_EQ(agent->grid_max_dim.x, hsa_agent->grid_max_dim.x) << msg; EXPECT_EQ(agent->grid_max_dim.y, hsa_agent->grid_max_dim.y) << msg; diff --git a/source/libexec/rocprofiler-sdk/rocprofiler-sdk-launch-compiler/rocprofiler-sdk-launch-compiler.sh b/source/libexec/rocprofiler-sdk/rocprofiler-sdk-launch-compiler/rocprofiler-sdk-launch-compiler.sh index 21e2a49d08..932bd5e351 100755 --- a/source/libexec/rocprofiler-sdk/rocprofiler-sdk-launch-compiler/rocprofiler-sdk-launch-compiler.sh +++ b/source/libexec/rocprofiler-sdk/rocprofiler-sdk-launch-compiler/rocprofiler-sdk-launch-compiler.sh @@ -1,3 +1,4 @@ +#!/bin/bash -e # MIT License # # Copyright (c) 2023-2025 Advanced Micro Devices, Inc. All rights reserved. @@ -20,7 +21,6 @@ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # SOFTWARE. -#!/bin/bash -e # # This script allows CMAKE_CXX_COMPILER to be a standard # C++ compiler and rocprofiler-sdk sets RULE_LAUNCH_COMPILE and diff --git a/source/scripts/run-ci.py b/source/scripts/run-ci.py index 77127a39a4..46b85ba48e 100755 --- a/source/scripts/run-ci.py +++ b/source/scripts/run-ci.py @@ -142,7 +142,12 @@ def generate_custom(args, cmake_args, ctest_args): ".*/counters/parser/.*", ] if args.coverage == "samples": - codecov_exclude += [".*/lib/common/.*", ".*/lib/rocprofiler-sdk-tool/.*"] + codecov_exclude += [ + ".*/lib/common/.*", + ".*/lib/output/.*", + ".*/lib/att-tool/.*", + ".*/lib/rocprofiler-sdk-tool/.*", + ] COVERAGE_EXCLUDE = ";".join(codecov_exclude) diff --git a/tests/bin/hsa-code-object/CMakeLists.txt b/tests/bin/hsa-code-object/CMakeLists.txt index 5b49e55e77..2e11314509 100644 --- a/tests/bin/hsa-code-object/CMakeLists.txt +++ b/tests/bin/hsa-code-object/CMakeLists.txt @@ -77,19 +77,6 @@ target_compile_options(hsa_code_object_testapp PRIVATE -W -Wall -Wextra -Wshadow find_package(Threads REQUIRED) target_link_libraries(hsa_code_object_testapp PRIVATE stdc++fs Threads::Threads) -find_package( - amd_comgr - REQUIRED - CONFIG - HINTS - ${CMAKE_INSTALL_PREFIX} - PATHS - ${ROCM_PATH} - PATH_SUFFIXES - lib/cmake/amd_comgr) - -target_link_libraries(hsa_code_object_testapp PRIVATE amd_comgr) - find_package(rocprofiler-sdk REQUIRED) target_link_libraries( hsa_code_object_testapp PRIVATE rocprofiler-sdk::rocprofiler-sdk diff --git a/tests/bin/hsa-queue-dependency/CMakeLists.txt b/tests/bin/hsa-queue-dependency/CMakeLists.txt index 992381501c..6753da98f2 100644 --- a/tests/bin/hsa-queue-dependency/CMakeLists.txt +++ b/tests/bin/hsa-queue-dependency/CMakeLists.txt @@ -54,19 +54,6 @@ target_compile_options(multiqueue_testapp PRIVATE -W -Wall -Wextra -Wshadow -Wer find_package(Threads REQUIRED) target_link_libraries(multiqueue_testapp PRIVATE stdc++fs Threads::Threads) -find_package( - amd_comgr - REQUIRED - CONFIG - HINTS - ${CMAKE_INSTALL_PREFIX} - PATHS - ${ROCM_PATH} - PATH_SUFFIXES - lib/cmake/amd_comgr) - -target_link_libraries(multiqueue_testapp PRIVATE amd_comgr) - find_package(rocprofiler-sdk REQUIRED) target_link_libraries(multiqueue_testapp PRIVATE rocprofiler-sdk::rocprofiler-sdk rocprofiler-sdk::tests-common-library) diff --git a/tests/common/CMakeLists.txt b/tests/common/CMakeLists.txt index 0238dca333..dba1347c73 100644 --- a/tests/common/CMakeLists.txt +++ b/tests/common/CMakeLists.txt @@ -42,6 +42,11 @@ if(CMAKE_VERSION VERSION_GREATER_EQUAL 3.30) cmake_policy(SET CMP0167 NEW) endif() +find_package(rocprofiler-sdk REQUIRED) + +# rocprofiler-sdk provides a Findlibdw.cmake +find_package(libdw REQUIRED) + # build flags add_library(rocprofiler-sdk-tests-build-flags INTERFACE) add_library(rocprofiler-sdk::tests-build-flags ALIAS rocprofiler-sdk-tests-build-flags) @@ -138,7 +143,8 @@ add_library(rocprofiler-sdk::tests-common-library ALIAS rocprofiler-sdk-tests-common-library) target_link_libraries( rocprofiler-sdk-tests-common-library - INTERFACE rocprofiler-sdk::tests-build-flags rocprofiler-sdk::rocprofiler-sdk-cereal) + INTERFACE rocprofiler-sdk::tests-build-flags rocprofiler-sdk::rocprofiler-sdk-cereal + libdw::libdw) target_compile_features(rocprofiler-sdk-tests-common-library INTERFACE cxx_std_17) target_include_directories(rocprofiler-sdk-tests-common-library INTERFACE ${COMMON_LIBRARY_INCLUDE_DIR}) diff --git a/tests/pc_sampling/CMakeLists.txt b/tests/pc_sampling/CMakeLists.txt index 3ab060b00a..fa8e85ba36 100644 --- a/tests/pc_sampling/CMakeLists.txt +++ b/tests/pc_sampling/CMakeLists.txt @@ -27,61 +27,6 @@ endforeach() find_package(rocprofiler-sdk REQUIRED) -find_package(PkgConfig) - -if(PkgConfig_FOUND) - set(ENV{PKG_CONFIG_SYSTEM_INCLUDE_PATH} "") - pkg_check_modules(DW libdw) - - if(DW_FOUND - AND DW_INCLUDE_DIRS - AND DW_LIBRARIES) - set(libdw_INCLUDE_DIR - "${DW_INCLUDE_DIRS}" - CACHE FILEPATH "libdw include directory") - set(libdw_LIBRARY - "${DW_LIBRARIES}" - CACHE FILEPATH "libdw libraries") - endif() -endif() - -if(NOT libdw_INCLUDE_DIR OR NOT libdw_LIBRARY) - find_path( - libdw_ROOT_DIR - NAMES include/elfutils/libdw.h - HINTS ${libdw_ROOT} - PATHS ${libdw_ROOT}) - - mark_as_advanced(libdw_ROOT_DIR) - - find_path( - libdw_INCLUDE_DIR - NAMES elfutils/libdw.h - HINTS ${libdw_ROOT} - PATHS ${libdw_ROOT} - PATH_SUFFIXES include) - - find_library( - libdw_LIBRARY - NAMES dw - HINTS ${libdw_ROOT} - PATHS ${libdw_ROOT} - PATH_SUFFIXES lib lib64) -endif() - -include(FindPackageHandleStandardArgs) -find_package_handle_standard_args(libdw DEFAULT_MSG libdw_LIBRARY libdw_INCLUDE_DIR) - -if(libdw_FOUND AND NOT TARGET libdw::libdw) - add_library(libdw::libdw INTERFACE IMPORTED) - if(TARGET PkgConfig::DW AND DW_FOUND) - target_link_libraries(libdw::libdw INTERFACE PkgConfig::DW) - else() - target_link_libraries(libdw::libdw INTERFACE ${libdw_LIBRARY}) - target_include_directories(libdw::libdw SYSTEM INTERFACE ${libdw_INCLUDE_DIR}) - endif() -endif() - add_library(pc-sampling-integration-test-client SHARED) target_sources( pc-sampling-integration-test-client @@ -104,7 +49,7 @@ target_sources( target_link_libraries( pc-sampling-integration-test-client PRIVATE rocprofiler-sdk::rocprofiler-sdk rocprofiler-sdk::tests-build-flags - rocprofiler-sdk::tests-common-library amd_comgr dw) + rocprofiler-sdk::tests-common-library) set_source_files_properties(main.cpp PROPERTIES LANGUAGE HIP) find_package(Threads REQUIRED) diff --git a/tests/pytest-packages/pc_sampling/transpose_multiple_agents/csv.py b/tests/pytest-packages/pc_sampling/transpose_multiple_agents/csv.py index 4ea09ba546..d0f17d2612 100644 --- a/tests/pytest-packages/pc_sampling/transpose_multiple_agents/csv.py +++ b/tests/pytest-packages/pc_sampling/transpose_multiple_agents/csv.py @@ -1,3 +1,4 @@ +#!/usr/bin/env python3 # MIT License # # Copyright (c) 2023 Advanced Micro Devices, Inc. All rights reserved. @@ -20,11 +21,8 @@ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # SOFTWARE. - from __future__ import absolute_import -#!/usr/bin/env python3 - import itertools import sys import pytest diff --git a/tests/rocjpeg/conftest.py b/tests/rocjpeg/conftest.py index 17b4f1b7fb..b6c5f91ec5 100644 --- a/tests/rocjpeg/conftest.py +++ b/tests/rocjpeg/conftest.py @@ -1,3 +1,4 @@ +#!/usr/bin/env python3 # MIT License # # Copyright (c) 2023-2025 Advanced Micro Devices, Inc. All rights reserved. @@ -20,8 +21,6 @@ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # SOFTWARE. -#!/usr/bin/env python3 - import json import os import pytest diff --git a/tests/rocjpeg/validate.py b/tests/rocjpeg/validate.py index 47b600605f..dbf6a3bd65 100644 --- a/tests/rocjpeg/validate.py +++ b/tests/rocjpeg/validate.py @@ -1,3 +1,4 @@ +#!/usr/bin/env python3 # MIT License # # Copyright (c) 2023-2025 Advanced Micro Devices, Inc. All rights reserved. @@ -20,8 +21,6 @@ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # SOFTWARE. -#!/usr/bin/env python3 - import sys import pytest diff --git a/tests/rocprofv3/advanced-thread-trace/conftest.py b/tests/rocprofv3/advanced-thread-trace/conftest.py index d471820034..6b05e3e307 100644 --- a/tests/rocprofv3/advanced-thread-trace/conftest.py +++ b/tests/rocprofv3/advanced-thread-trace/conftest.py @@ -1,3 +1,4 @@ +#!/usr/bin/env python3 # MIT License # # Copyright (c) 2023-2025 Advanced Micro Devices, Inc. All rights reserved. @@ -20,8 +21,6 @@ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # SOFTWARE. -#!/usr/bin/env python3 - import csv import pytest import json diff --git a/tests/rocprofv3/advanced-thread-trace/validate.py b/tests/rocprofv3/advanced-thread-trace/validate.py index 3b41a679ce..f969082133 100644 --- a/tests/rocprofv3/advanced-thread-trace/validate.py +++ b/tests/rocprofv3/advanced-thread-trace/validate.py @@ -1,3 +1,4 @@ +#!/usr/bin/env python3 # MIT License # # Copyright (c) 2023-2025 Advanced Micro Devices, Inc. All rights reserved. @@ -20,7 +21,6 @@ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # SOFTWARE. -#!/usr/bin/env python3 import sys import pytest diff --git a/tests/rocprofv3/hip-stream-display/conftest.py b/tests/rocprofv3/hip-stream-display/conftest.py index 9f8f87d5df..291719c398 100644 --- a/tests/rocprofv3/hip-stream-display/conftest.py +++ b/tests/rocprofv3/hip-stream-display/conftest.py @@ -1,3 +1,4 @@ +#!/usr/bin/env python3 # MIT License # # Copyright (c) 2023-2025 Advanced Micro Devices, Inc. All rights reserved. @@ -20,7 +21,6 @@ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # SOFTWARE. -#!/usr/bin/env python3 import csv import json diff --git a/tests/rocprofv3/hip-stream-display/validate.py b/tests/rocprofv3/hip-stream-display/validate.py index c8bda13022..c84c9303e2 100644 --- a/tests/rocprofv3/hip-stream-display/validate.py +++ b/tests/rocprofv3/hip-stream-display/validate.py @@ -1,3 +1,4 @@ +#!/usr/bin/env python3 # MIT License # # Copyright (c) 2023-2025 Advanced Micro Devices, Inc. All rights reserved. @@ -20,7 +21,6 @@ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # SOFTWARE. -#!/usr/bin/env python3 import sys import pytest diff --git a/tests/rocprofv3/pc-sampling/stochastic/exec-mask-manipulation/conftest.py b/tests/rocprofv3/pc-sampling/stochastic/exec-mask-manipulation/conftest.py index 1cd98e396f..e76b594fc7 100644 --- a/tests/rocprofv3/pc-sampling/stochastic/exec-mask-manipulation/conftest.py +++ b/tests/rocprofv3/pc-sampling/stochastic/exec-mask-manipulation/conftest.py @@ -1,3 +1,4 @@ +#!/usr/bin/env python3 # MIT License # # Copyright (c) 2023-2025 Advanced Micro Devices, Inc. All rights reserved. @@ -20,7 +21,6 @@ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # SOFTWARE. -#!/usr/bin/env python3 import json import os diff --git a/tests/rocprofv3/pc-sampling/stochastic/exec-mask-manipulation/validate.py b/tests/rocprofv3/pc-sampling/stochastic/exec-mask-manipulation/validate.py index a6dd4d6a01..2d9100c63d 100644 --- a/tests/rocprofv3/pc-sampling/stochastic/exec-mask-manipulation/validate.py +++ b/tests/rocprofv3/pc-sampling/stochastic/exec-mask-manipulation/validate.py @@ -1,3 +1,4 @@ +#!/usr/bin/env python3 # MIT License # # Copyright (c) 2023-2025 Advanced Micro Devices, Inc. All rights reserved. @@ -20,7 +21,6 @@ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # SOFTWARE. -#!/usr/bin/env python3 import sys import pytest diff --git a/tests/rocprofv3/pc-sampling/stochastic/transpose-multiple-agents/conftest.py b/tests/rocprofv3/pc-sampling/stochastic/transpose-multiple-agents/conftest.py index 92d4db6148..7472a41c13 100644 --- a/tests/rocprofv3/pc-sampling/stochastic/transpose-multiple-agents/conftest.py +++ b/tests/rocprofv3/pc-sampling/stochastic/transpose-multiple-agents/conftest.py @@ -1,3 +1,4 @@ +#!/usr/bin/env python3 # MIT License # # Copyright (c) 2023-2025 Advanced Micro Devices, Inc. All rights reserved. @@ -20,7 +21,6 @@ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # SOFTWARE. -#!/usr/bin/env python3 import json import os diff --git a/tests/rocprofv3/pc-sampling/stochastic/transpose-multiple-agents/validate.py b/tests/rocprofv3/pc-sampling/stochastic/transpose-multiple-agents/validate.py index 6cadbc9dbf..3c8e2cecac 100644 --- a/tests/rocprofv3/pc-sampling/stochastic/transpose-multiple-agents/validate.py +++ b/tests/rocprofv3/pc-sampling/stochastic/transpose-multiple-agents/validate.py @@ -1,3 +1,4 @@ +#!/usr/bin/env python3 # MIT License # # Copyright (c) 2023-2025 Advanced Micro Devices, Inc. All rights reserved. @@ -20,7 +21,6 @@ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # SOFTWARE. -#!/usr/bin/env python3 import itertools import sys diff --git a/tests/rocprofv3/rocjpeg-trace/conftest.py b/tests/rocprofv3/rocjpeg-trace/conftest.py index 32b8f22007..090ba671fc 100644 --- a/tests/rocprofv3/rocjpeg-trace/conftest.py +++ b/tests/rocprofv3/rocjpeg-trace/conftest.py @@ -1,3 +1,4 @@ +#!/usr/bin/env python3 # MIT License # # Copyright (c) 2023-2025 Advanced Micro Devices, Inc. All rights reserved. @@ -20,7 +21,6 @@ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # SOFTWARE. -#!/usr/bin/env python3 import csv import json diff --git a/tests/rocprofv3/rocjpeg-trace/validate.py b/tests/rocprofv3/rocjpeg-trace/validate.py index 624a6fb286..16659056a3 100755 --- a/tests/rocprofv3/rocjpeg-trace/validate.py +++ b/tests/rocprofv3/rocjpeg-trace/validate.py @@ -1,3 +1,4 @@ +#!/usr/bin/env python3 # MIT License # # Copyright (c) 2023-2025 Advanced Micro Devices, Inc. All rights reserved. @@ -20,7 +21,6 @@ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # SOFTWARE. -#!/usr/bin/env python3 import sys import pytest diff --git a/tests/thread-trace/CMakeLists.txt b/tests/thread-trace/CMakeLists.txt index 697112ab43..6bf784e5ba 100644 --- a/tests/thread-trace/CMakeLists.txt +++ b/tests/thread-trace/CMakeLists.txt @@ -22,74 +22,7 @@ project( LANGUAGES CXX HIP VERSION 0.0.0) -find_package(PkgConfig) - -if(PkgConfig_FOUND) - set(ENV{PKG_CONFIG_SYSTEM_INCLUDE_PATH} "") - pkg_check_modules(DW libdw) - - if(DW_FOUND - AND DW_INCLUDE_DIRS - AND DW_LIBRARIES) - set(libdw_INCLUDE_DIR - "${DW_INCLUDE_DIRS}" - CACHE FILEPATH "libdw include directory") - set(libdw_LIBRARY - "${DW_LIBRARIES}" - CACHE FILEPATH "libdw libraries") - endif() -endif() - -if(NOT libdw_INCLUDE_DIR OR NOT libdw_LIBRARY) - find_path( - libdw_ROOT_DIR - NAMES include/elfutils/libdw.h - HINTS ${libdw_ROOT} - PATHS ${libdw_ROOT}) - - mark_as_advanced(libdw_ROOT_DIR) - - find_path( - libdw_INCLUDE_DIR - NAMES elfutils/libdw.h - HINTS ${libdw_ROOT} - PATHS ${libdw_ROOT} - PATH_SUFFIXES include) - - find_library( - libdw_LIBRARY - NAMES dw - HINTS ${libdw_ROOT} - PATHS ${libdw_ROOT} - PATH_SUFFIXES lib lib64) -endif() - -include(FindPackageHandleStandardArgs) -find_package_handle_standard_args(libdw DEFAULT_MSG libdw_LIBRARY libdw_INCLUDE_DIR) - -if(libdw_FOUND AND NOT TARGET libdw::libdw) - add_library(libdw::libdw INTERFACE IMPORTED) - if(TARGET PkgConfig::DW AND DW_FOUND) - target_link_libraries(libdw::libdw INTERFACE PkgConfig::DW) - else() - target_link_libraries(libdw::libdw INTERFACE ${libdw_LIBRARY}) - target_include_directories(libdw::libdw SYSTEM INTERFACE ${libdw_INCLUDE_DIR}) - endif() -endif() - find_package(rocprofiler-sdk REQUIRED) -find_package( - amd_comgr - REQUIRED - CONFIG - HINTS - ${rocm_version_DIR} - ${ROCM_PATH} - PATHS - ${rocm_version_DIR} - ${ROCM_PATH} - PATH_SUFFIXES - lib/cmake/amd_comgr) set(CMAKE_CXX_STANDARD 17) set(CMAKE_CXX_EXTENSIONS OFF) @@ -104,10 +37,9 @@ foreach(_TYPE DEBUG MINSIZEREL RELEASE RELWITHDEBINFO) endif() endforeach() -set_source_files_properties(kernel_branch.cpp PROPERTIES COMPILE_FLAGS "-g -O2") -set_source_files_properties(kernel_branch.cpp PROPERTIES LANGUAGE HIP) -set_source_files_properties(kernel_lds.cpp PROPERTIES COMPILE_FLAGS "-g -O2") -set_source_files_properties(kernel_lds.cpp PROPERTIES LANGUAGE HIP) +set_source_files_properties( + kernel_branch.cpp kernel_lds.cpp + PROPERTIES LANGUAGE HIP COMPILE_FLAGS "${CMAKE_HIP_FLAGS_RELWITHDEBINFO}") set_source_files_properties(main.cpp PROPERTIES LANGUAGE HIP) # Single dispatch test @@ -115,8 +47,10 @@ add_executable(thread-trace-api-single-test) target_sources( thread-trace-api-single-test PRIVATE main.cpp trace_callbacks.cpp single_dispatch.cpp kernel_branch.cpp kernel_lds.cpp) -target_link_libraries(thread-trace-api-single-test - PRIVATE rocprofiler-sdk::rocprofiler-sdk) +target_link_libraries( + thread-trace-api-single-test + PRIVATE rocprofiler-sdk::rocprofiler-sdk rocprofiler-sdk::tests-build-flags + rocprofiler-sdk::tests-common-library) add_test(NAME thread-trace-api-single-test COMMAND $) @@ -132,8 +66,10 @@ add_executable(thread-trace-api-multi-test) target_sources( thread-trace-api-multi-test PRIVATE main.cpp trace_callbacks.cpp multi_dispatch.cpp kernel_branch.cpp kernel_lds.cpp) -target_link_libraries(thread-trace-api-multi-test - PRIVATE rocprofiler-sdk::rocprofiler-sdk) +target_link_libraries( + thread-trace-api-multi-test + PRIVATE rocprofiler-sdk::rocprofiler-sdk rocprofiler-sdk::tests-build-flags + rocprofiler-sdk::tests-common-library) add_test(NAME thread-trace-api-multi-test COMMAND $) @@ -148,8 +84,10 @@ set_tests_properties( add_executable(thread-trace-api-agent-test) target_sources(thread-trace-api-agent-test PRIVATE main.cpp trace_callbacks.cpp agent.cpp kernel_branch.cpp kernel_lds.cpp) -target_link_libraries(thread-trace-api-agent-test - PRIVATE rocprofiler-sdk::rocprofiler-sdk) +target_link_libraries( + thread-trace-api-agent-test + PRIVATE rocprofiler-sdk::rocprofiler-sdk rocprofiler-sdk::tests-build-flags + rocprofiler-sdk::tests-common-library) add_test(NAME thread-trace-api-agent-test COMMAND $) diff --git a/tests/thread-trace/main.cpp b/tests/thread-trace/main.cpp index 41eb2c5211..e85b752e0b 100644 --- a/tests/thread-trace/main.cpp +++ b/tests/thread-trace/main.cpp @@ -63,7 +63,7 @@ public: }; int -main(int argc, char** argv) +main(int /*argc*/, char** /*argv*/) { hipMemory src1(DATA_SIZE); hipMemory src2(DATA_SIZE);