From e8c7e6bfba831bda5d328268a09a94713fffc880 Mon Sep 17 00:00:00 2001 From: "Jonathan R. Madsen" Date: Wed, 17 Jan 2024 01:27:41 -0600 Subject: [PATCH] ROCTx Library (#360) * Initial implementation of roctx library * Update include/roctx/CMakeLists.txt - fix installation * Update cmake/rocprofiler_config_packaging.cmake - add rocprofiler-sdk-roctx installer * Update include/roctx/CMakeLists.txt - include api_trace.h in installation * Update include/roctx/api_trace.h - add ROCTX_API_TABLE_VERSION_MAJOR define - add ROCTX_API_TABLE_VERSION_STEP define * Update lib/roctx/roctx.cpp - static asserts for table size and struct member offsets * Update external/CMakeLists.txt - move BUILD_SHARED_LIBS to top - disable libunwind for glog * Update lib/roctx/CMakeLists.txt - Update {BUILD,INSTALL}_RPATH * Relocate include/roctx to include/rocprofiler-sdk/roctx * Relocate lib/roctx to lib/rocprofiler-sdk-roctx - change the name of the library from libroctx to librocprofiler-sdk-roctx * Move lib/plugins to lib/rocprofiler-sdk-tool/plugins - also change install export group * Update lib/rocprofiler-sdk/CMakeLists.txt - change rocprofiler-shared-library EXPORT group (rocprofiler-sdk-library-targets -> rocprofiler-sdk-targets) * Update cmake/rocprofiler_utilities.cmake - change install EXPORT group - rocprofiler-sdk-library-targets -> rocprofiler-sdk-targets * Update CMakeLists.txt - set PACKAGE_NAME at high level - include(rocprofiler_config_install_roctx) * Update cmake/rocprofiler_config_install* and cmake/Templates/*.cmake.in - added rocprofiler_config_install_roctx.cmake for installing roctx as a package - reorganization of existing cmake/Templates/*-config.cmake.in files - created new config.cmake.in and build-config.cmake.in for rocprofiler-sdk-roctx * Relocate include/rocprofiler-sdk/roctx to include/rocprofiler-sdk-roctx * Update rocprofiler_config_install_roctx.cmake * Update lib/rocprofiler-sdk-roctx/roctx.cpp - update include paths * Update lib/rocprofiler-sdk-roctx/CMakeLists.txt - change target name to have rocprofiler-sdk- prefix - interface target_include_directories - define export symbol * source formatting (clang-format v11) (#361) Co-authored-by: jrmadsen * Update include/rocprofiler-sdk/fwd.h - fix doxygen markup for ROCPROFILER_STATUS_ERROR_CONTEXT_ERROR * Update modulefile and setup-env.sh * Update cmake/Templates/rocprofiler-sdk/config.cmake.in - fix inclusion of rocprofiler-sdk-targets.cmake * Update include/rocprofiler-sdk-roctx - add types.h for typedefs - add doxygen comments for roctx.h - add roctxGetThreadId function - roctxProfilerStart and roctxProfilerStop accept thread ID param * Update lib/rocprofiler-sdk-roctx/roctx.cpp - hsa_agent_t* -> hsa_agent_s* * Update lib/rocprofiler-sdk-roctx/roctx.cpp - support for roctxGetThreadId - update signatures of roctxProfilerPause and roctxProfilerResume * Update lib/rocprofiler-sdk-roctx/roctx.cpp - Initialize logging with ROCTX_LOG_LEVEL * Update include/rocprofiler-sdk-roctx/roctx.h - remove ROCTX_NONNULL for ihipStream_t parameter in roctxNameHipStream because default stream is a nullptr --------- Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> [ROCm/rocprofiler-sdk commit: 1edd4891b21bec67d5a05fbe1442d4fac47cda52] --- projects/rocprofiler-sdk/CMakeLists.txt | 2 + .../cmake/Templates/modulefile.in | 6 +- .../Templates/rocprofiler-sdk-config.cmake.in | 144 --------- .../build-config.cmake.in | 9 + .../rocprofiler-sdk-roctx/config.cmake.in | 75 +++++ .../build-config.cmake.in} | 14 +- .../Templates/rocprofiler-sdk/config.cmake.in | 144 +++++++++ .../cmake/Templates/setup-env.sh.in | 2 +- .../cmake/rocprofiler_config_install.cmake | 59 ++-- .../rocprofiler_config_install_roctx.cmake | 96 ++++++ .../cmake/rocprofiler_config_packaging.cmake | 49 ++- .../cmake/rocprofiler_utilities.cmake | 2 +- .../rocprofiler-sdk/external/CMakeLists.txt | 4 +- .../source/include/CMakeLists.txt | 1 + .../rocprofiler-sdk-roctx/CMakeLists.txt | 18 ++ .../include/rocprofiler-sdk-roctx/api_trace.h | 69 +++++ .../include/rocprofiler-sdk-roctx/defines.h | 116 ++++++++ .../include/rocprofiler-sdk-roctx/roctx.h | 256 ++++++++++++++++ .../include/rocprofiler-sdk-roctx/types.h | 56 ++++ .../rocprofiler-sdk-roctx/version.h.in | 109 +++++++ .../source/include/rocprofiler-sdk/fwd.h | 2 +- .../rocprofiler-sdk/source/lib/CMakeLists.txt | 2 +- .../lib/rocprofiler-sdk-roctx/CMakeLists.txt | 38 +++ .../lib/rocprofiler-sdk-roctx/roctx.cpp | 281 ++++++++++++++++++ .../lib/rocprofiler-sdk-tool/CMakeLists.txt | 5 +- .../plugins/CMakeLists.txt | 0 .../source/lib/rocprofiler-sdk/CMakeLists.txt | 2 +- 27 files changed, 1341 insertions(+), 220 deletions(-) delete mode 100644 projects/rocprofiler-sdk/cmake/Templates/rocprofiler-sdk-config.cmake.in create mode 100644 projects/rocprofiler-sdk/cmake/Templates/rocprofiler-sdk-roctx/build-config.cmake.in create mode 100644 projects/rocprofiler-sdk/cmake/Templates/rocprofiler-sdk-roctx/config.cmake.in rename projects/rocprofiler-sdk/cmake/Templates/{rocprofiler-sdk-build-config.cmake.in => rocprofiler-sdk/build-config.cmake.in} (58%) create mode 100644 projects/rocprofiler-sdk/cmake/Templates/rocprofiler-sdk/config.cmake.in create mode 100644 projects/rocprofiler-sdk/cmake/rocprofiler_config_install_roctx.cmake create mode 100644 projects/rocprofiler-sdk/source/include/rocprofiler-sdk-roctx/CMakeLists.txt create mode 100644 projects/rocprofiler-sdk/source/include/rocprofiler-sdk-roctx/api_trace.h create mode 100644 projects/rocprofiler-sdk/source/include/rocprofiler-sdk-roctx/defines.h create mode 100644 projects/rocprofiler-sdk/source/include/rocprofiler-sdk-roctx/roctx.h create mode 100644 projects/rocprofiler-sdk/source/include/rocprofiler-sdk-roctx/types.h create mode 100644 projects/rocprofiler-sdk/source/include/rocprofiler-sdk-roctx/version.h.in create mode 100644 projects/rocprofiler-sdk/source/lib/rocprofiler-sdk-roctx/CMakeLists.txt create mode 100644 projects/rocprofiler-sdk/source/lib/rocprofiler-sdk-roctx/roctx.cpp rename projects/rocprofiler-sdk/source/lib/{ => rocprofiler-sdk-tool}/plugins/CMakeLists.txt (100%) diff --git a/projects/rocprofiler-sdk/CMakeLists.txt b/projects/rocprofiler-sdk/CMakeLists.txt index aaecff8d60..02f4903d0d 100644 --- a/projects/rocprofiler-sdk/CMakeLists.txt +++ b/projects/rocprofiler-sdk/CMakeLists.txt @@ -31,6 +31,7 @@ project( HOMEPAGE_URL "https://github.com/ROCm/rocprofiler-sdk-internal") set(CMAKE_INSTALL_DEFAULT_COMPONENT_NAME "core") +set(PACKAGE_NAME ${PROJECT_NAME}-sdk) find_package(Git) @@ -100,6 +101,7 @@ add_subdirectory(external) add_subdirectory(source) include(rocprofiler_config_install) +include(rocprofiler_config_install_roctx) if(ROCPROFILER_BUILD_TESTS) add_subdirectory(tests) diff --git a/projects/rocprofiler-sdk/cmake/Templates/modulefile.in b/projects/rocprofiler-sdk/cmake/Templates/modulefile.in index 656746f0e4..b855165913 100644 --- a/projects/rocprofiler-sdk/cmake/Templates/modulefile.in +++ b/projects/rocprofiler-sdk/cmake/Templates/modulefile.in @@ -1,9 +1,9 @@ #%Module1.0 -module-whatis "@PROJECT_NAME@-sdk (version @PROJECT_VERSION@)" +module-whatis "@PACKAGE_NAME@ (version @PROJECT_VERSION@)" proc ModulesHelp { } { -puts stderr "Loads @PROJECT_NAME@-sdk v@PROJECT_VERSION@" +puts stderr "Loads @PACKAGE_NAME@ v@PROJECT_VERSION@" } set ROOT [file normalize [file dirname [file normalize ${ModulesCurrentModulefile}]]/../../..] @@ -13,4 +13,4 @@ prepend-path CMAKE_PREFIX_PATH "${ROOT}" prepend-path PATH "${ROOT}/bin" prepend-path LD_LIBRARY_PATH "${ROOT}/@CMAKE_INSTALL_LIBDIR@" prepend-path PYTHONPATH "${ROOT}/@CMAKE_INSTALL_PYTHONDIR@" -setenv @PROJECT_NAME@_DIR "${ROOT}/@CMAKE_INSTALL_DATAROOTDIR@/cmake/@PROJECT_NAME@-sdk" +setenv @PROJECT_NAME@_DIR "${ROOT}/@CMAKE_INSTALL_DATAROOTDIR@/cmake/@PACKAGE_NAME@" diff --git a/projects/rocprofiler-sdk/cmake/Templates/rocprofiler-sdk-config.cmake.in b/projects/rocprofiler-sdk/cmake/Templates/rocprofiler-sdk-config.cmake.in deleted file mode 100644 index 1bc2e153b2..0000000000 --- a/projects/rocprofiler-sdk/cmake/Templates/rocprofiler-sdk-config.cmake.in +++ /dev/null @@ -1,144 +0,0 @@ -# - Config file for @PROJECT_NAME@ and its component libraries -# It defines the following variables: -# -# @PROJECT_NAME@-sdk_VERSION -# @PROJECT_NAME@-sdk_INCLUDE_DIR -# @PROJECT_NAME@-sdk_LIB_DIR -# @PROJECT_NAME@-sdk_LIBRARIES -# -# It provides the following interface libraries: -# -# @PROJECT_NAME@::@PROJECT_NAME@ -# @PROJECT_NAME@-sdk::@PROJECT_NAME@-sdk -# - -# compute paths -get_filename_component(@PROJECT_NAME@-sdk_CMAKE_DIR "${CMAKE_CURRENT_LIST_FILE}" PATH) - -# version -set(@PROJECT_NAME@-sdk_VERSION @PROJECT_VERSION@) - -@PACKAGE_INIT@ - -set_and_check(@PROJECT_NAME@-sdk_INCLUDE_DIR "@PACKAGE_INCLUDE_INSTALL_DIR@") -set_and_check(@PROJECT_NAME@-sdk_LIB_DIR "@PACKAGE_LIB_INSTALL_DIR@") -get_filename_component(@PROJECT_NAME@-sdk_ROOT_DIR ${@PROJECT_NAME@-sdk_INCLUDE_DIR} PATH) - -# extra validation -set_and_check(@PROJECT_NAME@_INCLUDE_ROCPROFILER_SDK_DIR - "@PACKAGE_INCLUDE_INSTALL_DIR@/@PROJECT_NAME@-sdk") -set_and_check(@PROJECT_NAME@_LIB_ROCPROFILER_SDK_DIR - "@PACKAGE_LIB_INSTALL_DIR@/@PROJECT_NAME@-sdk") - -set(@PROJECT_NAME@-sdk_LIBRARIES) - -# add interface library -add_library(@PROJECT_NAME@::@PROJECT_NAME@ INTERFACE IMPORTED) -add_library(@PROJECT_NAME@-sdk::@PROJECT_NAME@-sdk ALIAS @PROJECT_NAME@::@PROJECT_NAME@) - -target_include_directories(@PROJECT_NAME@::@PROJECT_NAME@ - INTERFACE "${@PROJECT_NAME@-sdk_INCLUDE_DIR}") -target_link_directories(@PROJECT_NAME@::@PROJECT_NAME@ INTERFACE - "${@PROJECT_NAME@-sdk_LIB_DIR}") - -if(@PROJECT_NAME@_BUILD_TREE - AND EXISTS "${CMAKE_CURRENT_LIST_DIR}/@PROJECT_NAME@-sdk-build-config.cmake") - include("${CMAKE_CURRENT_LIST_DIR}/@PROJECT_NAME@-sdk-build-config.cmake") -else() - find_package( - AMDDeviceLibs - REQUIRED - CONFIG - HINTS - @AMDDeviceLibs_DIR@ - @rocm_version_DIR@ - PATHS - @AMDDeviceLibs_DIR@ - @rocm_version_DIR@) - - find_package( - amd_comgr - @amd_comgr_VERSION@ - EXACT - REQUIRED - CONFIG - HINTS - @amd_comgr_DIR@ - @rocm_version_DIR@ - PATHS - @amd_comgr_DIR@ - @rocm_version_DIR@) - - find_package( - hsa-runtime64 - @hsa-runtime64_VERSION@ - EXACT - REQUIRED - CONFIG - HINTS - @hsa-runtime64_DIR@ - @rocm_version_DIR@ - PATHS - @hsa-runtime64_DIR@ - @rocm_version_DIR@) - - find_package( - hip - @hip_VERSION@ - EXACT - REQUIRED - CONFIG - HINTS - @hip_DIR@ - @rocm_version_DIR@ - PATHS - @hip_DIR@ - @rocm_version_DIR@) - - include( - "${@PROJECT_NAME@-sdk_CMAKE_DIR}/@PROJECT_NAME@-sdk-config-nolink-target.cmake") - - add_library(@PROJECT_NAME@-sdk::@PROJECT_NAME@-sdk-external-nolink INTERFACE IMPORTED) - - include("${@PROJECT_NAME@-sdk_CMAKE_DIR}/@PROJECT_NAME@-sdk-library-targets.cmake") - - @PROJECT_NAME@_config_nolink_target(@PROJECT_NAME@-sdk::@PROJECT_NAME@-sdk-external-nolink hip::host) - @PROJECT_NAME@_config_nolink_target(@PROJECT_NAME@-sdk::@PROJECT_NAME@-sdk-external-nolink hsa-runtime64::hsa-runtime64) - @PROJECT_NAME@_config_nolink_target(@PROJECT_NAME@-sdk::@PROJECT_NAME@-sdk-external-nolink amd_comgr) - - # Library dependencies - foreach(TARG @PROJECT_BUILD_TARGETS@) - set(TARG @PROJECT_NAME@::@PROJECT_NAME@-${TARG}) - if(NOT @PROJECT_NAME@_FIND_COMPONENTS) - list(APPEND @PROJECT_NAME@-sdk_LIBRARIES ${TARG}) - target_link_libraries(@PROJECT_NAME@::@PROJECT_NAME@ INTERFACE ${TARG}) - endif() - endforeach() - - if(@PROJECT_NAME@_FIND_COMPONENTS) - foreach(COMP ${@PROJECT_NAME@_FIND_COMPONENTS}) - set(TARG @PROJECT_NAME@::${COMP}) - if(TARGET ${TARG}) - set(@PROJECT_NAME@-sdk_${COMP}_FOUND 1) - list(APPEND @PROJECT_NAME@-sdk_LIBRARIES ${TARG}) - target_link_libraries(@PROJECT_NAME@::@PROJECT_NAME@ INTERFACE ${TARG}) - else() - set(@PROJECT_NAME@-sdk_${COMP}_FOUND 0) - endif() - endforeach() - endif() - - target_link_libraries( - @PROJECT_NAME@::@PROJECT_NAME@ - INTERFACE @PROJECT_NAME@-sdk::@PROJECT_NAME@-sdk-external-nolink) -endif() - -include(FindPackageHandleStandardArgs) -find_package_handle_standard_args( - @PROJECT_NAME@-sdk - FOUND_VAR @PROJECT_NAME@-sdk_FOUND - VERSION_VAR @PROJECT_NAME@-sdk_VERSION - REQUIRED_VARS - @PROJECT_NAME@-sdk_ROOT_DIR @PROJECT_NAME@-sdk_INCLUDE_DIR - @PROJECT_NAME@-sdk_LIB_DIR @PROJECT_NAME@-sdk_LIBRARIES @PROJECT_NAME@-sdk_VERSION - HANDLE_COMPONENTS HANDLE_VERSION_RANGE) diff --git a/projects/rocprofiler-sdk/cmake/Templates/rocprofiler-sdk-roctx/build-config.cmake.in b/projects/rocprofiler-sdk/cmake/Templates/rocprofiler-sdk-roctx/build-config.cmake.in new file mode 100644 index 0000000000..a914160cb4 --- /dev/null +++ b/projects/rocprofiler-sdk/cmake/Templates/rocprofiler-sdk-roctx/build-config.cmake.in @@ -0,0 +1,9 @@ +# Config file for @PACKAGE_NAME@ and its component libraries in the build tree +# + +list(APPEND @PACKAGE_NAME@_INCLUDE_DIR @CMAKE_BINARY_DIR@/source/include) + +foreach(COMP @PROJECT_BUILD_TREE_TARGETS@) + list(APPEND @PACKAGE_NAME@_LIBRARIES ${COMP}) + target_link_libraries(@PACKAGE_NAME@::@PACKAGE_NAME@ INTERFACE ${COMP}) +endforeach() diff --git a/projects/rocprofiler-sdk/cmake/Templates/rocprofiler-sdk-roctx/config.cmake.in b/projects/rocprofiler-sdk/cmake/Templates/rocprofiler-sdk-roctx/config.cmake.in new file mode 100644 index 0000000000..26483d63b4 --- /dev/null +++ b/projects/rocprofiler-sdk/cmake/Templates/rocprofiler-sdk-roctx/config.cmake.in @@ -0,0 +1,75 @@ +# - Config file for @PACKAGE_NAME@ and its component libraries +# It defines the following variables: +# +# @PACKAGE_NAME@_VERSION +# @PACKAGE_NAME@_INCLUDE_DIR +# @PACKAGE_NAME@_LIB_DIR +# @PACKAGE_NAME@_LIBRARIES +# +# It provides the following interface libraries: +# +# @PACKAGE_NAME@::@PACKAGE_NAME@ +# + +# compute paths +get_filename_component(@PACKAGE_NAME@_CMAKE_DIR "${CMAKE_CURRENT_LIST_FILE}" PATH) + +# version +set(@PACKAGE_NAME@_VERSION @PROJECT_VERSION@) + +@PACKAGE_INIT@ + +set_and_check(@PACKAGE_NAME@_INCLUDE_DIR "@PACKAGE_INCLUDE_INSTALL_DIR@") +set_and_check(@PACKAGE_NAME@_LIB_DIR "@PACKAGE_LIB_INSTALL_DIR@") +get_filename_component(@PACKAGE_NAME@_ROOT_DIR ${@PACKAGE_NAME@_INCLUDE_DIR} PATH) +set_and_check(@PACKAGE_NAME@_ROOT "${@PACKAGE_NAME@_ROOT_DIR}") + +# extra validation +foreach(_@PACKAGE_NAME@_SUBDIR @PROJECT_EXTRA_DIRS@) + set_and_check(_@PACKAGE_NAME@_SUBDIR_CHECK + "${PACKAGE_PREFIX_DIR}/${_@PACKAGE_NAME@_SUBDIR}") + unset(_@PACKAGE_NAME@_SUBDIR_CHECK) +endforeach() + +set(@PACKAGE_NAME@_LIBRARIES) + +# add interface library +add_library(@PACKAGE_NAME@::@PACKAGE_NAME@ INTERFACE IMPORTED) + +if(@PACKAGE_NAME@_BUILD_TREE + AND EXISTS "${CMAKE_CURRENT_LIST_DIR}/@PACKAGE_NAME@-build-config.cmake") + include("${CMAKE_CURRENT_LIST_DIR}/@PACKAGE_NAME@-build-config.cmake") +else() + include("${@PACKAGE_NAME@_CMAKE_DIR}/@PACKAGE_NAME@-targets.cmake") + + # Library dependencies + foreach(TARG @PROJECT_BUILD_TARGETS@) + set(TARG @PACKAGE_NAME@::@PACKAGE_NAME@-${TARG}) + if(NOT @PACKAGE_NAME@_FIND_COMPONENTS) + list(APPEND @PACKAGE_NAME@_LIBRARIES ${TARG}) + target_link_libraries(@PACKAGE_NAME@::@PACKAGE_NAME@ INTERFACE ${TARG}) + endif() + endforeach() + + if(@PACKAGE_NAME@_FIND_COMPONENTS) + foreach(COMP ${@PACKAGE_NAME@_FIND_COMPONENTS}) + set(TARG @PACKAGE_NAME@::${COMP}) + if(TARGET ${TARG}) + set(@PACKAGE_NAME@_${COMP}_FOUND 1) + list(APPEND @PACKAGE_NAME@_LIBRARIES ${TARG}) + target_link_libraries(@PACKAGE_NAME@::@PACKAGE_NAME@ INTERFACE ${TARG}) + else() + set(@PACKAGE_NAME@_${COMP}_FOUND 0) + endif() + endforeach() + endif() +endif() + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args( + @PACKAGE_NAME@ + FOUND_VAR @PACKAGE_NAME@_FOUND + VERSION_VAR @PACKAGE_NAME@_VERSION + REQUIRED_VARS @PACKAGE_NAME@_ROOT_DIR @PACKAGE_NAME@_INCLUDE_DIR + @PACKAGE_NAME@_LIB_DIR @PACKAGE_NAME@_LIBRARIES @PACKAGE_NAME@_VERSION + HANDLE_COMPONENTS HANDLE_VERSION_RANGE) diff --git a/projects/rocprofiler-sdk/cmake/Templates/rocprofiler-sdk-build-config.cmake.in b/projects/rocprofiler-sdk/cmake/Templates/rocprofiler-sdk/build-config.cmake.in similarity index 58% rename from projects/rocprofiler-sdk/cmake/Templates/rocprofiler-sdk-build-config.cmake.in rename to projects/rocprofiler-sdk/cmake/Templates/rocprofiler-sdk/build-config.cmake.in index 484609d631..b13aeb667d 100644 --- a/projects/rocprofiler-sdk/cmake/Templates/rocprofiler-sdk-build-config.cmake.in +++ b/projects/rocprofiler-sdk/cmake/Templates/rocprofiler-sdk/build-config.cmake.in @@ -1,25 +1,25 @@ # Config file for @PROJECT_NAME@ and its component libraries in the build tree # -if(@PROJECT_NAME@_FIND_COMPONENTS) - foreach(COMP ${@PROJECT_NAME@-sdk_FIND_COMPONENTS}) +if(@PACKAGE_NAME@_FIND_COMPONENTS) + foreach(COMP ${@PACKAGE_NAME@_FIND_COMPONENTS}) set(TARG @PROJECT_NAME@::@PROJECT_NAME@-${COMP}) if(TARGET ${TARG}) - set(@PROJECT_NAME@-sdk_${COMP}_FOUND 1) - list(APPEND @PROJECT_NAME@-sdk_LIBRARIES ${TARG}) + set(@PACKAGE_NAME@_${COMP}_FOUND 1) + list(APPEND @PACKAGE_NAME@_LIBRARIES ${TARG}) target_link_libraries(@PROJECT_NAME@::@PROJECT_NAME@ INTERFACE ${TARG}) else() - set(@PROJECT_NAME@-sdk_${COMP}_FOUND 0) + set(@PACKAGE_NAME@_${COMP}_FOUND 0) endif() endforeach() else() - set(@PROJECT_NAME@-sdk_LIBRARIES @PROJECT_NAME@::@PROJECT_NAME@) + set(@PACKAGE_NAME@_LIBRARIES @PROJECT_NAME@::@PROJECT_NAME@) endif() foreach(COMP @PROJECT_BUILD_TREE_TARGETS@) set(TARG @PROJECT_NAME@::@PROJECT_NAME@-${COMP}) if(TARGET ${TARG}) - list(APPEND @PROJECT_NAME@-sdk_LIBRARIES ${TARG}) + list(APPEND @PACKAGE_NAME@_LIBRARIES ${TARG}) target_link_libraries(@PROJECT_NAME@::@PROJECT_NAME@ INTERFACE ${TARG}) endif() endforeach() diff --git a/projects/rocprofiler-sdk/cmake/Templates/rocprofiler-sdk/config.cmake.in b/projects/rocprofiler-sdk/cmake/Templates/rocprofiler-sdk/config.cmake.in new file mode 100644 index 0000000000..d89d799d92 --- /dev/null +++ b/projects/rocprofiler-sdk/cmake/Templates/rocprofiler-sdk/config.cmake.in @@ -0,0 +1,144 @@ +# - Config file for @PACKAGE_NAME@ and its component libraries +# It defines the following variables: +# +# @PACKAGE_NAME@_VERSION +# @PACKAGE_NAME@_INCLUDE_DIR +# @PACKAGE_NAME@_LIB_DIR +# @PACKAGE_NAME@_LIBRARIES +# +# It provides the following interface libraries: +# +# @PROJECT_NAME@::@PROJECT_NAME@ +# @PACKAGE_NAME@::@PACKAGE_NAME@ +# + +# compute paths +get_filename_component(@PACKAGE_NAME@_CMAKE_DIR "${CMAKE_CURRENT_LIST_FILE}" PATH) + +# version +set(@PACKAGE_NAME@_VERSION @PROJECT_VERSION@) + +@PACKAGE_INIT@ + +set_and_check(@PACKAGE_NAME@_INCLUDE_DIR "@PACKAGE_INCLUDE_INSTALL_DIR@") +set_and_check(@PACKAGE_NAME@_LIB_DIR "@PACKAGE_LIB_INSTALL_DIR@") +get_filename_component(@PACKAGE_NAME@_ROOT_DIR ${@PACKAGE_NAME@_INCLUDE_DIR} PATH) + +# extra validation +foreach(_@PACKAGE_NAME@_SUBDIR @PROJECT_EXTRA_DIRS@) + set_and_check(_@PACKAGE_NAME@_SUBDIR_CHECK + "${PACKAGE_PREFIX_DIR}/${_@PACKAGE_NAME@_SUBDIR}") + unset(_@PACKAGE_NAME@_SUBDIR_CHECK) +endforeach() + +set(@PACKAGE_NAME@_LIBRARIES) + +# add interface library +add_library(@PROJECT_NAME@::@PROJECT_NAME@ INTERFACE IMPORTED) +add_library(@PACKAGE_NAME@::@PACKAGE_NAME@ ALIAS @PROJECT_NAME@::@PROJECT_NAME@) + +target_include_directories(@PROJECT_NAME@::@PROJECT_NAME@ + INTERFACE "${@PACKAGE_NAME@_INCLUDE_DIR}") +target_link_directories(@PROJECT_NAME@::@PROJECT_NAME@ INTERFACE + "${@PACKAGE_NAME@_LIB_DIR}") + +if(@PACKAGE_NAME@_BUILD_TREE + AND EXISTS "${CMAKE_CURRENT_LIST_DIR}/@PACKAGE_NAME@-build-config.cmake") + include("${CMAKE_CURRENT_LIST_DIR}/@PACKAGE_NAME@-build-config.cmake") +else() + find_package( + AMDDeviceLibs + REQUIRED + CONFIG + HINTS + @AMDDeviceLibs_DIR@ + @rocm_version_DIR@ + PATHS + @AMDDeviceLibs_DIR@ + @rocm_version_DIR@) + + find_package( + amd_comgr + @amd_comgr_VERSION@ + EXACT + REQUIRED + CONFIG + HINTS + @amd_comgr_DIR@ + @rocm_version_DIR@ + PATHS + @amd_comgr_DIR@ + @rocm_version_DIR@) + + find_package( + hsa-runtime64 + @hsa-runtime64_VERSION@ + EXACT + REQUIRED + CONFIG + HINTS + @hsa-runtime64_DIR@ + @rocm_version_DIR@ + PATHS + @hsa-runtime64_DIR@ + @rocm_version_DIR@) + + find_package( + hip + @hip_VERSION@ + EXACT + REQUIRED + CONFIG + HINTS + @hip_DIR@ + @rocm_version_DIR@ + PATHS + @hip_DIR@ + @rocm_version_DIR@) + + include( + "${@PACKAGE_NAME@_CMAKE_DIR}/@PACKAGE_NAME@-config-nolink-target.cmake") + + add_library(@PACKAGE_NAME@::@PACKAGE_NAME@-external-nolink INTERFACE IMPORTED) + + include("${@PACKAGE_NAME@_CMAKE_DIR}/@PACKAGE_NAME@-targets.cmake") + + @PROJECT_NAME@_config_nolink_target(@PACKAGE_NAME@::@PACKAGE_NAME@-external-nolink hip::host) + @PROJECT_NAME@_config_nolink_target(@PACKAGE_NAME@::@PACKAGE_NAME@-external-nolink hsa-runtime64::hsa-runtime64) + @PROJECT_NAME@_config_nolink_target(@PACKAGE_NAME@::@PACKAGE_NAME@-external-nolink amd_comgr) + + # Library dependencies + foreach(TARG @PROJECT_BUILD_TARGETS@) + set(TARG @PROJECT_NAME@::@PROJECT_NAME@-${TARG}) + if(NOT @PACKAGE_NAME@_FIND_COMPONENTS) + list(APPEND @PACKAGE_NAME@_LIBRARIES ${TARG}) + target_link_libraries(@PROJECT_NAME@::@PROJECT_NAME@ INTERFACE ${TARG}) + endif() + endforeach() + + if(@PACKAGE_NAME@_FIND_COMPONENTS) + foreach(COMP ${@PACKAGE_NAME@_FIND_COMPONENTS}) + set(TARG @PROJECT_NAME@::${COMP}) + if(TARGET ${TARG}) + set(@PACKAGE_NAME@_${COMP}_FOUND 1) + list(APPEND @PACKAGE_NAME@_LIBRARIES ${TARG}) + target_link_libraries(@PROJECT_NAME@::@PROJECT_NAME@ INTERFACE ${TARG}) + else() + set(@PACKAGE_NAME@_${COMP}_FOUND 0) + endif() + endforeach() + endif() + + target_link_libraries( + @PROJECT_NAME@::@PROJECT_NAME@ + INTERFACE @PACKAGE_NAME@::@PACKAGE_NAME@-external-nolink) +endif() + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args( + @PACKAGE_NAME@ + FOUND_VAR @PACKAGE_NAME@_FOUND + VERSION_VAR @PACKAGE_NAME@_VERSION + REQUIRED_VARS @PACKAGE_NAME@_ROOT_DIR @PACKAGE_NAME@_INCLUDE_DIR + @PACKAGE_NAME@_LIB_DIR @PACKAGE_NAME@_LIBRARIES @PACKAGE_NAME@_VERSION + HANDLE_COMPONENTS HANDLE_VERSION_RANGE) diff --git a/projects/rocprofiler-sdk/cmake/Templates/setup-env.sh.in b/projects/rocprofiler-sdk/cmake/Templates/setup-env.sh.in index 12c594ef3c..beb8c126f2 100644 --- a/projects/rocprofiler-sdk/cmake/Templates/setup-env.sh.in +++ b/projects/rocprofiler-sdk/cmake/Templates/setup-env.sh.in @@ -13,7 +13,7 @@ PATH=${BASEDIR}/bin:${PATH} LD_LIBRARY_PATH=${BASEDIR}/@CMAKE_INSTALL_LIBDIR@:${LD_LIBRARY_PATH} PYTHONPATH=${BASEDIR}/@CMAKE_INSTALL_PYTHONDIR@:${PYTHONPATH} CMAKE_PREFIX_PATH=${BASEDIR}:${CMAKE_PREFIX_PATH} -@PROJECT_NAME@_DIR=${BASEDIR}/@CMAKE_INSTALL_DATAROOTDIR@/cmake/@PROJECT_NAME@-sdk +@PROJECT_NAME@_DIR=${BASEDIR}/@CMAKE_INSTALL_DATAROOTDIR@/cmake/@PACKAGE_NAME@ export @PROJECT_NAME@_ROOT export PATH diff --git a/projects/rocprofiler-sdk/cmake/rocprofiler_config_install.cmake b/projects/rocprofiler-sdk/cmake/rocprofiler_config_install.cmake index fc2c4a32ce..55da945b45 100644 --- a/projects/rocprofiler-sdk/cmake/rocprofiler_config_install.cmake +++ b/projects/rocprofiler-sdk/cmake/rocprofiler_config_install.cmake @@ -3,23 +3,23 @@ include_guard(GLOBAL) include(CMakePackageConfigHelpers) -set(CMAKE_INSTALL_DEFAULT_COMPONENT_NAME config) +set(CMAKE_INSTALL_DEFAULT_COMPONENT_NAME development) install( DIRECTORY ${PROJECT_SOURCE_DIR}/samples - DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/${PROJECT_NAME}-sdk + DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/${PACKAGE_NAME} COMPONENT samples) install( DIRECTORY ${PROJECT_SOURCE_DIR}/tests - DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/${PROJECT_NAME}-sdk + DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/${PACKAGE_NAME} COMPONENT tests) install( - EXPORT rocprofiler-sdk-library-targets - FILE rocprofiler-sdk-library-targets.cmake - NAMESPACE rocprofiler:: - DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/cmake/${PROJECT_NAME}-sdk + EXPORT ${PACKAGE_NAME}-targets + FILE ${PACKAGE_NAME}-targets.cmake + NAMESPACE ${PROJECT_NAME}:: + DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/cmake/${PACKAGE_NAME} COMPONENT development) # ------------------------------------------------------------------------------# @@ -29,16 +29,18 @@ set(PROJECT_INSTALL_DIR ${CMAKE_INSTALL_PREFIX}) set(INCLUDE_INSTALL_DIR ${CMAKE_INSTALL_INCLUDEDIR}) set(LIB_INSTALL_DIR ${CMAKE_INSTALL_LIBDIR}) set(PROJECT_BUILD_TARGETS headers shared-library) +set(PROJECT_EXTRA_DIRS "${CMAKE_INSTALL_INCLUDEDIR}/${PACKAGE_NAME}" + "${CMAKE_INSTALL_LIBDIR}/${PACKAGE_NAME}") configure_package_config_file( - ${PROJECT_SOURCE_DIR}/cmake/Templates/${PROJECT_NAME}-sdk-config.cmake.in - ${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_DATAROOTDIR}/cmake/${PROJECT_NAME}-sdk/${PROJECT_NAME}-sdk-config.cmake - INSTALL_DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/cmake/rocprofiler-sdk + ${PROJECT_SOURCE_DIR}/cmake/Templates/${PACKAGE_NAME}/config.cmake.in + ${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_DATAROOTDIR}/cmake/${PACKAGE_NAME}/${PACKAGE_NAME}-config.cmake + INSTALL_DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/cmake/${PACKAGE_NAME} INSTALL_PREFIX ${CMAKE_INSTALL_PREFIX} PATH_VARS PROJECT_INSTALL_DIR INCLUDE_INSTALL_DIR LIB_INSTALL_DIR) write_basic_package_version_file( - ${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_DATAROOTDIR}/cmake/${PROJECT_NAME}-sdk/${PROJECT_NAME}-sdk-config-version.cmake + ${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_DATAROOTDIR}/cmake/${PACKAGE_NAME}/${PACKAGE_NAME}-config-version.cmake VERSION ${PROJECT_VERSION} COMPATIBILITY SameMinorVersion) @@ -49,10 +51,10 @@ configure_file( install( FILES - ${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_DATAROOTDIR}/cmake/${PROJECT_NAME}-sdk/${PROJECT_NAME}-sdk-config.cmake - ${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_DATAROOTDIR}/cmake/${PROJECT_NAME}-sdk/${PROJECT_NAME}-sdk-config-version.cmake - ${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_DATAROOTDIR}/cmake/${PROJECT_NAME}-sdk/${PROJECT_NAME}-sdk-config-nolink-target.cmake - DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/cmake/${PROJECT_NAME}-sdk + ${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_DATAROOTDIR}/cmake/${PACKAGE_NAME}/${PACKAGE_NAME}-config.cmake + ${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_DATAROOTDIR}/cmake/${PACKAGE_NAME}/${PACKAGE_NAME}-config-version.cmake + ${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_DATAROOTDIR}/cmake/${PACKAGE_NAME}/${PACKAGE_NAME}-config-nolink-target.cmake + DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/cmake/${PACKAGE_NAME} COMPONENT development) export(PACKAGE ${PROJECT_NAME}) @@ -60,22 +62,22 @@ export(PACKAGE ${PROJECT_NAME}) # ------------------------------------------------------------------------------# # build tree # -set(${PROJECT_NAME}_BUILD_TREE +set(${PACKAGE_NAME}_BUILD_TREE ON CACHE BOOL "" FORCE) set(PROJECT_BUILD_TREE_TARGETS headers shared-library build-flags stack-protector) configure_file( - ${PROJECT_SOURCE_DIR}/cmake/Templates/${PROJECT_NAME}-sdk-build-config.cmake.in - ${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_DATAROOTDIR}/cmake/${PROJECT_NAME}-sdk/${PROJECT_NAME}-sdk-build-config.cmake + ${PROJECT_SOURCE_DIR}/cmake/Templates/${PACKAGE_NAME}/build-config.cmake.in + ${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_DATAROOTDIR}/cmake/${PACKAGE_NAME}/${PACKAGE_NAME}-build-config.cmake @ONLY) file(RELATIVE_PATH rocp_bin2src_rel_path ${PROJECT_BINARY_DIR} ${PROJECT_SOURCE_DIR}) string(REPLACE "//" "/" rocp_inc_rel_path "${rocp_bin2src_rel_path}/source/include") set(_BUILDTREE_EXPORT_DIR - "${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_DATAROOTDIR}/cmake/${PROJECT_NAME}-sdk") + "${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_DATAROOTDIR}/cmake/${PACKAGE_NAME}") execute_process( COMMAND ${CMAKE_COMMAND} -E create_symlink ${rocp_inc_rel_path} @@ -85,24 +87,23 @@ if(NOT EXISTS "${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_LIBDIR}") file(MAKE_DIRECTORY "${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_LIBDIR}") endif() -if(NOT EXISTS "${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_LIBDIR}/${PROJECT_NAME}-sdk") - file(MAKE_DIRECTORY - "${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_LIBDIR}/${PROJECT_NAME}-sdk") +if(NOT EXISTS "${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_LIBDIR}/${PACKAGE_NAME}") + file(MAKE_DIRECTORY "${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_LIBDIR}/${PACKAGE_NAME}") endif() if(NOT EXISTS "${_BUILDTREE_EXPORT_DIR}") file(MAKE_DIRECTORY "${_BUILDTREE_EXPORT_DIR}") endif() -if(NOT EXISTS "${_BUILDTREE_EXPORT_DIR}/${PROJECT_NAME}-sdk-library-targets.cmake") - file(TOUCH "${_BUILDTREE_EXPORT_DIR}/${PROJECT_NAME}-sdk-library-targets.cmake") +if(NOT EXISTS "${_BUILDTREE_EXPORT_DIR}/${PACKAGE_NAME}-targets.cmake") + file(TOUCH "${_BUILDTREE_EXPORT_DIR}/${PACKAGE_NAME}-targets.cmake") endif() export( - EXPORT rocprofiler-sdk-library-targets - NAMESPACE rocprofiler:: - FILE "${_BUILDTREE_EXPORT_DIR}/${PROJECT_NAME}-sdk-library-targets.cmake") + EXPORT ${PACKAGE_NAME}-targets + NAMESPACE ${PROJECT_NAME}:: + FILE "${_BUILDTREE_EXPORT_DIR}/${PACKAGE_NAME}-targets.cmake") -set(rocprofiler-sdk_DIR +set(${PACKAGE_NAME}_DIR "${_BUILDTREE_EXPORT_DIR}" - CACHE PATH "rocprofiler" FORCE) + CACHE PATH "${PACKAGE_NAME} build tree install" FORCE) diff --git a/projects/rocprofiler-sdk/cmake/rocprofiler_config_install_roctx.cmake b/projects/rocprofiler-sdk/cmake/rocprofiler_config_install_roctx.cmake new file mode 100644 index 0000000000..a338cbf580 --- /dev/null +++ b/projects/rocprofiler-sdk/cmake/rocprofiler_config_install_roctx.cmake @@ -0,0 +1,96 @@ +# include guard +include_guard(GLOBAL) + +include(CMakePackageConfigHelpers) + +set(CMAKE_INSTALL_DEFAULT_COMPONENT_NAME roctx) +set(PACKAGE_NAME "rocprofiler-sdk-roctx") + +install( + EXPORT ${PACKAGE_NAME}-targets + FILE ${PACKAGE_NAME}-targets.cmake + NAMESPACE ${PACKAGE_NAME}:: + DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/cmake/${PACKAGE_NAME} + COMPONENT roctx) + +# ------------------------------------------------------------------------------# +# install tree +# +set(PROJECT_INSTALL_DIR ${CMAKE_INSTALL_PREFIX}) +set(INCLUDE_INSTALL_DIR ${CMAKE_INSTALL_INCLUDEDIR}) +set(LIB_INSTALL_DIR ${CMAKE_INSTALL_LIBDIR}) +set(PROJECT_BUILD_TARGETS ${PACKAGE_NAME}-shared-library) +set(PROJECT_EXTRA_DIRS "${CMAKE_INSTALL_INCLUDEDIR}/${PROJECT_NAME}-sdk-roctx") + +configure_package_config_file( + ${PROJECT_SOURCE_DIR}/cmake/Templates/${PACKAGE_NAME}/config.cmake.in + ${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_DATAROOTDIR}/cmake/${PACKAGE_NAME}/${PACKAGE_NAME}-config.cmake + INSTALL_DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/cmake/${PACKAGE_NAME} + INSTALL_PREFIX ${CMAKE_INSTALL_PREFIX} + PATH_VARS PROJECT_INSTALL_DIR INCLUDE_INSTALL_DIR LIB_INSTALL_DIR) + +write_basic_package_version_file( + ${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_DATAROOTDIR}/cmake/${PACKAGE_NAME}/${PACKAGE_NAME}-config-version.cmake + VERSION ${PROJECT_VERSION} + COMPATIBILITY SameMinorVersion) + +install( + FILES + ${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_DATAROOTDIR}/cmake/${PACKAGE_NAME}/${PACKAGE_NAME}-config.cmake + ${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_DATAROOTDIR}/cmake/${PACKAGE_NAME}/${PACKAGE_NAME}-config-version.cmake + DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/cmake/${PACKAGE_NAME} + COMPONENT roctx) + +export(PACKAGE ${PACKAGE_NAME}) + +# ------------------------------------------------------------------------------# +# build tree +# +set(${PACKAGE_NAME}_BUILD_TREE + ON + CACHE BOOL "" FORCE) + +set(PROJECT_BUILD_TREE_TARGETS + ${PROJECT_NAME}::${PACKAGE_NAME}-shared-library + ${PROJECT_NAME}::${PROJECT_NAME}-headers ${PROJECT_NAME}::${PROJECT_NAME}-build-flags + ${PROJECT_NAME}::${PROJECT_NAME}-stack-protector) + +configure_file( + ${PROJECT_SOURCE_DIR}/cmake/Templates/${PACKAGE_NAME}/build-config.cmake.in + ${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_DATAROOTDIR}/cmake/${PACKAGE_NAME}/${PACKAGE_NAME}-build-config.cmake + @ONLY) + +file(RELATIVE_PATH rocp_bin2src_rel_path ${PROJECT_BINARY_DIR} ${PROJECT_SOURCE_DIR}) +string(REPLACE "//" "/" rocp_inc_rel_path "${rocp_bin2src_rel_path}/source/include") + +set(_BUILDTREE_EXPORT_DIR + "${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_DATAROOTDIR}/cmake/${PACKAGE_NAME}") + +execute_process( + COMMAND ${CMAKE_COMMAND} -E create_symlink ${rocp_inc_rel_path} + ${PROJECT_BINARY_DIR}/include WORKING_DIRECTORY ${PROJECT_BINARY_DIR}) + +if(NOT EXISTS "${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_LIBDIR}") + file(MAKE_DIRECTORY "${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_LIBDIR}") +endif() + +if(NOT EXISTS "${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_LIBDIR}/${PACKAGE_NAME}") + file(MAKE_DIRECTORY "${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_LIBDIR}/${PACKAGE_NAME}") +endif() + +if(NOT EXISTS "${_BUILDTREE_EXPORT_DIR}") + file(MAKE_DIRECTORY "${_BUILDTREE_EXPORT_DIR}") +endif() + +if(NOT EXISTS "${_BUILDTREE_EXPORT_DIR}/${PACKAGE_NAME}-targets.cmake") + file(TOUCH "${_BUILDTREE_EXPORT_DIR}/${PACKAGE_NAME}-targets.cmake") +endif() + +export( + EXPORT ${PACKAGE_NAME}-targets + NAMESPACE ${PACKAGE_NAME}:: + FILE "${_BUILDTREE_EXPORT_DIR}/${PACKAGE_NAME}-targets.cmake") + +set(${PACKAGE_NAME}_DIR + "${_BUILDTREE_EXPORT_DIR}" + CACHE PATH "${PACKAGE_NAME} build tree install" FORCE) diff --git a/projects/rocprofiler-sdk/cmake/rocprofiler_config_packaging.cmake b/projects/rocprofiler-sdk/cmake/rocprofiler_config_packaging.cmake index e3e1aaa023..4382a59b19 100644 --- a/projects/rocprofiler-sdk/cmake/rocprofiler_config_packaging.cmake +++ b/projects/rocprofiler-sdk/cmake/rocprofiler_config_packaging.cmake @@ -12,7 +12,9 @@ set(CPACK_PACKAGE_VERSION_PATCH "${PROJECT_VERSION_PATCH}") set(CPACK_PACKAGE_CONTACT "ROCm Profiler Support ") set(CPACK_RESOURCE_FILE_LICENSE "${PROJECT_SOURCE_DIR}/LICENSE") set(CPACK_INCLUDE_TOPLEVEL_DIRECTORY OFF) -set(CPACK_STRIP_FILES OFF) # eventually this should be set to ON +set(CPACK_STRIP_FILES + OFF + CACHE BOOL "") # eventually this should be set to ON set(ROCPROFILER_CPACK_SYSTEM_NAME "${CMAKE_SYSTEM_NAME}" CACHE STRING "System name, e.g. Linux or Ubuntu-18.04") @@ -37,54 +39,42 @@ list(REMOVE_ITEM ROCPROFILER_PACKAGING_COMPONENTS "Development" "Unspecified") list(LENGTH ROCPROFILER_PACKAGING_COMPONENTS NUM_ROCPROFILER_PACKAGING_COMPONENTS) # the packages we will generate -set(ROCPROFILER_COMPONENT_GROUPS "core" "tests" "docs") +set(ROCPROFILER_COMPONENT_GROUPS "core" "docs" "tests" "roctx") set(COMPONENT_GROUP_core_COMPONENTS "core" "development" "samples" "tools" "Development" "Unspecified") -set(COMPONENT_GROUP_tests_COMPONENTS "tests") set(COMPONENT_GROUP_docs_COMPONENTS "docs") +set(COMPONENT_GROUP_tests_COMPONENTS "tests") +set(COMPONENT_GROUP_roctx_COMPONENTS "roctx") # variables for each component group. Note: eventually we will probably want to separate # the core to just be the runtime libraries, development to be the headers and cmake # files, the samples to just be the samples, and tools just be the tool files but right # now we are just combining core, development, samples, and tools into one package -set(COMPONENT_NAME_core "") -set(COMPONENT_NAME_development "dev") -set(COMPONENT_NAME_samples "samples") -set(COMPONENT_NAME_tools "tools") -set(COMPONENT_NAME_tests "tests") -set(COMPONENT_NAME_docs "docs") - -set(COMPONENT_SEP_core "") -set(COMPONENT_SEP_development "-") -set(COMPONENT_SEP_samples "-") -set(COMPONENT_SEP_tools "-") -set(COMPONENT_SEP_tests "-") -set(COMPONENT_SEP_docs "-") +set(COMPONENT_NAME_core "rocprofiler-sdk") +set(COMPONENT_NAME_docs "rocprofiler-sdk-docs") +set(COMPONENT_NAME_tests "rocprofiler-sdk-tests") +set(COMPONENT_NAME_roctx "rocprofiler-sdk-roctx") set(COMPONENT_DEP_core "") -set(COMPONENT_DEP_development "rocprofiler-sdk") -set(COMPONENT_DEP_samples "rocprofiler-sdk") -set(COMPONENT_DEP_tools "rocprofiler-sdk") -set(COMPONENT_DEP_tests "rocprofiler-sdk") set(COMPONENT_DEP_docs "") +set(COMPONENT_DEP_tests "rocprofiler-sdk") +set(COMPONENT_DEP_roctx "") set(COMPONENT_DESC_core "rocprofiler-sdk libraries, headers, samples, and tools") -set(COMPONENT_DESC_development "rocprofiler-sdk development files") -set(COMPONENT_DESC_samples "rocprofiler-sdk samples") -set(COMPONENT_DESC_tools "rocprofiler-sdk tools") -set(COMPONENT_DESC_tests "rocprofiler-sdk tests") set(COMPONENT_DESC_docs "rocprofiler-sdk documentation") +set(COMPONENT_DESC_tests "rocprofiler-sdk tests") +set(COMPONENT_DESC_roctx "ROCm Tools Extension library and headers") -set(EXPECTED_PACKAGING_COMPONENTS 5) +set(EXPECTED_PACKAGING_COMPONENTS 6) if(ROCPROFILER_BUILD_DOCS) - set(EXPECTED_PACKAGING_COMPONENTS 6) + set(EXPECTED_PACKAGING_COMPONENTS 7) endif() if(NOT NUM_ROCPROFILER_PACKAGING_COMPONENTS EQUAL EXPECTED_PACKAGING_COMPONENTS) message( FATAL_ERROR - "Error new install component needs COMPONENT_NAME_* and COMPONENT_SEP_* entries" + "Error new install component needs COMPONENT_NAME_* and COMPONENT_SEP_* entries: ${ROCPROFILER_PACKAGING_COMPONENTS}" ) endif() @@ -97,7 +87,6 @@ else() endif() foreach(COMPONENT_GROUP ${ROCPROFILER_COMPONENT_GROUPS}) - set(_SEP "${COMPONENT_SEP_${COMPONENT_GROUP}}") set(_DEP "${COMPONENT_DEP_${COMPONENT_GROUP}}") set(_NAME "${COMPONENT_NAME_${COMPONENT_GROUP}}") set(_DESC "${COMPONENT_DESC_${COMPONENT_GROUP}}") @@ -112,9 +101,9 @@ foreach(COMPONENT_GROUP ${ROCPROFILER_COMPONENT_GROUPS}) endif() string(TOUPPER "${COMPONENT_GROUP}" UCOMPONENT) - set(CPACK_DEBIAN_${UCOMPONENT}_PACKAGE_NAME "${PROJECT_NAME}-sdk${_SEP}${_NAME}") + set(CPACK_DEBIAN_${UCOMPONENT}_PACKAGE_NAME "${_NAME}") set(CPACK_DEBIAN_${UCOMPONENT}_PACKAGE_DEPENDS "${_DEP}") - set(CPACK_RPM_${UCOMPONENT}_PACKAGE_NAME "${PROJECT_NAME}-sdk${_SEP}${_NAME}") + set(CPACK_RPM_${UCOMPONENT}_PACKAGE_NAME "${_NAME}") set(CPACK_RPM_${UCOMPONENT}_PACKAGE_REQUIRES "${_DEP}") foreach(COMPONENT ${COMPONENT_GROUP_${COMPONENT_GROUP}_COMPONENTS}) diff --git a/projects/rocprofiler-sdk/cmake/rocprofiler_utilities.cmake b/projects/rocprofiler-sdk/cmake/rocprofiler_utilities.cmake index bf930a275b..3aa5d2747b 100644 --- a/projects/rocprofiler-sdk/cmake/rocprofiler_utilities.cmake +++ b/projects/rocprofiler-sdk/cmake/rocprofiler_utilities.cmake @@ -364,7 +364,7 @@ function(ROCPROFILER_ADD_INTERFACE_LIBRARY _TARGET _DESCRIPT) TARGETS ${_TARGET} DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT core - EXPORT rocprofiler-sdk-library-targets + EXPORT rocprofiler-sdk-targets OPTIONAL) endif() endfunction() diff --git a/projects/rocprofiler-sdk/external/CMakeLists.txt b/projects/rocprofiler-sdk/external/CMakeLists.txt index cf61f07c18..6ef8798b39 100644 --- a/projects/rocprofiler-sdk/external/CMakeLists.txt +++ b/projects/rocprofiler-sdk/external/CMakeLists.txt @@ -6,6 +6,8 @@ include(rocprofiler_utilities) set(BUILD_TESTING OFF) +set(BUILD_SHARED_LIBS OFF) +set(CMAKE_POSITION_INDEPENDENT_CODE ON) # filesystem library if(ROCPROFILER_BUILD_GHC_FS) @@ -86,8 +88,8 @@ if(ROCPROFILER_BUILD_GLOG) # May want to use GFLAGS in the future set(WITH_GFLAGS OFF) - set(BUILD_SHARED_LIBS OFF) set(WITH_GTEST OFF) + set(WITH_UNWIND OFF) add_subdirectory(glog EXCLUDE_FROM_ALL) target_link_libraries(rocprofiler-glog INTERFACE $) diff --git a/projects/rocprofiler-sdk/source/include/CMakeLists.txt b/projects/rocprofiler-sdk/source/include/CMakeLists.txt index 30c49d5ae8..d0c7e1ba82 100644 --- a/projects/rocprofiler-sdk/source/include/CMakeLists.txt +++ b/projects/rocprofiler-sdk/source/include/CMakeLists.txt @@ -4,3 +4,4 @@ set(CMAKE_INSTALL_DEFAULT_COMPONENT_NAME "development") add_subdirectory(rocprofiler-sdk) +add_subdirectory(rocprofiler-sdk-roctx) diff --git a/projects/rocprofiler-sdk/source/include/rocprofiler-sdk-roctx/CMakeLists.txt b/projects/rocprofiler-sdk/source/include/rocprofiler-sdk-roctx/CMakeLists.txt new file mode 100644 index 0000000000..7a5caa2d77 --- /dev/null +++ b/projects/rocprofiler-sdk/source/include/rocprofiler-sdk-roctx/CMakeLists.txt @@ -0,0 +1,18 @@ +# +# +# Installation of public headers +# +# +configure_file(${CMAKE_CURRENT_LIST_DIR}/version.h.in + ${CMAKE_CURRENT_BINARY_DIR}/version.h @ONLY) + +set(ROCTX_HEADER_FILES + # core headers + roctx.h + # secondary headers + api_trace.h defines.h types.h ${CMAKE_CURRENT_BINARY_DIR}/version.h) + +install( + FILES ${ROCTX_HEADER_FILES} + DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/rocprofiler-sdk-roctx + COMPONENT roctx) diff --git a/projects/rocprofiler-sdk/source/include/rocprofiler-sdk-roctx/api_trace.h b/projects/rocprofiler-sdk/source/include/rocprofiler-sdk-roctx/api_trace.h new file mode 100644 index 0000000000..bf274c2e5a --- /dev/null +++ b/projects/rocprofiler-sdk/source/include/rocprofiler-sdk-roctx/api_trace.h @@ -0,0 +1,69 @@ +// MIT License +// +// Copyright (c) 2023 Advanced Micro Devices, Inc. All rights reserved. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in all +// copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// SOFTWARE. + +#pragma once + +#include "rocprofiler-sdk-roctx/defines.h" +#include "rocprofiler-sdk-roctx/types.h" +#include "rocprofiler-sdk-roctx/version.h" + +#include +#include +#include + +ROCTX_EXTERN_C_INIT + +#define ROCTX_API_TABLE_VERSION_MAJOR 0 +#define ROCTX_API_TABLE_VERSION_STEP 0 + +typedef uint64_t roctx_range_id_t; +typedef void (*roctxMarkA_fn_t)(const char* message); +typedef int (*roctxRangePushA_fn_t)(const char* message); +typedef int (*roctxRangePop_fn_t)(void); +typedef roctx_range_id_t (*roctxRangeStartA_fn_t)(const char* message); +typedef void (*roctxRangeStop_fn_t)(roctx_range_id_t id); +typedef int (*roctxProfilerPause_fn_t)(roctx_thread_id_t tid); +typedef int (*roctxProfilerResume_fn_t)(roctx_thread_id_t tid); +typedef int (*roctxNameOsThread_fn_t)(const char* name); +typedef int (*roctxNameHsaAgent_fn_t)(const char* name, const struct hsa_agent_s* agent); +typedef int (*roctxNameHipDevice_fn_t)(const char* name, int device_id); +typedef int (*roctxNameHipStream_fn_t)(const char* name, const struct ihipStream_t* stream); +typedef int (*roctxGetThreadId_fn_t)(roctx_thread_id_t* tid); + +typedef struct roctxApiTable_t +{ + uint64_t size; + roctxMarkA_fn_t roctxMarkA_fn; + roctxRangePushA_fn_t roctxRangePushA_fn; + roctxRangePop_fn_t roctxRangePop_fn; + roctxRangeStartA_fn_t roctxRangeStartA_fn; + roctxRangeStop_fn_t roctxRangeStop_fn; + roctxProfilerPause_fn_t roctxProfilerPause_fn; + roctxProfilerResume_fn_t roctxProfilerResume_fn; + roctxNameOsThread_fn_t roctxNameOsThread_fn; + roctxNameHsaAgent_fn_t roctxNameHsaAgent_fn; + roctxNameHipDevice_fn_t roctxNameHipDevice_fn; + roctxNameHipStream_fn_t roctxNameHipStream_fn; + roctxGetThreadId_fn_t roctxGetThreadId_fn; +} roctxApiTable_t; + +ROCTX_EXTERN_C_FINI diff --git a/projects/rocprofiler-sdk/source/include/rocprofiler-sdk-roctx/defines.h b/projects/rocprofiler-sdk/source/include/rocprofiler-sdk-roctx/defines.h new file mode 100644 index 0000000000..a6e9c9ce8e --- /dev/null +++ b/projects/rocprofiler-sdk/source/include/rocprofiler-sdk-roctx/defines.h @@ -0,0 +1,116 @@ +// MIT License +// +// Copyright (c) 2023 Advanced Micro Devices, Inc. All rights reserved. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in all +// copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// SOFTWARE. + +#pragma once + +/** + * @defgroup SYMBOL_VERSIONING_GROUP Symbol Versions + * + * @brief The names used for the shared library versioned symbols. + * + * Every function is annotated with one of the version macros defined in this + * section. Each macro specifies a corresponding symbol version string. After + * dynamically loading the shared library with @p dlopen, the address of each + * function can be obtained using @p dlsym with the name of the function and + * its corresponding symbol version string. An error will be reported by @p + * dlvsym if the installed library does not support the version for the + * function specified in this version of the interface. + * + * @{ + */ + +/** + * @brief The function was introduced in version 10.0 of the interface and has the + * symbol version string of ``"ROCTX_10.0"``. + */ +#define ROCTX_VERSION_10_0 + +/** @} */ + +#if !defined(ROCTX_ATTRIBUTE) +# if defined(_MSC_VER) +# define ROCTX_ATTRIBUTE(...) __declspec(__VA_ARGS__) +# else +# define ROCTX_ATTRIBUTE(...) __attribute__((__VA_ARGS__)) +# endif +#endif + +#if !defined(ROCTX_PUBLIC_API) +# if defined(_MSC_VER) +# define ROCTX_PUBLIC_API ROCTX_ATTRIBUTE(dllexport) +# else +# define ROCTX_PUBLIC_API ROCTX_ATTRIBUTE(visibility("default")) +# endif +#endif + +#if !defined(ROCTX_HIDDEN_API) +# if defined(_MSC_VER) +# define ROCTX_HIDDEN_API +# else +# define ROCTX_HIDDEN_API ROCTX_ATTRIBUTE(visibility("hidden")) +# endif +#endif + +#if !defined(ROCTX_EXPORT_DECORATOR) +# define ROCTX_EXPORT_DECORATOR ROCTX_PUBLIC_API +#endif + +#if !defined(ROCTX_IMPORT_DECORATOR) +# if defined(_MSC_VER) +# define ROCTX_IMPORT_DECORATOR ROCTX_ATTRIBUTE(dllimport) +# else +# define ROCTX_IMPORT_DECORATOR +# endif +#endif + +#define ROCTX_EXPORT ROCTX_EXPORT_DECORATOR +#define ROCTX_IMPORT ROCTX_IMPORT_DECORATOR + +#if !defined(ROCTX_API) +# if defined(rocprofiler_EXPORTS) +# define ROCTX_API ROCTX_EXPORT +# else +# define ROCTX_API ROCTX_IMPORT +# endif +#endif + +#if defined(__has_attribute) +# if __has_attribute(nonnull) +# define ROCTX_NONNULL(...) __attribute__((nonnull(__VA_ARGS__))) +# else +# define ROCTX_NONNULL(...) +# endif +#else +# if defined(__GNUC__) +# define ROCTX_NONNULL(...) __attribute__((nonnull(__VA_ARGS__))) +# else +# define ROCTX_NONNULL(...) +# endif +#endif + +#ifdef __cplusplus +# define ROCTX_EXTERN_C_INIT extern "C" { +# define ROCTX_EXTERN_C_FINI } +#else +# define ROCTX_EXTERN_C_INIT +# define ROCTX_EXTERN_C_FINI +#endif diff --git a/projects/rocprofiler-sdk/source/include/rocprofiler-sdk-roctx/roctx.h b/projects/rocprofiler-sdk/source/include/rocprofiler-sdk-roctx/roctx.h new file mode 100644 index 0000000000..724c0d2f77 --- /dev/null +++ b/projects/rocprofiler-sdk/source/include/rocprofiler-sdk-roctx/roctx.h @@ -0,0 +1,256 @@ +// MIT License +// +// Copyright (c) 2023 Advanced Micro Devices, Inc. All rights reserved. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in all +// copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// SOFTWARE. + +#pragma once + +/** \mainpage ROCTX API Specification + * + * \section introduction Introduction + * ROCTX is a library that implements the AMD code annotation API. It provides + * the support necessary to annotate events and code ranges in applications. + */ + +/** + * \file + * ROCTX API interface. + */ + +#include +#include + +#include "rocprofiler-sdk-roctx/defines.h" +#include "rocprofiler-sdk-roctx/types.h" +#include "rocprofiler-sdk-roctx/version.h" + +ROCTX_EXTERN_C_INIT + +/** \defgroup marker_group ROCTX Markers + * + * Marker annotations are used to describe events in a ROCm application. + * + * @{ + */ + +/** + * Mark an event. + * + * \param[in] message The message associated with the event. + */ +void +roctxMarkA(const char* message) ROCTX_API ROCTX_NONNULL(1); + +/** @} */ + +/** \defgroup range_group ROCTX Ranges + * + * Range annotations are used to describe events in a ROCm application. + * + * @{ + */ + +/** + * Start a new nested range. + * + * Nested ranges are stacked and local to the current CPU thread. + * + * \param[in] message The message associated with this range. + * + * \return Returns the level this nested range is started at. Nested range + * levels are 0 based. + */ +int +roctxRangePushA(const char* message) ROCTX_API ROCTX_NONNULL(1); + +/** + * Stop the current nested range. + * + * Stop the current nested range, and pop it from the stack. If a nested range + * was active before the last one was started, it becomes again the current + * nested range. + * + * \return Returns the level the stopped nested range was started at, or a + * negative value if there was no nested range active. + */ +int +roctxRangePop() ROCTX_API; + +/** + * @brief Starts a process range. + * + * Start/stop ranges can be started and stopped in different threads. Each + * timespan is assigned a unique range ID. + * + * @param [in] message The message associated with this range. + * + * @return Returns the ID of the new range. + */ +roctx_range_id_t +roctxRangeStartA(const char* message) ROCTX_API ROCTX_NONNULL(1); + +/** + * Stop a process range. + */ +void +roctxRangeStop(roctx_range_id_t id) ROCTX_API; + +/** @} */ + +/** \defgroup PROFILER_COMM ROCTX Application control/customization of profiling tools + * + * Applications can invoke these functions to control/customize profiling tool behavior. + * + * @{ + */ + +/** + * @brief Request any currently running profiling tool that is should stop collecting data. + * + * Within a profiling tool, it is recommended that the tool cache all active contexts at the time of + * the request and then stop them. By convention, the application should pass zero to indicate a + * global pause of the profiler in the current process. If the application wishes to pause only the + * current thread, the application should obtain the thread ID via @ref roctxGetThreadId. + * + * @param [in] tid Zero for all threads in current process or non-zero for a specific thread + * + * @return int A profiling tool may choose to set this value to a non-zero value to indicate a + * failure while executing the request or lack of support. If the profiling tool supports pausing + * but is already paused, the tool should ignore the request and return zero. + */ +int +roctxProfilerPause(roctx_thread_id_t tid) ROCTX_API; + +/** + * @brief Request any currently running profiling tool that is should resume collecting data. + * + * Within a profiling tool, it is recommended that the tool re-activated the active contexts which + * were cached when the pause request was issued. By convention, the application should pass zero to + * indicate a global pause of the profiler in the current process. If the application wishes to + * pause only the current thread, the application should obtain the thread ID via @ref + * roctxGetThreadId. + * + * @param [in] tid Zero for all threads in current process or non-zero for a specific thread + * + * @return int A profiling tool may choose to set this value to a non-zero value to indicate a + * failure while executing the request or lack of support. If the profiling tool is supports + * resuming but is already active, the tool should ignore the request and return zero. + */ +int +roctxProfilerResume(roctx_thread_id_t tid) ROCTX_API; + +/** + * @brief Indicate to a profiling tool that, where possible, you would like the current CPU OS + * thread to be labeled by the provided name in the output of the profiling tool. + * + * Rocprofiler does not provide explicit support for how profiling tools handle this request: + * support for this capability is tool specific. ROCTx does NOT rename the thread via + * `pthread_setname_np`. + * + * @param [in] name Name for the current OS thread + * + * @return int A profiling tool may choose to set this value to a non-zero value to indicate a + * failure while executing the request or lack of support + */ +int +roctxNameOsThread(const char*) ROCTX_API ROCTX_NONNULL(1); + +/** + * @brief Indicate to a profiling tool that, where possible, you would like the given HSA agent + * to be labeled by the provided name in the output of the profiling tool. + * + * Rocprofiler does not provide any explicit support for how profiling tools handle this request: + * support for this capability is tool specific. + * + * @param [in] name Name for the specified agent + * @param [in] stream Pointer to a HSA agent identifier + * + * @return int A profiling tool may choose to set this value to a non-zero value to indicate a + * failure while executing the request or lack of support + */ +int +roctxNameHsaAgent(const char* name, const struct hsa_agent_s*) ROCTX_API ROCTX_NONNULL(1, 2); + +/** + * @brief Indicate to a profiling tool that, where possible, you would like the given HIP device id + * to be labeled by the provided name in the output of the profiling tool. + * + * Rocprofiler does not provide any explicit support for how profiling tools handle this request: + * support for this capability is tool specific. + * + * @param [in] name Name for the specified device + * @param [in] device_id HIP device ordinal + * + * @return int A profiling tool may choose to set this value to a non-zero value to indicate a + * failure while executing the request or lack of support + */ +int +roctxNameHipDevice(const char* name, int device_id) ROCTX_API ROCTX_NONNULL(1); + +/** + * @brief Indicate to a profiling tool that, where possible, you would like the given HIP stream + * to be labeled by the provided name in the output of the profiling tool. + * + * Rocprofiler does not provide any explicit support for how profiling tools handle this request: + * support for this capability is tool specific. + * + * @param [in] name Name for the specified stream + * @param [in] stream A `hipStream_t` value (hipStream_t == ihipStream_t*) + * + * @return int A profiling tool may choose to set this value to a non-zero value to indicate a + * failure while executing the request or lack of support + */ +int +roctxNameHipStream(const char* name, const struct ihipStream_t* stream) ROCTX_API ROCTX_NONNULL(1); + +/** @} */ + +/** \defgroup UTILITIES ROCTx Utility functions + * + * @{ + */ + +/** + * @brief Retrieve a id value for the current thread which will be identical to the id value a + * profiling tool gets via `rocprofiler_get_thread_id(rocprofiler_thread_id_t*)` + * + * @param tid [out] Pointer to where the value should be placed + * + * @return int A profiling tool may choose to set this value to a non-zero value to indicate a + * failure while executing the request or lack of support + */ +int +roctxGetThreadId(roctx_thread_id_t* tid) ROCTX_API ROCTX_NONNULL(1); + +/** @} */ + +ROCTX_EXTERN_C_FINI + +#if !defined(roctxRangeStart) +# define roctxRangeStart(message) roctxRangeStartA(message) +#endif + +#if !defined(roctxMark) +# define roctxMark(message) roctxMarkA(message) +#endif + +#if !defined(roctxRangePush) +# define roctxRangePush(message) roctxRangePushA(message) +#endif diff --git a/projects/rocprofiler-sdk/source/include/rocprofiler-sdk-roctx/types.h b/projects/rocprofiler-sdk/source/include/rocprofiler-sdk-roctx/types.h new file mode 100644 index 0000000000..5659f2aaca --- /dev/null +++ b/projects/rocprofiler-sdk/source/include/rocprofiler-sdk-roctx/types.h @@ -0,0 +1,56 @@ +// MIT License +// +// Copyright (c) 2023 Advanced Micro Devices, Inc. All rights reserved. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in all +// copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// SOFTWARE. + +#pragma once + +#include "rocprofiler-sdk-roctx/defines.h" + +#include + +/** \defgroup DATA_TYPE ROCTX Data types + * + * Data types defined or aliased by ROCTx + * + * @{ + */ + +/** + * ROCTX range ID. + * + * This is the range ID used to identify start/end ranges. + */ + +/** + * @brief ROCTX range ID. + * + * This is the range ID used to identify start/end ranges. + */ +typedef uint64_t roctx_range_id_t; + +/** + * @brief ROCTX thread ID. + * + * This is the thread ID used to identify OS threads + */ +typedef uint64_t roctx_thread_id_t; + +/** @} */ diff --git a/projects/rocprofiler-sdk/source/include/rocprofiler-sdk-roctx/version.h.in b/projects/rocprofiler-sdk/source/include/rocprofiler-sdk-roctx/version.h.in new file mode 100644 index 0000000000..f7b943ac70 --- /dev/null +++ b/projects/rocprofiler-sdk/source/include/rocprofiler-sdk-roctx/version.h.in @@ -0,0 +1,109 @@ +// MIT License +// +// Copyright (c) 2023 Advanced Micro Devices, Inc. All rights reserved. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in all +// copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// SOFTWARE. + +#pragma once + +/** + * @def ROCTX_VERSION_MAJOR + * @brief The major version of the interface as a macro so it can be used + * by the preprocessor. + * @addtogroup VERSIONING_GROUP + * + * @def ROCTX_VERSION_MINOR + * @brief The minor version of the interface as a macro so it can be used + * by the preprocessor. + * @addtogroup VERSIONING_GROUP + * + * @def ROCTX_VERSION_PATCH + * @brief The patch version of the interface as a macro so it can be used + * by the preprocessor. + * @addtogroup VERSIONING_GROUP + * + * @def ROCTX_VERSION + * @brief Numerically increasing version number encoding major, minor, and patch via + computing `((10000 * ) + (100 * ) + )`. + * @addtogroup VERSIONING_GROUP + * + * @def ROCTX_SOVERSION + * @brief Shared object versioning value whose value is at least `(10000 * )`. + * @addtogroup VERSIONING_GROUP + * + * @def ROCTX_VERSION_STRING + * @brief Version string in form: `..`. + * @addtogroup VERSIONING_GROUP + * + * @def ROCTX_GIT_DESCRIBE + * @brief String encoding of `git describe --tags` when rocprofiler was built. + * @addtogroup VERSIONING_GROUP + * + * @def ROCTX_GIT_REVISION + * @brief String encoding of `git rev-parse HEAD` when rocprofiler was built. + * @addtogroup VERSIONING_GROUP + * + * @def ROCTX_LIBRARY_ARCH + * @brief Architecture triplet of rocprofiler build. + * @addtogroup VERSIONING_GROUP + * + * @def ROCTX_SYSTEM_NAME + * @brief Target operating system for rocprofiler build, e.g. Linux. + * @addtogroup VERSIONING_GROUP + * + * @def ROCTX_SYSTEM_PROCESSOR + * @brief Target architecture for rocprofiler build. + * @addtogroup VERSIONING_GROUP + * + * @def ROCTX_SYSTEM_VERSION + * @brief Version of the operating system which built rocprofiler + * @addtogroup VERSIONING_GROUP + * + * @def ROCTX_COMPILER_ID + * @brief C++ compiler identifier which built rocprofiler, e.g., GNU + * @addtogroup VERSIONING_GROUP + * + * @def ROCTX_COMPILER_VERSION + * @brief C++ compiler version which built rocprofiler + * @addtogroup VERSIONING_GROUP + */ + +// clang-format off +#define ROCTX_VERSION_MAJOR @PROJECT_VERSION_MAJOR@ +#define ROCTX_VERSION_MINOR @PROJECT_VERSION_MINOR@ +#define ROCTX_VERSION_PATCH @PROJECT_VERSION_PATCH@ +#define ROCTX_SOVERSION (10000 * @PROJECT_VERSION_MAJOR@) +#define ROCTX_VERSION_STRING "@FULL_VERSION_STRING@" +#define ROCTX_GIT_DESCRIBE "@ROCPROFILER_GIT_DESCRIBE@" +#define ROCTX_GIT_REVISION "@ROCPROFILER_GIT_REVISION@" + +// system info during compilation +#define ROCTX_LIBRARY_ARCH "@CMAKE_LIBRARY_ARCHITECTURE@" +#define ROCTX_SYSTEM_NAME "@CMAKE_SYSTEM_NAME@" +#define ROCTX_SYSTEM_PROCESSOR "@CMAKE_SYSTEM_PROCESSOR@" +#define ROCTX_SYSTEM_VERSION "@CMAKE_SYSTEM_VERSION@" + +// compiler information +#define ROCTX_COMPILER_ID "@CMAKE_CXX_COMPILER_ID@" +#define ROCTX_COMPILER_VERSION "@CMAKE_CXX_COMPILER_VERSION@" + +// clang-format on + +#define ROCTX_VERSION \ + ((10000 * ROCTX_VERSION_MAJOR) + (100 * ROCTX_VERSION_MINOR) + ROCTX_VERSION_PATCH) diff --git a/projects/rocprofiler-sdk/source/include/rocprofiler-sdk/fwd.h b/projects/rocprofiler-sdk/source/include/rocprofiler-sdk/fwd.h index bc2009ae6a..63f0329064 100644 --- a/projects/rocprofiler-sdk/source/include/rocprofiler-sdk/fwd.h +++ b/projects/rocprofiler-sdk/source/include/rocprofiler-sdk/fwd.h @@ -60,7 +60,7 @@ typedef enum // NOLINT(performance-enum-size) ROCPROFILER_STATUS_ERROR_THREAD_NOT_FOUND, ///< No valid thread for given thread id ROCPROFILER_STATUS_ERROR_AGENT_NOT_FOUND, ///< Agent identifier not found ROCPROFILER_STATUS_ERROR_COUNTER_NOT_FOUND, ///< Counter identifier does not exist - ROCPROFILER_STATUS_ERROR_CONTEXT_ERROR, ///> Generalized context error + ROCPROFILER_STATUS_ERROR_CONTEXT_ERROR, ///< Generalized context error ROCPROFILER_STATUS_ERROR_CONTEXT_INVALID, ///< Context configuration is not valid ROCPROFILER_STATUS_ERROR_CONTEXT_NOT_STARTED, ///< Context was not started (e.g., atomic swap ///< into active array failed) diff --git a/projects/rocprofiler-sdk/source/lib/CMakeLists.txt b/projects/rocprofiler-sdk/source/lib/CMakeLists.txt index df1677a215..59dbcf99a3 100644 --- a/projects/rocprofiler-sdk/source/lib/CMakeLists.txt +++ b/projects/rocprofiler-sdk/source/lib/CMakeLists.txt @@ -7,7 +7,7 @@ add_subdirectory(rocprofiler-sdk) set(CMAKE_INSTALL_DEFAULT_COMPONENT_NAME "tools") add_subdirectory(rocprofiler-sdk-tool) -add_subdirectory(plugins) +add_subdirectory(rocprofiler-sdk-roctx) if(ROCPROFILER_BUILD_TESTS) add_subdirectory(tests) diff --git a/projects/rocprofiler-sdk/source/lib/rocprofiler-sdk-roctx/CMakeLists.txt b/projects/rocprofiler-sdk/source/lib/rocprofiler-sdk-roctx/CMakeLists.txt new file mode 100644 index 0000000000..15354db9c4 --- /dev/null +++ b/projects/rocprofiler-sdk/source/lib/rocprofiler-sdk-roctx/CMakeLists.txt @@ -0,0 +1,38 @@ +# +# ROCTx Marker Library +# + +find_package(rocprofiler-register REQUIRED) + +add_library(rocprofiler-sdk-roctx-shared-library SHARED) +add_library(rocprofiler::rocprofiler-sdk-roctx-shared-library ALIAS + rocprofiler-sdk-roctx-shared-library) + +target_sources(rocprofiler-sdk-roctx-shared-library PRIVATE roctx.cpp) +target_include_directories( + rocprofiler-sdk-roctx-shared-library + INTERFACE $ + $ + $) +target_link_libraries( + rocprofiler-sdk-roctx-shared-library + PRIVATE rocprofiler-register::rocprofiler-register rocprofiler::rocprofiler-headers + rocprofiler::rocprofiler-build-flags rocprofiler::rocprofiler-memcheck + rocprofiler::rocprofiler-common-library) + +set_target_properties( + rocprofiler-sdk-roctx-shared-library + PROPERTIES OUTPUT_NAME rocprofiler-sdk-roctx + LIBRARY_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_LIBDIR} + SOVERSION ${PROJECT_VERSION_MAJOR} + VERSION ${PROJECT_VERSION} + SKIP_BUILD_RPATH OFF + BUILD_RPATH "\$ORIGIN" + INSTALL_RPATH "\$ORIGIN" + DEFINE_SYMBOL rocprofiler_EXPORTS) + +install( + TARGETS rocprofiler-sdk-roctx-shared-library + DESTINATION ${CMAKE_INSTALL_LIBDIR} + COMPONENT roctx + EXPORT rocprofiler-sdk-roctx-targets) diff --git a/projects/rocprofiler-sdk/source/lib/rocprofiler-sdk-roctx/roctx.cpp b/projects/rocprofiler-sdk/source/lib/rocprofiler-sdk-roctx/roctx.cpp new file mode 100644 index 0000000000..0f5f6238e4 --- /dev/null +++ b/projects/rocprofiler-sdk/source/lib/rocprofiler-sdk-roctx/roctx.cpp @@ -0,0 +1,281 @@ +// MIT License +// +// Copyright (c) 2023 Advanced Micro Devices, Inc. All rights reserved. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in all +// copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// SOFTWARE. + +#include +#include +#include +#include + +#include "lib/common/logging.hpp" +#include "lib/common/utility.hpp" + +#include +#include + +#include +#include +#include + +#define ROCP_REG_VERSION \ + ROCPROFILER_REGISTER_COMPUTE_VERSION_3( \ + ROCTX_VERSION_MAJOR, ROCTX_VERSION_MINOR, ROCTX_VERSION_PATCH) + +ROCPROFILER_REGISTER_DEFINE_IMPORT(roctx, ROCP_REG_VERSION) + +namespace roctx +{ +namespace +{ +constexpr size_t +compute_table_offset(size_t n) +{ + return (sizeof(uint64_t) + (n * sizeof(void*))); +} + +constexpr size_t +compute_table_size(size_t nmembers) +{ + return (sizeof(uint64_t) + (nmembers * sizeof(void*))); +} + +#define ROCTX_ASSERT_OFFSET(MEMBER, IDX) \ + static_assert(offsetof(roctxApiTable_t, MEMBER) == compute_table_offset(IDX), \ + "Do not re-arrange the table members") + +ROCTX_ASSERT_OFFSET(roctxMarkA_fn, 0); +ROCTX_ASSERT_OFFSET(roctxRangePushA_fn, 1); +ROCTX_ASSERT_OFFSET(roctxRangePop_fn, 2); +ROCTX_ASSERT_OFFSET(roctxRangeStartA_fn, 3); +ROCTX_ASSERT_OFFSET(roctxRangeStop_fn, 4); +ROCTX_ASSERT_OFFSET(roctxProfilerPause_fn, 5); +ROCTX_ASSERT_OFFSET(roctxProfilerResume_fn, 6); +ROCTX_ASSERT_OFFSET(roctxNameOsThread_fn, 7); +ROCTX_ASSERT_OFFSET(roctxNameHsaAgent_fn, 8); +ROCTX_ASSERT_OFFSET(roctxNameHipDevice_fn, 9); +ROCTX_ASSERT_OFFSET(roctxNameHipStream_fn, 10); +ROCTX_ASSERT_OFFSET(roctxGetThreadId_fn, 11); + +#undef ROCTX_ASSERT_OFFSET + +static_assert( + sizeof(roctxApiTable_t) == compute_table_size(12), + "Update table major/step version and add a new offset assertion if this fails to compile"); + +auto& +get_nested_range_level() +{ + static thread_local int value = 0; + return value; +} + +auto& +get_start_stop_range_id() +{ + static auto value = std::atomic{}; + return value; +} + +int +roctxGetThreadId(roctx_thread_id_t* tid) +{ + *tid = rocprofiler::common::get_tid(); + return 0; +} + +void +roctxMarkA(const char*) +{} + +int +roctxRangePushA(const char*) +{ + return get_nested_range_level()++; +} + +int +roctxRangePop() +{ + if(get_nested_range_level() == 0) return -1; + return --get_nested_range_level(); +} + +roctx_range_id_t +roctxRangeStartA(const char*) +{ + auto range_id = ++get_start_stop_range_id(); + return range_id; +} + +void roctxRangeStop(roctx_range_id_t) {} + +int roctxProfilerPause(roctx_thread_id_t /*tid*/) { return 0; } + +int roctxProfilerResume(roctx_thread_id_t /*tid*/) { return 0; } + +int +roctxNameOsThread(const char*) +{ + return 0; +} + +int +roctxNameHsaAgent(const char*, const struct hsa_agent_s*) +{ + return 0; +} + +int +roctxNameHipDevice(const char*, int) +{ + return 0; +} + +int +roctxNameHipStream(const char*, const struct ihipStream_t*) +{ + return 0; +} + +auto& +get_table_impl() +{ + rocprofiler::common::init_logging("ROCTX_LOG_LEVEL"); + + static auto val = roctxApiTable_t{sizeof(roctxApiTable_t), + &::roctx::roctxMarkA, + &::roctx::roctxRangePushA, + &::roctx::roctxRangePop, + &::roctx::roctxRangeStartA, + &::roctx::roctxRangeStop, + &::roctx::roctxProfilerPause, + &::roctx::roctxProfilerResume, + &::roctx::roctxNameOsThread, + &::roctx::roctxNameHsaAgent, + &::roctx::roctxNameHipDevice, + &::roctx::roctxNameHipStream, + &::roctx::roctxGetThreadId}; + + auto table_array = std::array{&val}; + auto lib_id = rocprofiler_register_library_indentifier_t{}; + auto rocp_reg_status = + rocprofiler_register_library_api_table("roctx", + &ROCPROFILER_REGISTER_IMPORT_FUNC(roctx), + ROCP_REG_VERSION, + table_array.data(), + table_array.size(), + &lib_id); + + LOG(INFO) << "[rocprofiler-sdk-roctx][" << getpid() << "] rocprofiler-register returned code " + << rocp_reg_status << ": " << rocprofiler_register_error_string(rocp_reg_status); + + LOG_IF(WARNING, rocp_reg_status != ROCP_REG_SUCCESS && rocp_reg_status != ROCP_REG_NO_TOOLS) + << "[rocprofiler-sdk-roctx][" << getpid() + << "] rocprofiler-register failed with error code " << rocp_reg_status << ": " + << rocprofiler_register_error_string(rocp_reg_status); + + return val; +} + +const auto* +get_table() +{ + static const auto* tbl = &get_table_impl(); + return tbl; +} +} // namespace +} // namespace roctx + +ROCTX_EXTERN_C_INIT + +void +roctxMarkA(const char* message) +{ + ::roctx::get_table()->roctxMarkA_fn(message); +} + +int +roctxRangePushA(const char* message) +{ + return ::roctx::get_table()->roctxRangePushA_fn(message); +} + +int +roctxRangePop() +{ + return ::roctx::get_table()->roctxRangePop_fn(); +} + +roctx_range_id_t +roctxRangeStartA(const char* message) +{ + return ::roctx::get_table()->roctxRangeStartA_fn(message); +} + +void +roctxRangeStop(roctx_range_id_t id) +{ + return ::roctx::get_table()->roctxRangeStop_fn(id); +} + +int +roctxProfilerPause(roctx_thread_id_t tid) +{ + return ::roctx::get_table()->roctxProfilerPause_fn(tid); +} + +int +roctxProfilerResume(roctx_thread_id_t tid) +{ + return ::roctx::get_table()->roctxProfilerResume_fn(tid); +} + +int +roctxNameOsThread(const char* name) +{ + return ::roctx::get_table()->roctxNameOsThread_fn(name); +} + +int +roctxNameHsaAgent(const char* name, const struct hsa_agent_s* agent) +{ + return ::roctx::get_table()->roctxNameHsaAgent_fn(name, agent); +} + +int +roctxNameHipDevice(const char* name, int device_id) +{ + return ::roctx::get_table()->roctxNameHipDevice_fn(name, device_id); +} + +int +roctxNameHipStream(const char* name, const struct ihipStream_t* stream) +{ + return ::roctx::get_table()->roctxNameHipStream_fn(name, stream); +} + +int +roctxGetThreadId(roctx_thread_id_t* tid) +{ + return ::roctx::get_table()->roctxGetThreadId_fn(tid); +} + +ROCTX_EXTERN_C_FINI diff --git a/projects/rocprofiler-sdk/source/lib/rocprofiler-sdk-tool/CMakeLists.txt b/projects/rocprofiler-sdk/source/lib/rocprofiler-sdk-tool/CMakeLists.txt index 387b8b7908..d1452e381b 100644 --- a/projects/rocprofiler-sdk/source/lib/rocprofiler-sdk-tool/CMakeLists.txt +++ b/projects/rocprofiler-sdk/source/lib/rocprofiler-sdk-tool/CMakeLists.txt @@ -5,6 +5,9 @@ add_library(rocprofiler-sdk-tool SHARED) target_sources(rocprofiler-sdk-tool PRIVATE helper.hpp helper.cpp tool.cpp trace_buffer.hpp) + +add_subdirectory(plugins) + target_link_libraries( rocprofiler-sdk-tool PRIVATE rocprofiler::rocprofiler-shared-library @@ -30,4 +33,4 @@ install( TARGETS rocprofiler-sdk-tool DESTINATION ${CMAKE_INSTALL_LIBDIR}/rocprofiler-sdk COMPONENT tools - EXPORT rocprofiler-sdk-library-targets) + EXPORT rocprofiler-sdk-tool-targets) diff --git a/projects/rocprofiler-sdk/source/lib/plugins/CMakeLists.txt b/projects/rocprofiler-sdk/source/lib/rocprofiler-sdk-tool/plugins/CMakeLists.txt similarity index 100% rename from projects/rocprofiler-sdk/source/lib/plugins/CMakeLists.txt rename to projects/rocprofiler-sdk/source/lib/rocprofiler-sdk-tool/plugins/CMakeLists.txt diff --git a/projects/rocprofiler-sdk/source/lib/rocprofiler-sdk/CMakeLists.txt b/projects/rocprofiler-sdk/source/lib/rocprofiler-sdk/CMakeLists.txt index 40cd498f42..a168d5a8e2 100644 --- a/projects/rocprofiler-sdk/source/lib/rocprofiler-sdk/CMakeLists.txt +++ b/projects/rocprofiler-sdk/source/lib/rocprofiler-sdk/CMakeLists.txt @@ -98,7 +98,7 @@ install( TARGETS rocprofiler-shared-library DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT core - EXPORT rocprofiler-sdk-library-targets) + EXPORT rocprofiler-sdk-targets) # ----------------------------------------------------------------------------------------# #