rocprofiler-sdk/experimental/registration.h Source File

rocprofiler-sdk/experimental/registration.h Source File#

ROCprofiler-SDK developer API: rocprofiler-sdk/experimental/registration.h Source File
ROCprofiler-SDK developer API 1.0.0
ROCm Profiling API and tools
registration.h
1// MIT License
2//
3// Copyright (c) 2023-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/defines.h>
26#include <rocprofiler-sdk/fwd.h>
27#include <rocprofiler-sdk/registration.h>
28
29ROCPROFILER_EXTERN_C_INIT
30
31/**
32 * @defgroup EXPERIMENTAL_REGISTRATION_GROUP Experimental tool registration
33 *
34 * @brief Data types and functions for tool registration with rocprofiler
35 * @{
36 */
37
38/**
39 * @brief (experimental)
40 *
41 */
42ROCPROFILER_SDK_EXPERIMENTAL
44
45/**
46 * @brief Prototype for the start of the attach function that will be called after the
47 * configuration.
48 * @param [in] tool_data `tool_data` field returned from ::rocprofiler_configure_attach in
49 * ::rocprofiler_tool_configure_result_t.
50 */
51ROCPROFILER_SDK_EXPERIMENTAL
53 rocprofiler_context_id_t* context_ids,
54 uint64_t context_ids_length,
55 void* tool_data);
56
57/**
58 * @brief Prototype for the detach function where a tool can temporarily suspend operations.
59 * @param [in] tool_data `tool_data` field returned from ::rocprofiler_configure in
60 * ::rocprofiler_tool_configure_attach_result_t.
61 */
62ROCPROFILER_SDK_EXPERIMENTAL
63typedef void (*rocprofiler_tool_detach_t)(void* tool_data);
64
65/**
66 * @brief (EXPERIMENTAL) Extended data structure containing initialization, finalization,
67 * attach/detach, and data.
68 *
69 * This is an experimental extension of ::rocprofiler_tool_configure_result_t that adds support for
70 * runtime attachment and detachment of tools. The `tool_reattach` and `tool_detach` function
71 * pointers allow tools to handle dynamic attachment scenarios where they may need to suspend and
72 * resume profiling operations.
73 *
74 * The `size` field is used for ABI reasons and should be set to
75 * `sizeof(rocprofiler_tool_configure_result_t)`
76 */
77typedef struct ROCPROFILER_SDK_EXPERIMENTAL rocprofiler_tool_configure_attach_result_t
78{
79 size_t size; ///< size of this struct (in case of future extensions)
80 rocprofiler_tool_attach_t tool_attach; ///< after configuration
81 rocprofiler_tool_detach_t tool_detach; ///< end of attach session
82 void* tool_data; ///< data to provide to init and fini callbacks
84
85/**
86 * @brief (experimental) This is the special function that tools define to enable rocprofiler
87 * attachment support.
88 *
89 * @param version
90 * @param runtime_version
91 * @param priority
92 * @param client_id
93 * @return rocprofiler_tool_configure_attach_result_t*
94 */
95ROCPROFILER_SDK_EXPERIMENTAL
98 const char* runtime_version,
99 uint32_t priority,
100 rocprofiler_client_id_t* client_id) ROCPROFILER_PUBLIC_API;
101
102/**
103 * @brief Function pointer typedef for ::rocprofiler_configure_attach function
104 * @param [in] version The version of rocprofiler: `(10000 * major) + (100 * minor) + patch`
105 * @param [in] runtime_version String descriptor of the rocprofiler version and other relevant info.
106 * @param [in] priority How many client tools were initialized before this client tool
107 * @param [in, out] client_id tool identifier value.
108 */
109ROCPROFILER_SDK_EXPERIMENTAL
110typedef rocprofiler_tool_configure_attach_result_t* (*rocprofiler_configure_attach_func_t)(
111 uint32_t version,
112 const char* runtime_version,
113 uint32_t priority,
114 rocprofiler_client_id_t* client_id);
115
116/** @} */
117
118ROCPROFILER_EXTERN_C_FINI
Context ID.
Definition fwd.h:600
void * tool_data
data to provide to init and fini callbacks
rocprofiler_tool_attach_t tool_attach
after configuration
rocprofiler_tool_detach_t tool_detach
end of attach session
unsigned long size
size of this struct (in case of future extensions)
rocprofiler_tool_configure_attach_result_t * rocprofiler_configure_attach(uint32_t version, const char *runtime_version, uint32_t priority, rocprofiler_client_id_t *client_id)
(experimental) This is the special function that tools define to enable rocprofiler attachment suppor...
void(* rocprofiler_tool_detach_t)(void *tool_data)
Prototype for the detach function where a tool can temporarily suspend operations.
int(* rocprofiler_tool_attach_t)(rocprofiler_client_detach_t detach_func, rocprofiler_context_id_t *context_ids, uint64_t context_ids_length, void *tool_data)
Prototype for the start of the attach function that will be called after the configuration.
void(* rocprofiler_client_detach_t)(rocprofiler_client_id_t)
(experimental)
(EXPERIMENTAL) Extended data structure containing initialization, finalization, attach/detach,...
(experimental) A client refers to an individual or entity engaged in the configuration of ROCprofiler...