[RSERP-1802] Add trace decoder to API (#398)

* Add trace decoder to API.

* Cleanup and activity

* Rename

* Minor fix

* Replace tt/TT with thread_trace/THREAD_TRACE

- public API types are not abbreviated

* Fix aliases

* Build system updates

- activate clang-tidy for all subfolders in lib
- fix addition of sources for att-tool

* Fix clang-tidy issues with lib/att-tool/counters.{hpp,cpp}

* Delete counters.cpp

* Formatting

---------

Co-authored-by: Giovanni Baraldi <gbaraldi@amd.com>
Co-authored-by: Jonathan R. Madsen <jonathanrmadsen@gmail.com>
Este commit está contenido en:
Baraldi, Giovanni
2025-05-17 21:08:33 +02:00
cometido por GitHub
padre 3eb921a34c
commit 65786f619d
Se han modificado 56 ficheros con 1175 adiciones y 1419 borrados
@@ -365,11 +365,19 @@ public:
table.insert({ptr->begin(), ptr->size(), id});
}
virtual bool removeDecoder(marker_id_t id, uint64_t load_addr)
bool removeDecoder(marker_id_t id, uint64_t load_addr)
{
return table.remove(load_addr) && this->Super::removeDecoderbyId(id);
}
bool removeDecoder(marker_id_t id)
{
uint64_t addr = 0;
if(decoders.find(id) != decoders.end()) addr = decoders.at(id)->begin();
return removeDecoder(id, addr);
}
std::unique_ptr<Instruction> get(uint64_t vaddr)
{
auto addr_range = table.find_codeobj_in_range(vaddr);
+13 -13
Ver fichero
@@ -1111,8 +1111,8 @@ ROCPROFILER_ENUM_INFO(rocprofiler_page_migration_queue_suspend_trigger_t, ROCPRO
ROCPROFILER_ENUM_INFO(rocprofiler_page_migration_unmap_from_gpu_trigger_t, ROCPROFILER_PAGE_MIGRATION_UNMAP_FROM_GPU_TRIGGER_NONE, ROCPROFILER_PAGE_MIGRATION_UNMAP_FROM_GPU_TRIGGER_LAST, false);
ROCPROFILER_ENUM_INFO(rocprofiler_external_correlation_id_request_kind_t, ROCPROFILER_EXTERNAL_CORRELATION_REQUEST_NONE, ROCPROFILER_EXTERNAL_CORRELATION_REQUEST_LAST, false);
ROCPROFILER_ENUM_INFO(rocprofiler_att_parameter_type_t, ROCPROFILER_ATT_PARAMETER_TARGET_CU, ROCPROFILER_ATT_PARAMETER_LAST, false);
// ROCPROFILER_ENUM_INFO(rocprofiler_att_control_flags_t, ROCPROFILER_ATT_CONTROL_NONE, details::compute_bitset_sequence_range<ROCPROFILER_ATT_CONTROL_START_AND_STOP>(), true);
ROCPROFILER_ENUM_INFO(rocprofiler_thread_trace_parameter_type_t, ROCPROFILER_THREAD_TRACE_PARAMETER_TARGET_CU, ROCPROFILER_THREAD_TRACE_PARAMETER_LAST, false);
// ROCPROFILER_ENUM_INFO(rocprofiler_thread_trace_control_flags_t, ROCPROFILER_THREAD_TRACE_CONTROL_NONE, details::compute_bitset_sequence_range<ROCPROFILER_THREAD_TRACE_CONTROL_START_AND_STOP>(), true);
ROCPROFILER_ENUM_INFO(rocprofiler_agent_version_t, ROCPROFILER_AGENT_INFO_VERSION_NONE, ROCPROFILER_AGENT_INFO_VERSION_LAST, false);
@@ -1441,18 +1441,18 @@ ROCPROFILER_ENUM_LABEL(ROCPROFILER_EXTERNAL_CORRELATION_REQUEST_ROCDECODE_API);
ROCPROFILER_ENUM_LABEL(ROCPROFILER_EXTERNAL_CORRELATION_REQUEST_ROCJPEG_API);
static_assert(ROCPROFILER_EXTERNAL_CORRELATION_REQUEST_LAST == 18);
// rocprofiler_att_parameter_type_t
ROCPROFILER_ENUM_LABEL(ROCPROFILER_ATT_PARAMETER_TARGET_CU);
ROCPROFILER_ENUM_LABEL(ROCPROFILER_ATT_PARAMETER_SHADER_ENGINE_MASK);
ROCPROFILER_ENUM_LABEL(ROCPROFILER_ATT_PARAMETER_BUFFER_SIZE);
ROCPROFILER_ENUM_LABEL(ROCPROFILER_ATT_PARAMETER_SIMD_SELECT);
ROCPROFILER_ENUM_LABEL(ROCPROFILER_ATT_PARAMETER_PERFCOUNTERS_CTRL);
ROCPROFILER_ENUM_LABEL(ROCPROFILER_ATT_PARAMETER_PERFCOUNTER);
ROCPROFILER_ENUM_LABEL(ROCPROFILER_ATT_PARAMETER_SERIALIZE_ALL);
static_assert(ROCPROFILER_ATT_PARAMETER_LAST == 7);
// rocprofiler_thread_trace_parameter_type_t
ROCPROFILER_ENUM_LABEL(ROCPROFILER_THREAD_TRACE_PARAMETER_TARGET_CU);
ROCPROFILER_ENUM_LABEL(ROCPROFILER_THREAD_TRACE_PARAMETER_SHADER_ENGINE_MASK);
ROCPROFILER_ENUM_LABEL(ROCPROFILER_THREAD_TRACE_PARAMETER_BUFFER_SIZE);
ROCPROFILER_ENUM_LABEL(ROCPROFILER_THREAD_TRACE_PARAMETER_SIMD_SELECT);
ROCPROFILER_ENUM_LABEL(ROCPROFILER_THREAD_TRACE_PARAMETER_PERFCOUNTERS_CTRL);
ROCPROFILER_ENUM_LABEL(ROCPROFILER_THREAD_TRACE_PARAMETER_PERFCOUNTER);
ROCPROFILER_ENUM_LABEL(ROCPROFILER_THREAD_TRACE_PARAMETER_SERIALIZE_ALL);
static_assert(ROCPROFILER_THREAD_TRACE_PARAMETER_LAST == 7);
ROCPROFILER_ENUM_LABEL(ROCPROFILER_ATT_CONTROL_NONE);
ROCPROFILER_ENUM_LABEL(ROCPROFILER_ATT_CONTROL_START_AND_STOP);
ROCPROFILER_ENUM_LABEL(ROCPROFILER_THREAD_TRACE_CONTROL_NONE);
ROCPROFILER_ENUM_LABEL(ROCPROFILER_THREAD_TRACE_CONTROL_START_AND_STOP);
// rocprofiler_agent_version_t
ROCPROFILER_ENUM_LABEL(ROCPROFILER_AGENT_INFO_VERSION_NONE);
@@ -1,4 +1,5 @@
set(ROCPROFILER_EXPERIMENTAL_THREAD_TRACE_HEADER_FILES core.h agent.h dispatch.h)
set(ROCPROFILER_EXPERIMENTAL_THREAD_TRACE_HEADER_FILES
core.h agent.h dispatch.h trace_decoder_types.h trace_decoder.h)
install(
FILES ${ROCPROFILER_EXPERIMENTAL_THREAD_TRACE_HEADER_FILES}
@@ -54,16 +54,17 @@ ROCPROFILER_EXTERN_C_INIT
* @retval ROCPROFILER_STATUS_ERROR_CONFIGURATION_LOCKED for configuration locked
* @retval ROCPROFILER_STATUS_ERROR_CONTEXT_INVALID for conflicting configurations in the same ctx
* @retval ROCPROFILER_STATUS_ERROR_CONTEXT_NOT_FOUND for invalid context id
* @retval ROCPROFILER_STATUS_ERROR_INVALID_ARGUMENT for invalid rocprofiler_att_parameter_t
* @retval ROCPROFILER_STATUS_ERROR_INVALID_ARGUMENT for invalid
* rocprofiler_thread_trace_parameter_t
*/
rocprofiler_status_t
rocprofiler_configure_device_thread_trace_service(
rocprofiler_context_id_t context_id,
rocprofiler_agent_id_t agent_id,
rocprofiler_att_parameter_t* parameters,
size_t num_parameters,
rocprofiler_att_shader_data_callback_t shader_callback,
rocprofiler_user_data_t callback_userdata) ROCPROFILER_API;
rocprofiler_context_id_t context_id,
rocprofiler_agent_id_t agent_id,
rocprofiler_thread_trace_parameter_t* parameters,
size_t num_parameters,
rocprofiler_thread_trace_shader_data_callback_t shader_callback,
rocprofiler_user_data_t callback_userdata) ROCPROFILER_API;
/** @} */
@@ -37,28 +37,29 @@ ROCPROFILER_EXTERN_C_INIT
*/
/**
* @brief Types of ATT parameters
* @brief Types of Thread Trace parameters
*
*/
typedef enum rocprofiler_att_parameter_type_t
typedef enum rocprofiler_thread_trace_parameter_type_t
{
ROCPROFILER_ATT_PARAMETER_TARGET_CU = 0, ///< Select the Target CU or WGP
ROCPROFILER_ATT_PARAMETER_SHADER_ENGINE_MASK, ///< Bitmask of shader engines.
ROCPROFILER_ATT_PARAMETER_BUFFER_SIZE, ///< Size of combined GPU buffer for ATT
ROCPROFILER_ATT_PARAMETER_SIMD_SELECT, ///< Bitmask (GFX9) or ID (Navi) of SIMDs
ROCPROFILER_ATT_PARAMETER_PERFCOUNTERS_CTRL, ///< Period [1,32] or disable (0) perfmon
ROCPROFILER_ATT_PARAMETER_PERFCOUNTER, ///< Perfmon ID and SIMD mask
ROCPROFILER_ATT_PARAMETER_SERIALIZE_ALL, ///< Serializes kernels not under thread trace
ROCPROFILER_ATT_PARAMETER_LAST
} rocprofiler_att_parameter_type_t;
ROCPROFILER_THREAD_TRACE_PARAMETER_TARGET_CU = 0, ///< Select the Target CU or WGP
ROCPROFILER_THREAD_TRACE_PARAMETER_SHADER_ENGINE_MASK, ///< Bitmask of shader engines.
ROCPROFILER_THREAD_TRACE_PARAMETER_BUFFER_SIZE, ///< Size of combined GPU buffer for ATT
ROCPROFILER_THREAD_TRACE_PARAMETER_SIMD_SELECT, ///< Bitmask (GFX9) or ID (Navi) of SIMDs
ROCPROFILER_THREAD_TRACE_PARAMETER_PERFCOUNTERS_CTRL, ///< Period [1,32] or disable (0) perfmon
ROCPROFILER_THREAD_TRACE_PARAMETER_PERFCOUNTER, ///< Perfmon ID and SIMD mask
ROCPROFILER_THREAD_TRACE_PARAMETER_SERIALIZE_ALL, ///< Serializes kernels not under thread
///< trace
ROCPROFILER_THREAD_TRACE_PARAMETER_LAST
} rocprofiler_thread_trace_parameter_type_t;
/**
* @brief ATT parameter specification
* @brief Thread Trace parameter specification
*
*/
typedef struct rocprofiler_att_parameter_t
typedef struct rocprofiler_thread_trace_parameter_t
{
rocprofiler_att_parameter_type_t type;
rocprofiler_thread_trace_parameter_type_t type;
union
{
uint64_t value;
@@ -68,7 +69,7 @@ typedef struct rocprofiler_att_parameter_t
uint64_t simd_mask : 4;
};
};
} rocprofiler_att_parameter_t;
} rocprofiler_thread_trace_parameter_t;
/**
* @brief Callback to be triggered every time some ATT data is generated by the device
@@ -76,13 +77,13 @@ typedef struct rocprofiler_att_parameter_t
* @param [in] shader_engine_id ID of shader engine, as enabled by SE_MASK
* @param [in] data Pointer to the buffer containing the ATT data
* @param [in] data_size Number of bytes in "data"
* @param [in] userdata Passed back to user from rocprofiler_att_dispatch_callback_t()
* @param [in] userdata Passed back to user from rocprofiler_thread_trace_dispatch_callback_t()
*/
typedef void (*rocprofiler_att_shader_data_callback_t)(rocprofiler_agent_id_t agent,
int64_t shader_engine_id,
void* data,
size_t data_size,
rocprofiler_user_data_t userdata);
typedef void (*rocprofiler_thread_trace_shader_data_callback_t)(rocprofiler_agent_id_t agent,
int64_t shader_engine_id,
void* data,
size_t data_size,
rocprofiler_user_data_t userdata);
/** @} */
@@ -37,11 +37,11 @@ ROCPROFILER_EXTERN_C_INIT
* @{
*/
typedef enum rocprofiler_att_control_flags_t
typedef enum rocprofiler_thread_trace_control_flags_t
{
ROCPROFILER_ATT_CONTROL_NONE = 0,
ROCPROFILER_ATT_CONTROL_START_AND_STOP = 3
} rocprofiler_att_control_flags_t;
ROCPROFILER_THREAD_TRACE_CONTROL_NONE = 0,
ROCPROFILER_THREAD_TRACE_CONTROL_START_AND_STOP = 3
} rocprofiler_thread_trace_control_flags_t;
/**
* @brief Callback to be triggered every kernel dispatch, indicating to start and/or stop ATT
@@ -54,7 +54,7 @@ typedef enum rocprofiler_att_control_flags_t
* rocprofiler_configure_dispatch_thread_trace_service.
* @param [out] userdata_shader Userdata to be passed in shader_callback
*/
typedef rocprofiler_att_control_flags_t (*rocprofiler_att_dispatch_callback_t)(
typedef rocprofiler_thread_trace_control_flags_t (*rocprofiler_thread_trace_dispatch_callback_t)(
rocprofiler_agent_id_t agent_id,
rocprofiler_queue_id_t queue_id,
rocprofiler_async_correlation_id_t correlation_id,
@@ -64,14 +64,14 @@ typedef rocprofiler_att_control_flags_t (*rocprofiler_att_dispatch_callback_t)(
rocprofiler_user_data_t* userdata_shader);
/**
* @brief Enables the advanced thread trace service for dispatch-based tracing.
* @brief Enables the thread trace service for dispatch-based tracing.
* The tool has an option to enable/disable thread trace on every dispatch callback.
* This service serializes all traced kernels, and optionally all non-traced kernels.
* @param [in] context_id id of the context used for start/stop thread_trace.
* @param [in] agent_id rocprofiler_agent_id_t to configure thread trace.
* @param [in] parameters List of ATT-specific parameters.
* @param [in] num_parameters Number of parameters. Zero is allowed.
* @param [in] dispatch_callback Control fn which decides when ATT starts/stop collecting.
* @param [in] dispatch_callback Control fn which decides when TT starts/stop collecting.
* @param [in] shader_callback Callback fn where the collected data will be sent to.
* @param [in] callback_userdata Passed back to user in dispatch_callback.
* @return ::rocprofiler_status_t
@@ -79,18 +79,19 @@ typedef rocprofiler_att_control_flags_t (*rocprofiler_att_dispatch_callback_t)(
* @retval ROCPROFILER_STATUS_ERROR_CONFIGURATION_LOCKED for configuration locked
* @retval ROCPROFILER_STATUS_ERROR_CONTEXT_INVALID for conflicting configurations in the same ctx
* @retval ROCPROFILER_STATUS_ERROR_CONTEXT_NOT_FOUND for invalid context id
* @retval ROCPROFILER_STATUS_ERROR_INVALID_ARGUMENT for invalid rocprofiler_att_parameter_t
* @retval ROCPROFILER_STATUS_ERROR_INVALID_ARGUMENT for invalid
* rocprofiler_thread_trace_parameter_t
* @retval ROCPROFILER_STATUS_ERROR_SERVICE_ALREADY_CONFIGURED if already configured
*/
rocprofiler_status_t
rocprofiler_configure_dispatch_thread_trace_service(
rocprofiler_context_id_t context_id,
rocprofiler_agent_id_t agent_id,
rocprofiler_att_parameter_t* parameters,
size_t num_parameters,
rocprofiler_att_dispatch_callback_t dispatch_callback,
rocprofiler_att_shader_data_callback_t shader_callback,
void* callback_userdata) ROCPROFILER_API;
rocprofiler_context_id_t context_id,
rocprofiler_agent_id_t agent_id,
rocprofiler_thread_trace_parameter_t* parameters,
size_t num_parameters,
rocprofiler_thread_trace_dispatch_callback_t dispatch_callback,
rocprofiler_thread_trace_shader_data_callback_t shader_callback,
void* callback_userdata) ROCPROFILER_API;
/** @} */
@@ -0,0 +1,131 @@
// MIT License
//
// Copyright (c) 2024-2025 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/experimental/thread-trace/trace_decoder_types.h>
#include <rocprofiler-sdk/fwd.h>
ROCPROFILER_EXTERN_C_INIT
/**
* @defgroup THREAD_TRACE Thread Trace Decoding
* @brief Provides API calls to decode thread trace data
*
* @{
*/
typedef struct rocprofiler_thread_trace_decoder_handle_t
{
uint64_t handle;
} rocprofiler_thread_trace_decoder_handle_t;
/**
* @brief Initializes Trace Decoder library
* @param[out] handle Handle to created decoder instance.
* @param[in] path Path to trace decoder library location (e.g. /opt/rocm/lib).
* @retval ::ROCPROFILER_STATUS_ERROR_NOT_AVAILABLE Library not found
* @retval ::ROCPROFILER_STATUS_ERROR_INCOMPATIBLE_ABI Library found but version not supported
* @retval ::ROCPROFILER_STATUS_SUCCESS Handle created
*/
rocprofiler_status_t
rocprofiler_thread_trace_decoder_create(rocprofiler_thread_trace_decoder_handle_t* handle,
const char* path) ROCPROFILER_API ROCPROFILER_NONNULL(1, 2);
/**
* @brief Deletes handle created by rocprofiler_thread_trace_decoder_create
* @param[in] handle Handle to destroy
*/
void
rocprofiler_thread_trace_decoder_destroy(rocprofiler_thread_trace_decoder_handle_t handle)
ROCPROFILER_API;
/**
* @brief Loads a code object binary to match with Thread Trace
* @param[in] handle Handle to decoder instance.
* @param[in] load_id Code object load ID.
* @param[in] load_addr Code object load address.
* @param[in] load_size Code object load size.
* @param[in] data Code object binary data. Must be at least load_size bytes.
* @retval ::ROCPROFILER_STATUS_ERROR Unable to load code object.
* @retval ::ROCPROFILER_STATUS_ERROR_INVALID_ARGUMENT Invalid handle
* @retval ::ROCPROFILER_STATUS_SUCCESS Code object loaded
*/
rocprofiler_status_t
rocprofiler_thread_trace_decoder_codeobj_load(rocprofiler_thread_trace_decoder_handle_t handle,
uint64_t load_id,
uint64_t load_addr,
uint64_t load_size,
const void* data,
uint64_t size) ROCPROFILER_API ROCPROFILER_NONNULL(5);
/**
* @brief Unloads a code object binary
* @param[in] handle Handle to decoder instance.
* @param[in] load_id Code object load ID to remove.
* @retval ::ROCPROFILER_STATUS_ERROR Code object not loaded.
* @retval ::ROCPROFILER_STATUS_ERROR_INVALID_ARGUMENT Invalid handle
* @retval ::ROCPROFILER_STATUS_SUCCESS Code object unloaded
*/
rocprofiler_status_t
rocprofiler_thread_trace_decoder_codeobj_unload(rocprofiler_thread_trace_decoder_handle_t handle,
uint64_t load_id) ROCPROFILER_API;
/**
* @brief Callback for rocprofiler to return traces back to rocprofiler.
* @param[in] trace_type_id One of rocprofiler_thread_trace_decoder_record_type_t
* @param[in] trace_events A pointer to sequence of events, of size trace_size.
* @param[in] trace_size The number of events in the trace.
* @param[in] userdata Arbitrary data pointer to be sent back to the user via callback.
*/
typedef void (*rocprofiler_thread_trace_decoder_callback_t)(
rocprofiler_thread_trace_decoder_record_type_t record_type_id,
void* trace_events,
uint64_t trace_size,
void* userdata);
/**
* @brief Iterate over all event coordinates for a given agent_t and event_t.
* @param[in] se_data_callback Callback to return shader engine data from.
* @param[in] callback Decoded trace data returned to user.
* @param[in] data Thread trace binary data.
* @param[in] size Thread trace binary size.
* @param[in] userdata Userdata passed back to caller via callback.
*/
rocprofiler_status_t
rocprofiler_trace_decode(rocprofiler_thread_trace_decoder_handle_t handle,
rocprofiler_thread_trace_decoder_callback_t callback,
void* data,
uint64_t size,
void* userdata) ROCPROFILER_API ROCPROFILER_NONNULL(2, 3);
/**
* @brief Returns the description of a rocprofiler_thread_trace_decoder_info_t record.
* @param[in] info The decoder info received
* @retval null terminated string as description of "info".
*/
const char*
rocprofiler_thread_trace_decoder_info_string(rocprofiler_thread_trace_decoder_handle_t handle,
rocprofiler_thread_trace_decoder_info_t info)
ROCPROFILER_API;
ROCPROFILER_EXTERN_C_FINI
@@ -0,0 +1,142 @@
// MIT License
//
// Copyright (c) 2024-2025 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 <stddef.h>
#include <stdint.h>
typedef enum rocprofiler_thread_trace_decoder_info_t
{
ROCPROFILER_THREAD_TRACE_DECODER_INFO_NONE = 0,
ROCPROFILER_THREAD_TRACE_DECODER_INFO_DATA_LOST,
ROCPROFILER_THREAD_TRACE_DECODER_INFO_STITCH_INCOMPLETE,
ROCPROFILER_THREAD_TRACE_DECODER_INFO_LAST
} rocprofiler_thread_trace_decoder_info_t;
typedef struct rocprofiler_thread_trace_decoder_pc_t
{
size_t addr;
size_t marker_id;
} rocprofiler_thread_trace_decoder_pc_t;
typedef struct rocprofiler_thread_trace_decoder_perfevent_t
{
int64_t time;
uint16_t events0;
uint16_t events1;
uint16_t events2;
uint16_t events3;
uint8_t CU;
uint8_t bank;
} rocprofiler_thread_trace_decoder_perfevent_t;
typedef struct rocprofiler_thread_trace_decoder_occupancy_t
{
rocprofiler_thread_trace_decoder_pc_t pc;
uint64_t time;
uint8_t se;
uint8_t cu;
uint8_t simd;
uint8_t slot;
uint32_t start : 1;
uint32_t _rsvd : 31;
} rocprofiler_thread_trace_decoder_occupancy_t;
typedef enum rocprofiler_thread_trace_decoder_wstate_type_t
{
ROCPROFILER_THREAD_TRACE_DECODER_WSTATE_EMPTY = 0,
ROCPROFILER_THREAD_TRACE_DECODER_WSTATE_IDLE,
ROCPROFILER_THREAD_TRACE_DECODER_WSTATE_EXEC,
ROCPROFILER_THREAD_TRACE_DECODER_WSTATE_WAIT,
ROCPROFILER_THREAD_TRACE_DECODER_WSTATE_STALL,
ROCPROFILER_THREAD_TRACE_DECODER_WSTATE_LAST,
} rocprofiler_thread_trace_decoder_wstate_type_t;
typedef struct rocprofiler_thread_trace_decoder_wave_state_t
{
int32_t type; // One of rocprofiler_thread_trace_decoder_waveslot_state_type_t
int32_t duration;
} rocprofiler_thread_trace_decoder_wave_state_t;
typedef enum rocprofiler_thread_trace_decoder_inst_category_t
{
ROCPROFILER_THREAD_TRACE_DECODER_INST_NONE = 0,
ROCPROFILER_THREAD_TRACE_DECODER_INST_SMEM,
ROCPROFILER_THREAD_TRACE_DECODER_INST_SALU,
ROCPROFILER_THREAD_TRACE_DECODER_INST_VMEM,
ROCPROFILER_THREAD_TRACE_DECODER_INST_FLAT,
ROCPROFILER_THREAD_TRACE_DECODER_INST_LDS,
ROCPROFILER_THREAD_TRACE_DECODER_INST_VALU,
ROCPROFILER_THREAD_TRACE_DECODER_INST_JUMP,
ROCPROFILER_THREAD_TRACE_DECODER_INST_NEXT,
ROCPROFILER_THREAD_TRACE_DECODER_INST_IMMED,
ROCPROFILER_THREAD_TRACE_DECODER_INST_CONTEXT,
ROCPROFILER_THREAD_TRACE_DECODER_INST_MESSAGE,
ROCPROFILER_THREAD_TRACE_DECODER_INST_BVH,
ROCPROFILER_THREAD_TRACE_DECODER_INST_LAST
} rocprofiler_thread_trace_decoder_inst_category_t;
typedef struct rocprofiler_thread_trace_decoder_inst_t
{
uint32_t category : 8; // One of rocprofiler_thread_trace_decoder_inst_category_t
uint32_t stall : 24;
int32_t duration;
int64_t time;
rocprofiler_thread_trace_decoder_pc_t pc;
} rocprofiler_thread_trace_decoder_inst_t;
typedef struct rocprofiler_thread_trace_decoder_wave_t
{
uint8_t cu;
uint8_t simd;
uint8_t wave_id;
uint8_t contexts;
uint32_t _rsvd1;
uint32_t _rsvd2;
uint32_t _rsvd3;
int64_t begin_time;
int64_t end_time;
size_t timeline_size;
size_t instructions_size;
rocprofiler_thread_trace_decoder_wave_state_t* timeline_array;
rocprofiler_thread_trace_decoder_inst_t* instructions_array;
} rocprofiler_thread_trace_decoder_wave_t;
typedef enum rocprofiler_thread_trace_decoder_record_type_t
{
ROCPROFILER_THREAD_TRACE_DECODER_RECORD_GFXIP =
0, // Record is size_t representing the gfxip_major
ROCPROFILER_THREAD_TRACE_DECODER_RECORD_OCCUPANCY, // Record is pointer to
// rocprofiler_thread_trace_decoder_occupancy_t
ROCPROFILER_THREAD_TRACE_DECODER_RECORD_PERFEVENT, // Record is pointer to
// rocprofiler_thread_trace_decoder_perfevent_t
ROCPROFILER_THREAD_TRACE_DECODER_RECORD_WAVE, // Record is pointer to
// rocprofiler_thread_trace_decoder_wave_t
ROCPROFILER_THREAD_TRACE_DECODER_RECORD_INFO, // Record is pointer to
// rocprofiler_thread_trace_decoder_info_t
ROCPROFILER_THREAD_TRACE_DECODER_RECORD_DEBUG, // Debug
ROCPROFILER_THREAD_TRACE_DECODER_RECORD_LAST
} rocprofiler_thread_trace_decoder_record_type_t;
@@ -25,3 +25,4 @@
#include <rocprofiler-sdk/experimental/thread-trace/agent.h>
#include <rocprofiler-sdk/experimental/thread-trace/core.h>
#include <rocprofiler-sdk/experimental/thread-trace/dispatch.h>
#include <rocprofiler-sdk/experimental/thread-trace/trace_decoder.h>