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 <jrmadsen@users.noreply.github.com>
* 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: 1edd4891b2]
This commit is contained in:
committed by
GitHub
parent
12bc6c93d7
commit
e8c7e6bfba
@@ -4,3 +4,4 @@
|
||||
set(CMAKE_INSTALL_DEFAULT_COMPONENT_NAME "development")
|
||||
|
||||
add_subdirectory(rocprofiler-sdk)
|
||||
add_subdirectory(rocprofiler-sdk-roctx)
|
||||
|
||||
@@ -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)
|
||||
@@ -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 <sched.h>
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
|
||||
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
|
||||
@@ -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
|
||||
@@ -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 <stddef.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#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
|
||||
@@ -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 <stdint.h>
|
||||
|
||||
/** \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;
|
||||
|
||||
/** @} */
|
||||
@@ -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 * <MAJOR>) + (100 * <MINOR>) + <PATCH>)`.
|
||||
* @addtogroup VERSIONING_GROUP
|
||||
*
|
||||
* @def ROCTX_SOVERSION
|
||||
* @brief Shared object versioning value whose value is at least `(10000 * <MAJOR>)`.
|
||||
* @addtogroup VERSIONING_GROUP
|
||||
*
|
||||
* @def ROCTX_VERSION_STRING
|
||||
* @brief Version string in form: `<MAJOR>.<MINOR>.<PATCH>`.
|
||||
* @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)
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user