[SDK] Add Stack IDs (#269)

* Add Stack IDs

* Add memcpy test

* Add async corr id record

* Async events use `rocprofiler_async_correlation_id_t`
* Sync events use `rocprofiler_correlation_id_t`

* Update ATT to use asnyc IDs

* Review comments
This commit is contained in:
Kuricheti, Mythreya
2025-03-20 22:52:48 -07:00
committed by GitHub
parent ae0db8cee5
commit f27f76716e
36 changed files with 341 additions and 67 deletions
@@ -55,13 +55,13 @@ typedef enum
* @param [out] userdata_shader Userdata to be passed in shader_callback
*/
typedef rocprofiler_att_control_flags_t (*rocprofiler_att_dispatch_callback_t)(
rocprofiler_agent_id_t agent_id,
rocprofiler_queue_id_t queue_id,
rocprofiler_correlation_id_t correlation_id,
rocprofiler_kernel_id_t kernel_id,
rocprofiler_dispatch_id_t dispatch_id,
void* userdata_config,
rocprofiler_user_data_t* userdata_shader);
rocprofiler_agent_id_t agent_id,
rocprofiler_queue_id_t queue_id,
rocprofiler_async_correlation_id_t correlation_id,
rocprofiler_kernel_id_t kernel_id,
rocprofiler_dispatch_id_t dispatch_id,
void* userdata_config,
rocprofiler_user_data_t* userdata_shader);
/**
* @brief Enables the advanced thread trace service for dispatch-based tracing.
@@ -228,7 +228,7 @@ typedef struct
uint64_t size; ///< size of this struct
rocprofiler_buffer_tracing_kind_t kind;
rocprofiler_memory_copy_operation_t operation;
rocprofiler_correlation_id_t correlation_id; ///< correlation ids for record
rocprofiler_async_correlation_id_t correlation_id; ///< correlation ids for record
rocprofiler_thread_id_t thread_id; ///< id for thread that triggered copy
rocprofiler_timestamp_t start_timestamp; ///< start time in nanoseconds
rocprofiler_timestamp_t end_timestamp; ///< end time in nanoseconds
@@ -276,7 +276,7 @@ typedef struct rocprofiler_buffer_tracing_kernel_dispatch_record_t
uint64_t size; ///< size of this struct
rocprofiler_buffer_tracing_kind_t kind; ///< ::ROCPROFILER_BUFFER_TRACING_KERNEL_DISPATCH
rocprofiler_kernel_dispatch_operation_t operation;
rocprofiler_correlation_id_t correlation_id; ///< correlation ids for record
rocprofiler_async_correlation_id_t correlation_id; ///< correlation ids for record
rocprofiler_thread_id_t thread_id; ///< id for thread that launched kernel
rocprofiler_timestamp_t start_timestamp; ///< start time in nanoseconds
rocprofiler_timestamp_t end_timestamp; ///< end time in nanoseconds
@@ -131,6 +131,15 @@ save(ArchiveT& ar, rocprofiler_counter_id_t data)
template <typename ArchiveT>
void
save(ArchiveT& ar, rocprofiler_correlation_id_t data)
{
ROCP_SDK_SAVE_DATA_FIELD(internal);
ROCP_SDK_SAVE_DATA_VALUE("external", external.value);
ROCP_SDK_SAVE_DATA_VALUE("ancestor", ancestor);
}
template <typename ArchiveT>
void
save(ArchiveT& ar, rocprofiler_async_correlation_id_t data)
{
ROCP_SDK_SAVE_DATA_FIELD(internal);
ROCP_SDK_SAVE_DATA_VALUE("external", external.value);
@@ -44,7 +44,7 @@ ROCPROFILER_EXTERN_C_INIT
typedef struct rocprofiler_dispatch_counting_service_data_t
{
uint64_t size; ///< Size of this struct
rocprofiler_correlation_id_t correlation_id; ///< Correlation ID for this dispatch
rocprofiler_async_correlation_id_t correlation_id; ///< Correlation ID for this dispatch
rocprofiler_timestamp_t start_timestamp; ///< start time in nanoseconds
rocprofiler_timestamp_t end_timestamp; ///< end time in nanoseconds
rocprofiler_kernel_dispatch_info_t dispatch_info; ///< Dispatch info
@@ -57,12 +57,12 @@ typedef struct rocprofiler_dispatch_counting_service_data_t
*/
typedef struct rocprofiler_dispatch_counting_service_record_t
{
uint64_t size; ///< Size of this struct
uint64_t num_records; ///< number of ::rocprofiler_record_counter_t records
rocprofiler_correlation_id_t correlation_id; ///< Correlation ID for this dispatch
rocprofiler_timestamp_t start_timestamp; ///< start time in nanoseconds
rocprofiler_timestamp_t end_timestamp; ///< end time in nanoseconds
rocprofiler_kernel_dispatch_info_t dispatch_info; ///< Contains the `dispatch_id`
uint64_t size; ///< Size of this struct
uint64_t num_records; ///< number of ::rocprofiler_record_counter_t records
rocprofiler_async_correlation_id_t correlation_id; ///< Correlation ID for this dispatch
rocprofiler_timestamp_t start_timestamp; ///< start time in nanoseconds
rocprofiler_timestamp_t end_timestamp; ///< end time in nanoseconds
rocprofiler_kernel_dispatch_info_t dispatch_info; ///< Contains the `dispatch_id`
} rocprofiler_dispatch_counting_service_record_t;
/**
+30
View File
@@ -605,13 +605,43 @@ typedef struct rocprofiler_correlation_id_t
{
uint64_t internal;
rocprofiler_user_data_t external;
uint64_t ancestor;
/// @var internal
/// @brief A unique ID created by rocprofiler-sdk when an API call is invoked.
/// @var external
/// @brief An ID specified by tools to associate external events.
/// See include/rocprofiler-sdk/external_correlation.h
/// @var ancestor
/// @brief Stores the ::internal value of the API call that generated this
/// API call.
} rocprofiler_correlation_id_t;
/**
* @brief ROCProfiler Correlation ID record for async activity.
*/
typedef struct rocprofiler_async_correlation_id_t
{
uint64_t internal;
rocprofiler_user_data_t external;
/// @var internal
/// @brief A unique ID created by rocprofiler-sdk when an API call is invoked.
/// @var external
/// @brief An ID specified by tools to associate external events.
/// See include/rocprofiler-sdk/external_correlation.h
} rocprofiler_async_correlation_id_t;
/**
* @brief The NULL value of an internal correlation ID.
*/
#define ROCPROFILER_CORRELATION_ID_INTERNAL_NONE ROCPROFILER_UINT64_C(0)
/**
* @brief The NULL value of an ancestor correlation ID.
*/
#define ROCPROFILER_CORRELATION_ID_ANCESTOR_NONE ROCPROFILER_UINT64_C(0)
/**
* @struct rocprofiler_buffer_id_t
* @brief Buffer ID.
+7 -4
View File
@@ -254,10 +254,13 @@ typedef struct rocprofiler_pc_sampling_record_host_trap_v0_t
uint64_t exec_mask; ///< active SIMD lanes when sampled
uint64_t timestamp; ///< timestamp when sample is generated
uint64_t dispatch_id; ///< originating kernel dispatch ID
rocprofiler_correlation_id_t correlation_id; ///< API launch call id that matches dispatch ID
rocprofiler_dim3_t workgroup_id; ///< wave coordinates within the workgroup
uint32_t wave_in_group : 8; ///< wave position within the workgroup (0-31)
uint32_t reserved0 : 24; ///< wave position within the workgroup (0-31)
rocprofiler_async_correlation_id_t correlation_id;
rocprofiler_dim3_t workgroup_id; ///< wave coordinates within the workgroup
uint32_t wave_in_group : 8; ///< wave position within the workgroup (0-31)
uint32_t reserved0 : 24; ///< wave position within the workgroup (0-31)
/// @var correlation_id
/// @brief API launch call id that matches dispatch ID
} rocprofiler_pc_sampling_record_host_trap_v0_t;
/** @} */