rocDecode Buffer Tracing Support (#315)

* Added buffer tracing support for rocdecode and updated tests to work with buffer tracing

* Updated perfetto to output args individually rather than as a string list

* Updated docstrings and operation type, changed OTF2 code to remove warning due to change in operation type

* Updated tests for review comments

* Test args exist and return value

* Updated to use string entry

* Change function name

* Updated PR to reflect review comments

* Updated for PR review comments

* Change function name
This commit is contained in:
Trowbridge, Ian
2025-04-11 16:56:36 -05:00
کامیت شده توسط GitHub
والد 379d760fc1
کامیت 077723337a
28فایلهای تغییر یافته به همراه391 افزوده شده و 146 حذف شده
@@ -27,6 +27,8 @@
#include <rocprofiler-sdk/fwd.h>
#include <rocprofiler-sdk/hip/api_args.h>
#include <rocprofiler-sdk/kfd/page_migration_args.h>
#include <rocprofiler-sdk/rocdecode/api_args.h>
#include <rocprofiler-sdk/rocdecode/api_id.h>
#include <stdint.h>
@@ -213,7 +215,7 @@ typedef struct rocprofiler_buffer_tracing_rocdecode_api_record_t
{
uint64_t size; ///< size of this struct
rocprofiler_buffer_tracing_kind_t kind;
rocprofiler_tracing_operation_t operation;
rocprofiler_rocdecode_api_id_t operation;
rocprofiler_correlation_id_t correlation_id; ///< correlation ids for record
rocprofiler_timestamp_t start_timestamp; ///< start time in nanoseconds
rocprofiler_timestamp_t end_timestamp; ///< end time in nanoseconds
@@ -225,6 +227,29 @@ typedef struct rocprofiler_buffer_tracing_rocdecode_api_record_t
/// @brief Specification of the API function, e.g., ::rocprofiler_rocdecode_api_id_t
} rocprofiler_buffer_tracing_rocdecode_api_record_t;
/**
* @brief An extended ROCProfiler rocDecode API Tracer Record which includes function arguments.
* Pointers are not dereferenced.
*/
typedef struct rocprofiler_buffer_tracing_rocdecode_api_ext_record_t
{
uint64_t size; ///< size of this struct
rocprofiler_buffer_tracing_kind_t kind;
rocprofiler_rocdecode_api_id_t operation;
rocprofiler_correlation_id_t correlation_id; ///< correlation ids for record
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_rocdecode_api_args_t args; ///< arguments of function call
rocprofiler_rocdecode_api_retval_t retval; ///< return value of function call
/// @var kind
/// @brief ::ROCPROFILER_BUFFER_TRACING_ROCDECODE_API_EXT
/// @var operation
/// @brief Specification of the API function (@see
/// ::rocprofiler_rocdecode_api_id_t)
} rocprofiler_buffer_tracing_rocdecode_api_ext_record_t;
/**
* @brief ROCProfiler Buffer rocJPEG API Record.
*/
@@ -241,7 +266,8 @@ typedef struct rocprofiler_buffer_tracing_rocjpeg_api_record_t
/// @var kind
/// @brief ::ROCPROFILER_CALLBACK_TRACING_ROCJPEG_API
/// @var operation
/// @brief Specification of the API function, e.g., ::rocprofiler_rocjpeg_api_id_t
/// @brief Specification of the API function (@see
/// ::rocprofiler_rocjpeg_api_id_t)
} rocprofiler_buffer_tracing_rocjpeg_api_record_t;
/**
@@ -469,7 +469,7 @@ template <typename ArchiveT>
void
save(ArchiveT& ar, rocprofiler_rocdecode_api_retval_t data)
{
ROCP_SDK_SAVE_DATA_FIELD(rocDecStatus_retval);
ROCP_SDK_SAVE_DATA_FIELD(uint64_t_retval);
}
template <typename ArchiveT>
@@ -605,6 +605,16 @@ save(ArchiveT& ar, rocprofiler_buffer_tracing_rocdecode_api_record_t data)
save_buffer_tracing_api_record(ar, data);
}
template <typename ArchiveT>
void
save(ArchiveT& ar, rocprofiler_buffer_tracing_rocdecode_api_ext_record_t data)
{
save_buffer_tracing_api_record(ar, data);
auto args = sdk::serialization::get_buffer_tracing_args(data);
ROCP_SDK_SAVE_VALUE("args", args);
ROCP_SDK_SAVE_DATA_FIELD(retval);
}
template <typename ArchiveT>
void
save(ArchiveT& ar, rocprofiler_buffer_tracing_rocjpeg_api_record_t data)
@@ -211,6 +211,7 @@ typedef enum rocprofiler_buffer_tracing_kind_t // NOLINT(performance-enum-size)
ROCPROFILER_BUFFER_TRACING_HIP_STREAM, ///< @see ::rocprofiler_hip_stream_operation_t
ROCPROFILER_BUFFER_TRACING_HIP_RUNTIME_API_EXT,
ROCPROFILER_BUFFER_TRACING_HIP_COMPILER_API_EXT,
ROCPROFILER_BUFFER_TRACING_ROCDECODE_API_EXT,
ROCPROFILER_BUFFER_TRACING_LAST,
/// @var ROCPROFILER_BUFFER_TRACING_HIP_RUNTIME_API_EXT
@@ -219,6 +220,9 @@ typedef enum rocprofiler_buffer_tracing_kind_t // NOLINT(performance-enum-size)
/// @var ROCPROFILER_BUFFER_TRACING_HIP_COMPILER_API_EXT
/// @brief Similar to ROCPROFILER_BUFFER_TRACING_HIP_COMPILER_API except the buffer record
/// contains the function argument(s) and return value
/// @var ROCPROFILER_BUFFER_TRACING_ROCDECODE_API_EXT
/// @brief Similar to ROCPROFILER_BUFFER_TRACING_ROCDECODE_API except the buffer record
/// contains the function argument(s) and return value
} rocprofiler_buffer_tracing_kind_t;
/**
@@ -51,6 +51,7 @@ typedef struct rocprofiler_rocdecode_api_no_args
typedef union rocprofiler_rocdecode_api_retval_t
{
uint64_t uint64_t_retval;
int32_t rocDecStatus_retval;
const char* const_charp_retval;
} rocprofiler_rocdecode_api_retval_t;