rocprofiler-sdk/experimental/thread-trace/core.h Source File

rocprofiler-sdk/experimental/thread-trace/core.h Source File#

ROCprofiler-SDK developer API: rocprofiler-sdk/experimental/thread-trace/core.h Source File
ROCprofiler-SDK developer API 1.0.0
ROCm Profiling API and tools
core.h
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
25#include <rocprofiler-sdk/agent.h>
26#include <rocprofiler-sdk/defines.h>
27#include <rocprofiler-sdk/fwd.h>
28#include <rocprofiler-sdk/hsa.h>
29
30ROCPROFILER_EXTERN_C_INIT
31
32/**
33 * @defgroup THREAD_TRACE Thread Trace Service
34 * @brief Provides API calls to enable and handle thread trace data
35 *
36 * @{
37 */
38
39/**
40 * @brief Types of Thread Trace parameters
41 *
42 */
44{
45 ROCPROFILER_THREAD_TRACE_PARAMETER_TARGET_CU = 0, ///< Select the Target CU or WGP
47 ROCPROFILER_THREAD_TRACE_PARAMETER_BUFFER_SIZE, ///< Size of combined GPU buffer for ATT
48 ROCPROFILER_THREAD_TRACE_PARAMETER_SIMD_SELECT, ///< Bitmask (GFX9) or ID (Navi) of SIMDs
49 ROCPROFILER_THREAD_TRACE_PARAMETER_PERFCOUNTERS_CTRL, ///< Period [1,32] or disable (0) perfmon
50 ROCPROFILER_THREAD_TRACE_PARAMETER_PERFCOUNTER, ///< Perfmon ID and SIMD mask. gfx9 only
51 ROCPROFILER_THREAD_TRACE_PARAMETER_SERIALIZE_ALL, ///< Serializes also kernels not under
52 ///< thread trace
54 ///< units to exclude from
55 ///< perfcounters. gfx9 only
56 ROCPROFILER_THREAD_TRACE_PARAMETER_NO_DETAIL, ///< Dont collect instruction timing,
57 ///< only shader-wide information
58 ROCPROFILER_THREAD_TRACE_PARAMETER_LAST
60
61/**
62 * @brief Thread Trace parameter specification
63 *
64 */
66{
68 union
69 {
70 uint64_t value;
71 struct
72 {
73 rocprofiler_counter_id_t counter_id;
74 uint64_t simd_mask : 4;
75 };
76 };
78
79/**
80 * @brief Callback to be triggered every time some ATT data is generated by the device
81 * @param [in] agent Identifier for the target agent (@see ::rocprofiler_agent_id_t)
82 * @param [in] shader_engine_id ID of shader engine, as enabled by SE_MASK
83 * @param [in] data Pointer to the buffer containing the ATT data
84 * @param [in] data_size Number of bytes in "data"
85 * @param [in] userdata Passed back to user from rocprofiler_thread_trace_dispatch_callback_t()
86 */
88 int64_t shader_engine_id,
89 void* data,
90 size_t data_size,
92
93/** @} */
94
95ROCPROFILER_EXTERN_C_FINI
Agent Identifier.
Definition fwd.h:677
Counter ID.
Definition fwd.h:685
User-assignable data type.
Definition fwd.h:555
void(* rocprofiler_thread_trace_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.
Definition core.h:87
rocprofiler_thread_trace_parameter_type_t
Types of Thread Trace parameters.
Definition core.h:44
@ ROCPROFILER_THREAD_TRACE_PARAMETER_PERFCOUNTER_EXCLUDE_MASK
Bitmask of which compute units to exclude from perfcounters. gfx9 only.
Definition core.h:53
@ ROCPROFILER_THREAD_TRACE_PARAMETER_SHADER_ENGINE_MASK
Bitmask of shader engines.
Definition core.h:46
@ ROCPROFILER_THREAD_TRACE_PARAMETER_NO_DETAIL
Dont collect instruction timing, only shader-wide information.
Definition core.h:56
@ ROCPROFILER_THREAD_TRACE_PARAMETER_BUFFER_SIZE
Size of combined GPU buffer for ATT.
Definition core.h:47
@ ROCPROFILER_THREAD_TRACE_PARAMETER_PERFCOUNTERS_CTRL
Period [1,32] or disable (0) perfmon.
Definition core.h:49
@ ROCPROFILER_THREAD_TRACE_PARAMETER_SERIALIZE_ALL
Serializes also kernels not under thread trace.
Definition core.h:51
@ ROCPROFILER_THREAD_TRACE_PARAMETER_PERFCOUNTER
Perfmon ID and SIMD mask. gfx9 only.
Definition core.h:50
@ ROCPROFILER_THREAD_TRACE_PARAMETER_SIMD_SELECT
Bitmask (GFX9) or ID (Navi) of SIMDs.
Definition core.h:48
@ ROCPROFILER_THREAD_TRACE_PARAMETER_TARGET_CU
Select the Target CU or WGP.
Definition core.h:45
Thread Trace parameter specification.
Definition core.h:66