Split ROCTx API tables and update intercept table API (#421)
* Update include/rocprofiler-sdk
- buffer_tracing.h
- fix doxygen for rocprofiler_buffer_tracing_hip_api_record_t
- update doxygen for rocprofiler_buffer_tracing_marker_api_record_t
- remove unused marker_id field
- fwd.h
- Split ROCPROFILER_CALLBACK_TRACING_MARKER_API into ROCPROFILER_CALLBACK_TRACING_MARKER_{CORE,CONTROL,NAME}_API
- Split ROCPROFILER_BUFFER_TRACING_MARKER_API into ROCPROFILER_BUFFER_TRACING_MARKER_{CORE,CONTROL,NAME}_API
- split rocprofiler_runtime_library_t into rocprofiler_runtime_library_t and rocprofiler_intercept_table_t
- after split of ROCTx into 3 tables, specifying rocprofiler_at_internal_thread_create became confusing
* Update include/rocprofiler-sdk-roctx/api_trace.h
- Split into three tables: core, control, and name
- core: what it sounds like
- control: functions for controling the profiler
- name: functions for giving resources names
* Update lib/rocprofiler-sdk-roctx/roctx.cpp
- modifications following split into multiple tables
* Update lib/rocprofiler-sdk/marker/*
- modifications following split of ROCTx API into multiple intercept tables
* Update lib/rocprofiler-sdk/tests
- common.hpp
- add enums to get_callback_tracing_names() and get_buffer_tracing_names()
- intercept_table.cpp
- update test to use rocprofiler_intercept_table_t (and enums) instead of rocproifler_runtime_library_t
- update OR combos tested
- roctx.cpp
- updates following split of ROCTx API table into multiple tables
- use simplified specification of control API
* Update lib/rocprofiler-sdk
- buffer_tracing.cpp
- Updates for ROCPROFILER_BUFFER_TRACING_MARKER_{CORE,CONTROL,NAME}_API enum values
- callback_tracing.cpp
- Updates for ROCPROFILER_CALLBACK_TRACING_MARKER_{CORE,CONTROL,NAME}_API enum values
- intercept_table.hpp
- notify_runtime_api_registration -> notify_intercept_table_registration
- intercept_table.cpp
- updates for new rocprofiler_intercept_table_t enum and new ROCTx tables
- registration.cpp
- updates for new rocprofiler_intercept_table_t enum and new ROCTx tables
- updates for notify_runtime_api_registration -> notify_intercept_table_registration
* Update lib/rocprofiler-sdk-tool
- helper.cpp
- Updates for new enums in get_callback_id_names() and get_buffer_id_names()
- tool.cpp
- migrate to new enums for split ROCTx tables
- use simplified split for control table vs. core+name tables
* Update samples/{api_callback_tracing,intercept_table}
- intercept_table/client.cpp
- rocprofiler_runtime_library_t -> rocprofiler_intercept_table_t
- api_callback_tracing/client.cpp
- Updates for new enums in get_callback_id_names()
- use simplified split for control table vs. core+name tables
- migrate to new enums for split ROCTx tables
* Update tests
- rocprofv3/tracing/validate.py
- handle new marker domain names
- tools/json-tool.cpp
- Updates for new enums in get_callback_id_names() and get_buffer_id_names()
- use simplified split for control table vs. core+name tables
- migrate to new enums for split ROCTx tables
* Update tests/rocprofv3/tracing/CMakeLists.txt
- fix FAIL_REGULAR_EXPRESSION for rocprofv3-test-trace-execute
* Update lib/rocprofiler-sdk-tool/{output_file,tool}.*
- logging in output_file dtor
- support stdout/stderr
* Update lib/common/container/record_header_buffer.hpp
- reduce probability of is_empty() returning true while emplace is happening
* Update lib/rocprofiler-sdk-tool/tool.cpp
- logging for buffered_tracing_callback
- counter collection uses CSV encoder
* Update bin/rocprofv3
- remove -i flag from help menu
[ROCm/rocprofiler-sdk commit: 9efafc4d23]
This commit is contained in:
committato da
GitHub
parent
24c8d296ba
commit
bc67b1e823
@@ -35,6 +35,15 @@ ROCTX_EXTERN_C_INIT
|
||||
#define ROCTX_API_TABLE_VERSION_MAJOR 0
|
||||
#define ROCTX_API_TABLE_VERSION_STEP 0
|
||||
|
||||
#define ROCTX_CORE_API_TABLE_VERSION_MAJOR 0
|
||||
#define ROCTX_CORE_API_TABLE_VERSION_STEP 0
|
||||
|
||||
#define ROCTX_CONTROL_API_TABLE_VERSION_MAJOR 0
|
||||
#define ROCTX_CONTROL_API_TABLE_VERSION_STEP 0
|
||||
|
||||
#define ROCTX_RESOURCE_API_TABLE_VERSION_MAJOR 0
|
||||
#define ROCTX_RESOURCE_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);
|
||||
@@ -49,21 +58,31 @@ 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
|
||||
typedef struct roctxCoreApiTable_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;
|
||||
roctxGetThreadId_fn_t roctxGetThreadId_fn;
|
||||
} roctxCoreApiTable_t;
|
||||
|
||||
typedef struct roctxControlApiTable_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;
|
||||
} roctxControlApiTable_t;
|
||||
|
||||
typedef struct roctxNameApiTable_t
|
||||
{
|
||||
uint64_t size;
|
||||
roctxNameOsThread_fn_t roctxNameOsThread_fn;
|
||||
roctxNameHsaAgent_fn_t roctxNameHsaAgent_fn;
|
||||
roctxNameHipDevice_fn_t roctxNameHipDevice_fn;
|
||||
roctxNameHipStream_fn_t roctxNameHipStream_fn;
|
||||
} roctxNameApiTable_t;
|
||||
|
||||
ROCTX_EXTERN_C_FINI
|
||||
|
||||
@@ -54,13 +54,14 @@ typedef struct
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
uint64_t size; ///< size of this struct
|
||||
rocprofiler_buffer_tracing_kind_t kind; ///< ::ROCPROFILER_CALLBACK_TRACING_HIP_API
|
||||
rocprofiler_correlation_id_t correlation_id; ///< correlation ids for record
|
||||
rocprofiler_tracing_operation_t operation; ///< ::rocprofiler_hip_api_id_t
|
||||
rocprofiler_timestamp_t start_timestamp; ///< start time in nanoseconds
|
||||
rocprofiler_timestamp_t end_timestamp; ///< end time in nanoseconds
|
||||
rocprofiler_thread_id_t thread_id; ///< id for thread generating this record
|
||||
uint64_t size; ///< size of this struct
|
||||
rocprofiler_buffer_tracing_kind_t kind; ///< ::ROCPROFILER_CALLBACK_TRACING_HIP_API
|
||||
rocprofiler_correlation_id_t correlation_id; ///< correlation ids for record
|
||||
rocprofiler_tracing_operation_t
|
||||
operation; ///< ::rocprofiler_hip_api_id_t or ::rocprofiler_hip_compiler_api_id_t
|
||||
rocprofiler_timestamp_t start_timestamp; ///< start time in nanoseconds
|
||||
rocprofiler_timestamp_t end_timestamp; ///< end time in nanoseconds
|
||||
rocprofiler_thread_id_t thread_id; ///< id for thread generating this record
|
||||
} rocprofiler_buffer_tracing_hip_api_record_t;
|
||||
|
||||
/**
|
||||
@@ -69,14 +70,16 @@ typedef struct
|
||||
typedef struct
|
||||
{
|
||||
uint64_t size; ///< size of this struct
|
||||
rocprofiler_buffer_tracing_kind_t kind; ///< ::ROCPROFILER_CALLBACK_TRACING_MARKER_API
|
||||
rocprofiler_correlation_id_t correlation_id; ///< correlation ids for record
|
||||
rocprofiler_tracing_operation_t operation; ///< ::rocprofiler_marker_api_id_t
|
||||
rocprofiler_timestamp_t start_timestamp; ///< start time in nanoseconds
|
||||
rocprofiler_timestamp_t end_timestamp; ///< end time in nanoseconds
|
||||
rocprofiler_thread_id_t thread_id; ///< id for thread generating this record
|
||||
uint64_t marker_id; ///< rocprofiler_marker_id_t
|
||||
// const char* message; // (Need Review?)
|
||||
rocprofiler_buffer_tracing_kind_t kind; ///< ::ROCPROFILER_CALLBACK_TRACING_MARKER_CORE_API,
|
||||
///< ::ROCPROFILER_CALLBACK_TRACING_MARKER_CONTROL_API,
|
||||
///< or ::ROCPROFILER_CALLBACK_TRACING_MARKER_NAME_API
|
||||
rocprofiler_correlation_id_t correlation_id; ///< correlation ids for record
|
||||
rocprofiler_tracing_operation_t
|
||||
operation; ///< ::rocprofiler_marker_core_api_id_t, ::rocprofiler_marker_control_api_id_t,
|
||||
///< or ::rocprofiler_marker_name_api_id_t
|
||||
rocprofiler_timestamp_t start_timestamp; ///< start time in nanoseconds
|
||||
rocprofiler_timestamp_t end_timestamp; ///< end time in nanoseconds
|
||||
rocprofiler_thread_id_t thread_id; ///< id for thread generating this record
|
||||
} rocprofiler_buffer_tracing_marker_api_record_t;
|
||||
|
||||
/**
|
||||
|
||||
@@ -128,12 +128,14 @@ typedef enum // NOLINT(performance-enum-size)
|
||||
typedef enum // NOLINT(performance-enum-size)
|
||||
{
|
||||
ROCPROFILER_CALLBACK_TRACING_NONE = 0,
|
||||
ROCPROFILER_CALLBACK_TRACING_HSA_API, ///< Callbacks for HSA functions
|
||||
ROCPROFILER_CALLBACK_TRACING_HIP_API, ///< Callbacks for HIP functions
|
||||
ROCPROFILER_CALLBACK_TRACING_HIP_COMPILER_API, ///< Callbacks for HIP compiler functions
|
||||
ROCPROFILER_CALLBACK_TRACING_MARKER_API, ///< Callbacks for ROCTx functions
|
||||
ROCPROFILER_CALLBACK_TRACING_CODE_OBJECT, ///< Callbacks for code object info
|
||||
ROCPROFILER_CALLBACK_TRACING_KERNEL_DISPATCH, ///< Callbacks for kernel dispatches
|
||||
ROCPROFILER_CALLBACK_TRACING_HSA_API, ///< Callbacks for HSA functions
|
||||
ROCPROFILER_CALLBACK_TRACING_HIP_API, ///< Callbacks for HIP functions
|
||||
ROCPROFILER_CALLBACK_TRACING_HIP_COMPILER_API, ///< Callbacks for HIP compiler functions
|
||||
ROCPROFILER_CALLBACK_TRACING_MARKER_CORE_API, ///< Callbacks for ROCTx functions
|
||||
ROCPROFILER_CALLBACK_TRACING_MARKER_CONTROL_API, ///< Callbacks for ROCTx functions
|
||||
ROCPROFILER_CALLBACK_TRACING_MARKER_NAME_API, ///< Callbacks for ROCTx functions
|
||||
ROCPROFILER_CALLBACK_TRACING_CODE_OBJECT, ///< Callbacks for code object info
|
||||
ROCPROFILER_CALLBACK_TRACING_KERNEL_DISPATCH, ///< Callbacks for kernel dispatches
|
||||
ROCPROFILER_CALLBACK_TRACING_LAST,
|
||||
} rocprofiler_callback_tracing_kind_t;
|
||||
|
||||
@@ -146,7 +148,9 @@ typedef enum // NOLINT(performance-enum-size)
|
||||
ROCPROFILER_BUFFER_TRACING_HSA_API, ///< Buffer HSA function calls
|
||||
ROCPROFILER_BUFFER_TRACING_HIP_API, ///< Buffer HIP function calls
|
||||
ROCPROFILER_BUFFER_TRACING_HIP_COMPILER_API, ///< Buffer HIP compiler function calls
|
||||
ROCPROFILER_BUFFER_TRACING_MARKER_API, ///< Buffer ROCTx function calls
|
||||
ROCPROFILER_BUFFER_TRACING_MARKER_CORE_API, ///< Buffer ROCTx core function calls
|
||||
ROCPROFILER_BUFFER_TRACING_MARKER_CONTROL_API, ///< Buffer ROCTx name function calls
|
||||
ROCPROFILER_BUFFER_TRACING_MARKER_NAME_API, ///< Buffer ROCTx name function calls
|
||||
ROCPROFILER_BUFFER_TRACING_MEMORY_COPY, ///< Buffer memory copy info
|
||||
ROCPROFILER_BUFFER_TRACING_KERNEL_DISPATCH, ///< Buffer kernel dispatch info
|
||||
ROCPROFILER_BUFFER_TRACING_PAGE_MIGRATION, ///< Buffer page migration info
|
||||
@@ -218,20 +222,32 @@ typedef enum // NOLINT(performance-enum-size)
|
||||
|
||||
/**
|
||||
* @brief Enumeration for specifying runtime libraries supported by rocprofiler. This enumeration is
|
||||
* used for intercept tables and thread creation callbacks. @see INTERCEPT_TABLE and @see
|
||||
* INTERNAL_THREADING.
|
||||
* used for thread creation callbacks. @see INTERNAL_THREADING.
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
ROCPROFILER_LIBRARY = (1 << 0),
|
||||
ROCPROFILER_HSA_LIBRARY = (1 << 1),
|
||||
ROCPROFILER_HIP_LIBRARY = (1 << 2),
|
||||
ROCPROFILER_HIP_RUNTIME_LIBRARY = ROCPROFILER_HIP_LIBRARY,
|
||||
ROCPROFILER_MARKER_LIBRARY = (1 << 3),
|
||||
ROCPROFILER_HIP_COMPILER_LIBRARY = (1 << 4),
|
||||
ROCPROFILER_LIBRARY_LAST = ROCPROFILER_HIP_COMPILER_LIBRARY,
|
||||
ROCPROFILER_LIBRARY = (1 << 0),
|
||||
ROCPROFILER_HSA_LIBRARY = (1 << 1),
|
||||
ROCPROFILER_HIP_LIBRARY = (1 << 2),
|
||||
ROCPROFILER_MARKER_LIBRARY = (1 << 3),
|
||||
ROCPROFILER_LIBRARY_LAST = ROCPROFILER_MARKER_LIBRARY,
|
||||
} rocprofiler_runtime_library_t;
|
||||
|
||||
/**
|
||||
* @brief Enumeration for specifying intercept tables supported by rocprofiler. This enumeration is
|
||||
* used for intercept tables. @see INTERCEPT_TABLE.
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
ROCPROFILER_HSA_TABLE = (1 << 0),
|
||||
ROCPROFILER_HIP_RUNTIME_TABLE = (1 << 1),
|
||||
ROCPROFILER_HIP_COMPILER_TABLE = (1 << 2),
|
||||
ROCPROFILER_MARKER_CORE_TABLE = (1 << 3),
|
||||
ROCPROFILER_MARKER_CONTROL_TABLE = (1 << 4),
|
||||
ROCPROFILER_MARKER_NAME_TABLE = (1 << 5),
|
||||
ROCPROFILER_TABLE_LAST = ROCPROFILER_MARKER_NAME_TABLE,
|
||||
} rocprofiler_intercept_table_t;
|
||||
|
||||
//--------------------------------------------------------------------------------------//
|
||||
//
|
||||
// ALIASES
|
||||
|
||||
@@ -50,7 +50,7 @@ ROCPROFILER_EXTERN_C_INIT
|
||||
|
||||
/**
|
||||
* @brief Callback type when a new runtime library is loaded. @see
|
||||
* rocprofiler_at_runtime_api_registration
|
||||
* rocprofiler_at_intercept_table_registration
|
||||
* @param [in] type Type of API table
|
||||
* @param [in] lib_version Major, minor, and patch version of library encoded into single number
|
||||
* similar to @ref ROCPROFILER_VERSION
|
||||
@@ -58,9 +58,9 @@ ROCPROFILER_EXTERN_C_INIT
|
||||
* @param [in] tables An array of pointers to the API tables
|
||||
* @param [in] num_tables The size of the array of pointers to the API tables
|
||||
* @param [in] user_data The pointer to the data provided to @ref
|
||||
* rocprofiler_at_runtime_api_registration
|
||||
* rocprofiler_at_intercept_table_registration
|
||||
*/
|
||||
typedef void (*rocprofiler_intercept_library_cb_t)(rocprofiler_runtime_library_t type,
|
||||
typedef void (*rocprofiler_intercept_library_cb_t)(rocprofiler_intercept_table_t type,
|
||||
uint64_t lib_version,
|
||||
uint64_t lib_instance,
|
||||
void** tables,
|
||||
@@ -69,9 +69,9 @@ typedef void (*rocprofiler_intercept_library_cb_t)(rocprofiler_runtime_library_t
|
||||
|
||||
/**
|
||||
* @brief Invoke this function to receive callbacks when a ROCm library registers its API
|
||||
* intercept table with rocprofiler. Use the @ref rocprofiler_runtime_library_t enumeration for
|
||||
* intercept table with rocprofiler. Use the @ref rocprofiler_intercept_table_t enumeration for
|
||||
* specifying which raw API tables the tool would like to have access to. E.g. including @ref
|
||||
* ROCPROFILER_HSA_LIBRARY in the @ref rocprofiler_at_runtime_api_registration function call
|
||||
* ROCPROFILER_HSA_TABLE in the @ref rocprofiler_at_intercept_table_registration function call
|
||||
* communicates to rocprofiler that, when rocprofiler receives a `HsaApiTable` instance, the tool
|
||||
* would like rocprofiler to provide it access too.
|
||||
*
|
||||
@@ -81,41 +81,42 @@ typedef void (*rocprofiler_intercept_library_cb_t)(rocprofiler_runtime_library_t
|
||||
* `rocprofiler_configure` symbol is visible in the application's symbol table. The vast majority of
|
||||
* tools will want to use the @ref CALLBACK_TRACING_SERVICE to trace these runtime APIs, however,
|
||||
* some tools may want or require installing their own intercept functions in lieu of receiving
|
||||
* these callbacks and those tools should use the @ref rocprofiler_at_runtime_api_registration to
|
||||
* install their intercept functions. There are no restrictions to where or how early this function
|
||||
* can be invoked but it will return ::ROCPROFILER_STATUS_ERROR_CONFIGURATION_LOCKED if it is
|
||||
* invoked after rocprofiler has requested all the tool configurations. Thus, it is highly
|
||||
* these callbacks and those tools should use the @ref rocprofiler_at_intercept_table_registration
|
||||
* to install their intercept functions. There are no restrictions to where or how early this
|
||||
* function can be invoked but it will return ::ROCPROFILER_STATUS_ERROR_CONFIGURATION_LOCKED if it
|
||||
* is invoked after rocprofiler has requested all the tool configurations. Thus, it is highly
|
||||
* recommended to invoke this function within the @ref rocprofiler_configure function or the
|
||||
* callback passed to the @ref rocprofiler_force_configure function -- the reason for this
|
||||
* recommendation is that if @ref rocprofiler_at_runtime_api_registration is invoked in one of these
|
||||
* locations, rocprofiler can guarantee that the tool will be passed the API table because, at the
|
||||
* first instance of a runtime registering it's API table, rocprofiler will ensure that, in the case
|
||||
* of the former, rocprofiler will invoke all of the @ref rocprofiler_configure symbols that are
|
||||
* visible before checking the list of tools which want to receive the API tables and, in the case
|
||||
* of the latter, @ref rocprofiler_force_configure will fail with error code @ref
|
||||
* recommendation is that if @ref rocprofiler_at_intercept_table_registration is invoked in one of
|
||||
* these locations, rocprofiler can guarantee that the tool will be passed the API table because, at
|
||||
* the first instance of a runtime registering it's API table, rocprofiler will ensure that, in the
|
||||
* case of the former, rocprofiler will invoke all of the @ref rocprofiler_configure symbols that
|
||||
* are visible before checking the list of tools which want to receive the API tables and, in the
|
||||
* case of the latter, @ref rocprofiler_force_configure will fail with error code @ref
|
||||
* ROCPROFILER_STATUS_ERROR_CONFIGURATION_LOCKED if a runtime has already been registered (and,
|
||||
* therefore, already scanned and invoked the visible @ref rocprofiler_configure symbols and
|
||||
* completed the tool initialization). If @ref rocprofiler_at_runtime_api_registration is invoked
|
||||
* outside of these recommended places, even if it is done before the `main` function starts (e.g.
|
||||
* in a library init/constructor function), it is possible that another library, such as ROCm-aware
|
||||
* MPI, caused the HIP and HSA runtime libraries to be initialized when that library was loaded. In
|
||||
* this aforementioned scenario, if the ROCm-aware MPI library library init/constructor function
|
||||
* runs before your library init/constructor function, rocprofiler will have already processed the
|
||||
* API table and will not provide the API table to the tool due to the fact that the API may already
|
||||
* be in use and, thus, any modifications to the table might result in thread-safety violations or
|
||||
* more disastrous consequences.
|
||||
* completed the tool initialization). If @ref rocprofiler_at_intercept_table_registration is
|
||||
* invoked outside of these recommended places, even if it is done before the `main` function starts
|
||||
* (e.g. in a library init/constructor function), it is possible that another library, such as
|
||||
* ROCm-aware MPI, caused the HIP and HSA runtime libraries to be initialized when that library was
|
||||
* loaded. In this aforementioned scenario, if the ROCm-aware MPI library library init/constructor
|
||||
* function runs before your library init/constructor function, rocprofiler will have already
|
||||
* processed the API table and will not provide the API table to the tool due to the fact that the
|
||||
* API may already be in use and, thus, any modifications to the table might result in thread-safety
|
||||
* violations or more disastrous consequences.
|
||||
*
|
||||
* @param [in] callback Callback to tool invoked when a runtime registers their API table with
|
||||
* rocprofiler
|
||||
* @param [in] libs Bitwise-or of libraries, e.g. `ROCPROFILER_HSA_LIBRARY | ROCPROFILER_HIP_LIBRARY
|
||||
* | ROCPROFILER_MARKER_LIBRARY` means the callbacks will be invoked whenever the HSA, HIP, and
|
||||
* ROCTx libraries register the intercept table.
|
||||
* @param [in] libs Bitwise-or of libraries, e.g. `ROCPROFILER_HSA_TABLE |
|
||||
* ROCPROFILER_HIP_RUNTIME_TABLE | ROCPROFILER_MARKER_CORE_TABLE` means the callbacks will be
|
||||
* invoked whenever the HSA, HIP runtime, and ROCTx core API tables register their intercept
|
||||
* table(s).
|
||||
* @param [in] data Data to provide to callback(s)
|
||||
* @return ::rocprofiler_status_t
|
||||
* @retval ::ROCPROFILER_STATUS_SUCCESS Callback was registered for specified runtime(s)
|
||||
* @retval ::ROCPROFILER_STATUS_ERROR_CONFIGURATION_LOCKED rocprofiler has already initialized
|
||||
* @retval ::ROCPROFILER_STATUS_ERROR_INVALID_ARGUMENT this error code is returned if
|
||||
* `ROCPROFILER_LIBRARY` is included in bitwise-or of the libs
|
||||
* `ROCPROFILER_TABLE` is included in bitwise-or of the libs
|
||||
* @retval ::ROCPROFILER_STATUS_ERROR_NOT_IMPLEMENTED this error code is returned if one of the
|
||||
* specified libraries does not have support for API intercept tables (which should not be the case
|
||||
* by the time this code is publicly released)
|
||||
@@ -152,14 +153,14 @@ typedef void (*rocprofiler_intercept_library_cb_t)(rocprofiler_runtime_library_t
|
||||
* // this is the function that gets called when the HSA runtime
|
||||
* // intercept table is registered with rocprofiler
|
||||
* void
|
||||
* api_registration_callback(rocprofiler_runtime_library_t type,
|
||||
* api_registration_callback(rocprofiler_intercept_table_t type,
|
||||
* uint64_t lib_version,
|
||||
* uint64_t lib_instance,
|
||||
* void** tables,
|
||||
* uint64_t num_tables,
|
||||
* void* user_data)
|
||||
* {
|
||||
* if(type != ROCPROFILER_HSA_LIBRARY)
|
||||
* if(type != ROCPROFILER_HSA_TABLE)
|
||||
* throw std::runtime_error{"unexpected library type: " +
|
||||
* std::to_string(static_cast<int>(type))};
|
||||
* if(lib_instance != 0) throw std::runtime_error{"multiple instances of HSA runtime library"};
|
||||
@@ -203,20 +204,20 @@ typedef void (*rocprofiler_intercept_library_cb_t)(rocprofiler_runtime_library_t
|
||||
* id->name = "ExampleTool";
|
||||
*
|
||||
* // specify that we only want to intercept the HSA library
|
||||
* rocprofiler_at_runtime_api_registration(api_registration_callback,
|
||||
* ROCPROFILER_HSA_LIBRARY, nullptr);
|
||||
* rocprofiler_at_intercept_table_registration(api_registration_callback,
|
||||
* ROCPROFILER_HSA_TABLE, nullptr);
|
||||
*
|
||||
* return nullptr;
|
||||
* }
|
||||
* @endcode
|
||||
*
|
||||
* @example intercept_table/client.cpp
|
||||
* Example demonstrating @ref rocprofiler_at_runtime_api_registration usage
|
||||
* Example demonstrating @ref rocprofiler_at_intercept_table_registration usage
|
||||
*/
|
||||
rocprofiler_status_t
|
||||
rocprofiler_at_runtime_api_registration(rocprofiler_intercept_library_cb_t callback,
|
||||
int libs,
|
||||
void* data) ROCPROFILER_API;
|
||||
rocprofiler_at_intercept_table_registration(rocprofiler_intercept_library_cb_t callback,
|
||||
int libs,
|
||||
void* data) ROCPROFILER_API;
|
||||
|
||||
/** @} */
|
||||
|
||||
|
||||
@@ -29,9 +29,9 @@
|
||||
|
||||
typedef union rocprofiler_marker_api_retval_u
|
||||
{
|
||||
int32_t int32_t_retval;
|
||||
int64_t int64_t_retval;
|
||||
uint64_t uint64_t_retval;
|
||||
int32_t int32_t_retval;
|
||||
int64_t int64_t_retval;
|
||||
roctx_range_id_t roctx_range_id_t_retval;
|
||||
} rocprofiler_marker_api_retval_t;
|
||||
|
||||
typedef union rocprofiler_marker_api_args_u
|
||||
@@ -56,6 +56,10 @@ typedef union rocprofiler_marker_api_args_u
|
||||
roctx_range_id_t id;
|
||||
} roctxRangeStop;
|
||||
struct
|
||||
{
|
||||
roctx_thread_id_t* tid;
|
||||
} roctxGetThreadId;
|
||||
struct
|
||||
{
|
||||
roctx_thread_id_t tid;
|
||||
} roctxProfilerPause;
|
||||
@@ -82,8 +86,4 @@ typedef union rocprofiler_marker_api_args_u
|
||||
const char* name;
|
||||
const struct ihipStream_t* stream;
|
||||
} roctxNameHipStream;
|
||||
struct
|
||||
{
|
||||
roctx_thread_id_t* tid;
|
||||
} roctxGetThreadId;
|
||||
} rocprofiler_marker_api_args_t;
|
||||
|
||||
@@ -27,18 +27,30 @@
|
||||
*/
|
||||
typedef enum // NOLINT(performance-enum-size)
|
||||
{
|
||||
ROCPROFILER_MARKER_API_ID_NONE = -1,
|
||||
ROCPROFILER_MARKER_API_ID_roctxMarkA = 0,
|
||||
ROCPROFILER_MARKER_API_ID_roctxRangePushA,
|
||||
ROCPROFILER_MARKER_API_ID_roctxRangePop,
|
||||
ROCPROFILER_MARKER_API_ID_roctxRangeStartA,
|
||||
ROCPROFILER_MARKER_API_ID_roctxRangeStop,
|
||||
ROCPROFILER_MARKER_API_ID_roctxProfilerPause,
|
||||
ROCPROFILER_MARKER_API_ID_roctxProfilerResume,
|
||||
ROCPROFILER_MARKER_API_ID_roctxNameOsThread,
|
||||
ROCPROFILER_MARKER_API_ID_roctxNameHsaAgent,
|
||||
ROCPROFILER_MARKER_API_ID_roctxNameHipDevice,
|
||||
ROCPROFILER_MARKER_API_ID_roctxNameHipStream,
|
||||
ROCPROFILER_MARKER_API_ID_roctxGetThreadId,
|
||||
ROCPROFILER_MARKER_API_ID_LAST,
|
||||
} rocprofiler_marker_api_id_t;
|
||||
ROCPROFILER_MARKER_CORE_API_ID_NONE = -1,
|
||||
ROCPROFILER_MARKER_CORE_API_ID_roctxMarkA = 0,
|
||||
ROCPROFILER_MARKER_CORE_API_ID_roctxRangePushA,
|
||||
ROCPROFILER_MARKER_CORE_API_ID_roctxRangePop,
|
||||
ROCPROFILER_MARKER_CORE_API_ID_roctxRangeStartA,
|
||||
ROCPROFILER_MARKER_CORE_API_ID_roctxRangeStop,
|
||||
ROCPROFILER_MARKER_CORE_API_ID_roctxGetThreadId,
|
||||
ROCPROFILER_MARKER_CORE_API_ID_LAST,
|
||||
} rocprofiler_marker_core_api_id_t;
|
||||
|
||||
typedef enum // NOLINT(performance-enum-size)
|
||||
{
|
||||
ROCPROFILER_MARKER_CONTROL_API_ID_NONE = -1,
|
||||
ROCPROFILER_MARKER_CONTROL_API_ID_roctxProfilerPause = 0,
|
||||
ROCPROFILER_MARKER_CONTROL_API_ID_roctxProfilerResume,
|
||||
ROCPROFILER_MARKER_CONTROL_API_ID_LAST,
|
||||
} rocprofiler_marker_control_api_id_t;
|
||||
|
||||
typedef enum // NOLINT(performance-enum-size)
|
||||
{
|
||||
ROCPROFILER_MARKER_NAME_API_ID_NONE = -1,
|
||||
ROCPROFILER_MARKER_NAME_API_ID_roctxNameOsThread = 0,
|
||||
ROCPROFILER_MARKER_NAME_API_ID_roctxNameHsaAgent,
|
||||
ROCPROFILER_MARKER_NAME_API_ID_roctxNameHipDevice,
|
||||
ROCPROFILER_MARKER_NAME_API_ID_roctxNameHipStream,
|
||||
ROCPROFILER_MARKER_NAME_API_ID_LAST,
|
||||
} rocprofiler_marker_name_api_id_t;
|
||||
|
||||
@@ -25,6 +25,9 @@
|
||||
// NOLINTNEXTLINE(performance-enum-size)
|
||||
typedef enum
|
||||
{
|
||||
ROCPROFILER_MARKER_API_TABLE_ID_NONE = -1,
|
||||
ROCPROFILER_MARKER_API_TABLE_ID_RoctxApi = 0,
|
||||
ROCPROFILER_MARKER_API_TABLE_ID_NONE = -1,
|
||||
ROCPROFILER_MARKER_API_TABLE_ID_RoctxCore = 0,
|
||||
ROCPROFILER_MARKER_API_TABLE_ID_RoctxControl,
|
||||
ROCPROFILER_MARKER_API_TABLE_ID_RoctxName,
|
||||
ROCPROFILER_MARKER_API_TABLE_ID_LAST,
|
||||
} rocprofiler_marker_table_api_id_t;
|
||||
|
||||
Fai riferimento in un nuovo problema
Block a user