rocprofiler-sdk/amd_detail/thread_trace_dispatch.h Source File

rocprofiler-sdk/amd_detail/thread_trace_dispatch.h Source File#

Rocprofiler SDK Developer API: rocprofiler-sdk/amd_detail/thread_trace_dispatch.h Source File
Rocprofiler SDK Developer API 0.6.0
ROCm Profiling API and tools
thread_trace_dispatch.h
Go to the documentation of this file.
1// MIT License
2//
3// Copyright (c) 2024-2025 Advanced Micro Devices, Inc. All rights reserved.
4//
5// Permission is hereby granted, free of charge, to any person obtaining a copy
6// of this software and associated documentation files (the "Software"), to deal
7// in the Software without restriction, including without limitation the rights
8// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9// copies of the Software, and to permit persons to whom the Software is
10// furnished to do so, subject to the following conditions:
11//
12// The above copyright notice and this permission notice shall be included in all
13// copies or substantial portions of the Software.
14//
15// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21// SOFTWARE.
22
23#pragma once
24
28#include <rocprofiler-sdk/fwd.h>
29#include <rocprofiler-sdk/hsa.h>
30
31ROCPROFILER_EXTERN_C_INIT
32
33/**
34 * @defgroup THREAD_TRACE Thread Trace Service
35 * @brief Provides API calls to enable and handle thread trace data
36 *
37 * @{
38 */
39
45
46/**
47 * @brief Callback to be triggered every kernel dispatch, indicating to start and/or stop ATT
48 * @param [in] agent_id agent_id.
49 * @param [in] queue_id queue_id.
50 * @param [in] correlation_id internal correlation id.
51 * @param [in] kernel_id kernel_id.
52 * @param [in] dispatch_id dispatch_id.
53 * @param [in] userdata_config Userdata passed back from
54 * rocprofiler_configure_dispatch_thread_trace_service.
55 * @param [out] userdata_shader Userdata to be passed in shader_callback
56 */
60 rocprofiler_correlation_id_t correlation_id,
62 rocprofiler_dispatch_id_t dispatch_id,
63 void* userdata_config,
64 rocprofiler_user_data_t* userdata_shader);
65
66/**
67 * @brief Enables the advanced thread trace service for dispatch-based tracing.
68 * The tool has an option to enable/disable thread trace on every dispatch callback.
69 * This service enables kernel serialization.
70 * @param [in] context_id context_id.
71 * @param [in] parameters List of ATT-specific parameters.
72 * @param [in] num_parameters Number of parameters. Zero is allowed.
73 * @param [in] dispatch_callback Control fn which decides when ATT starts/stop collecting.
74 * @param [in] shader_callback Callback fn where the collected data will be sent to.
75 * @param [in] callback_userdata Passed back to user in dispatch_callback.
76 * @return ::rocprofiler_status_t
77 * @retval ROCPROFILER_STATUS_SUCCESS on success
78 * @retval ROCPROFILER_STATUS_ERROR_CONFIGURATION_LOCKED for configuration locked
79 * @retval ROCPROFILER_STATUS_ERROR_CONTEXT_INVALID for conflicting configurations in the same ctx
80 * @retval ROCPROFILER_STATUS_ERROR_CONTEXT_NOT_FOUND for invalid context id
81 * @retval ROCPROFILER_STATUS_ERROR_INVALID_ARGUMENT for invalid rocprofiler_att_parameter_t
82 * @retval ROCPROFILER_STATUS_ERROR_SERVICE_ALREADY_CONFIGURED if already configured
83 */
86 rocprofiler_context_id_t context_id,
88 size_t num_parameters,
91 void* callback_userdata) ROCPROFILER_API;
92
93/** @} */
94
95ROCPROFILER_EXTERN_C_FINI
rocprofiler_status_t
Status codes.
Definition fwd.h:53
uint64_t rocprofiler_dispatch_id_t
Definition fwd.h:493
uint64_t rocprofiler_kernel_id_t
Kernel identifier type.
Definition fwd.h:487
Agent Identifier.
Definition fwd.h:594
Context ID.
Definition fwd.h:555
ROCProfiler Record Correlation ID.
Definition fwd.h:571
User-assignable data type.
Definition fwd.h:520
rocprofiler_att_control_flags_t
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)
Callback to be triggered every kernel dispatch, indicating to start and/or stop ATT.
void(* rocprofiler_att_shader_data_callback_t)(rocprofiler_agent_id_t agent, int64_t shader_engine_id, void *data, unsigned long data_size, rocprofiler_user_data_t userdata)
Callback to be triggered every time some ATT data is generated by the device.
rocprofiler_status_t rocprofiler_configure_dispatch_thread_trace_service(rocprofiler_context_id_t context_id, rocprofiler_att_parameter_t *parameters, unsigned long num_parameters, rocprofiler_att_dispatch_callback_t dispatch_callback, rocprofiler_att_shader_data_callback_t shader_callback, void *callback_userdata)
Enables the advanced thread trace service for dispatch-based tracing. The tool has an option to enabl...
@ ROCPROFILER_ATT_CONTROL_START_AND_STOP
@ ROCPROFILER_ATT_CONTROL_NONE