/home/docs/checkouts/readthedocs.org/user_builds/advanced-micro-devices-rocprofiler-docs/checkouts/docs-5.3.3/inc/rocprofiler.h Source File

/home/docs/checkouts/readthedocs.org/user_builds/advanced-micro-devices-rocprofiler-docs/checkouts/docs-5.3.3/inc/rocprofiler.h Source File#

ROC Profiler: /home/docs/checkouts/readthedocs.org/user_builds/advanced-micro-devices-rocprofiler-docs/checkouts/docs-5.3.3/inc/rocprofiler.h Source File
rocprofiler.h
Go to the documentation of this file.
1 /******************************************************************************
2 Copyright (c) 2018 Advanced Micro Devices, Inc. All rights reserved.
3 
4 Permission is hereby granted, free of charge, to any person obtaining a copy
5 of this software and associated documentation files (the "Software"), to deal
6 in the Software without restriction, including without limitation the rights
7 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8 copies of the Software, and to permit persons to whom the Software is
9 furnished to do so, subject to the following conditions:
10 
11 The above copyright notice and this permission notice shall be included in
12 all copies or substantial portions of the Software.
13 
14 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20 THE SOFTWARE.
21 *******************************************************************************/
22 
24 //
25 // ROC Profiler API
26 //
27 // The goal of the implementation is to provide a HW specific low-level
28 // performance analysis interface for profiling of GPU compute applications.
29 // The profiling includes HW performance counters (PMC) with complex
30 // performance metrics and traces.
31 //
32 // The library can be used by a tool library loaded by HSA runtime or by
33 // higher level HW independent performance analysis API like PAPI.
34 //
35 // The library is written on C and will be based on AQLprofile AMD specific
36 // HSA extension. The library implementation requires HSA API intercepting and
37 // a profiling queue supporting a submit callback interface.
38 //
40 
41 #ifndef INC_ROCPROFILER_H_
42 #define INC_ROCPROFILER_H_
43 
44 #include <hsa/amd_hsa_kernel_code.h>
45 #include <hsa/hsa.h>
46 #include <hsa/hsa_ext_amd.h>
47 #include <hsa/hsa_ven_amd_aqlprofile.h>
48 #include <stdint.h>
49 
50 #define ROCPROFILER_VERSION_MAJOR 8
51 #define ROCPROFILER_VERSION_MINOR 0
52 
53 #ifdef __cplusplus
54 extern "C" {
55 #endif // __cplusplus
56 
58 // Returning library version
59 
62 
64 // Global properties structure
65 
66 typedef struct {
67  uint32_t intercept_mode;
69  uint32_t memcopy_tracking;
70  uint32_t trace_size;
71  uint32_t trace_local;
72  uint64_t timeout;
73  uint32_t timestamp_on;
74  uint32_t hsa_intercepting;
75  uint32_t k_concurrent;
76  uint32_t opt_mode;
77  uint32_t obj_dumping;
79 
81 // Returning the error string method
82 
84  const char** str); // [out] the API error string pointer returning
85 
87 // Profiling features and data
88 //
89 // Profiling features objects have profiling feature info, type, parameters and data
90 // Also profiling data samplaes can be iterated using a callback
91 
92 // Profiling feature kind
93 typedef enum {
99 
100 // Profiling feture parameter
101 typedef hsa_ven_amd_aqlprofile_parameter_t rocprofiler_parameter_t;
102 
103 // Profiling data kind
104 typedef enum {
112 
113 // Profiling data type
114 typedef struct {
116  union {
117  uint32_t result_int32; // 32bit integer result
118  uint64_t result_int64; // 64bit integer result
119  float result_float; // float single-precision result
120  double result_double; // float double-precision result
121  struct {
122  void* ptr;
123  uint32_t size;
124  uint32_t instance_count;
125  bool copy;
126  } result_bytes; // data by ptr and byte size
127  };
129 
130 // Profiling feature type
131 typedef struct {
133  union {
134  const char* name; // feature name
135  struct {
136  const char* block; // counter block name
137  uint32_t event; // counter event id
138  } counter;
139  };
140  const rocprofiler_parameter_t* parameters; // feature parameters array
141  uint32_t parameter_count; // feature parameters count
142  rocprofiler_data_t data; // profiling data
144 
145 // Profiling features set type
147 
149 // Profiling context
150 //
151 // Profiling context object accumuate all profiling information
152 
153 // Profiling context object
154 typedef void rocprofiler_t;
155 
156 // Profiling group object
157 typedef struct {
158  unsigned index; // group index
159  rocprofiler_feature_t** features; // profiling info array
160  uint32_t feature_count; // profiling info count
161  rocprofiler_t* context; // context object
163 
164 // Profiling mode mask
165 typedef enum {
166  ROCPROFILER_MODE_STANDALONE = 1, // standalone mode when ROC profiler supports a queue
167  ROCPROFILER_MODE_CREATEQUEUE = 2, // ROC profiler creates queue in standalone mode
168  ROCPROFILER_MODE_SINGLEGROUP = 4 // only one group is allowed, failed otherwise
170 
171 // Profiling handler, calling on profiling completion
172 typedef bool (*rocprofiler_handler_t)(rocprofiler_group_t group, void* arg);
173 
174 // Profiling preperties
175 typedef struct {
176  hsa_queue_t* queue; // queue for STANDALONE mode
177  // the queue is created and returned in CREATEQUEUE mode
178  uint32_t queue_depth; // created queue depth
179  rocprofiler_handler_t handler; // handler on completion
180  void* handler_arg; // the handler arg
182 
183 // Create new profiling context
184 hsa_status_t rocprofiler_open(hsa_agent_t agent, // GPU handle
185  rocprofiler_feature_t* features, // [in] profiling features array
186  uint32_t feature_count, // profiling info count
187  rocprofiler_t** context, // [out] context object
188  uint32_t mode, // profiling mode mask
189  rocprofiler_properties_t* properties); // profiling properties
190 
191 // Add feature to a features set
192 hsa_status_t rocprofiler_add_feature(const rocprofiler_feature_t* feature, // [in]
193  rocprofiler_feature_set_t* features_set); // [in/out] profiling features set
194 
195 // Create new profiling context
196 hsa_status_t rocprofiler_features_set_open(hsa_agent_t agent, // GPU handle
197  rocprofiler_feature_set_t* features_set, // [in] profiling features set
198  rocprofiler_t** context, // [out] context object
199  uint32_t mode, // profiling mode mask
200  rocprofiler_properties_t* properties); // profiling properties
201 
202 // Delete profiling info
203 hsa_status_t rocprofiler_close(rocprofiler_t* context); // [in] profiling context
204 
205 // Context reset before reusing
206 hsa_status_t rocprofiler_reset(rocprofiler_t* context, // [in] profiling context
207  uint32_t group_index); // group index
208 
209 // Return context agent
210 hsa_status_t rocprofiler_get_agent(rocprofiler_t* context, // [in] profiling context
211  hsa_agent_t* agent); // [out] GPU handle
212 
213 // Supported time value ID
214 typedef enum {
215  ROCPROFILER_TIME_ID_CLOCK_REALTIME = 0, // Linux realtime clock time
216  ROCPROFILER_TIME_ID_CLOCK_REALTIME_COARSE = 1, // Linux realtime-coarse clock time
217  ROCPROFILER_TIME_ID_CLOCK_MONOTONIC = 2, // Linux monotonic clock time
218  ROCPROFILER_TIME_ID_CLOCK_MONOTONIC_COARSE = 3, // Linux monotonic-coarse clock time
219  ROCPROFILER_TIME_ID_CLOCK_MONOTONIC_RAW = 4, // Linux monotonic-raw clock time
221 
222 // Return time value for a given time ID and profiling timestamp
223 hsa_status_t rocprofiler_get_time(
224  rocprofiler_time_id_t time_id, // identifier of the particular time to convert the timesatmp
225  uint64_t timestamp, // profiling timestamp
226  uint64_t* value_ns, // [out] returned time 'ns' value, ignored if NULL
227  uint64_t* error_ns); // [out] returned time error 'ns' value, ignored if NULL
228 
230 // Queue callbacks
231 //
232 // Queue callbacks for initiating profiling per kernel dispatch and to wait
233 // the profiling data on the queue destroy.
234 
235 // Dispatch record
236 typedef struct {
237  uint64_t dispatch; // dispatch timestamp, ns
238  uint64_t begin; // kernel begin timestamp, ns
239  uint64_t end; // kernel end timestamp, ns
240  uint64_t complete; // completion signal timestamp, ns
242 
243 // Profiling callback data
244 typedef struct {
245  hsa_agent_t agent; // GPU agent handle
246  uint32_t agent_index; // GPU index
247  const hsa_queue_t* queue; // HSA queue
248  uint64_t queue_index; // Index in the queue
249  uint32_t queue_id; // Queue id
250  hsa_signal_t completion_signal; // Completion signal
251  const hsa_kernel_dispatch_packet_t* packet; // HSA dispatch packet
252  const char* kernel_name; // Kernel name
253  uint64_t kernel_object; // Kernel object address
254  const amd_kernel_code_t* kernel_code; // Kernel code pointer
255  uint32_t thread_id; // Thread id
256  const rocprofiler_dispatch_record_t* record; // Dispatch record
258 
259 // Profiling callback type
260 typedef hsa_status_t (*rocprofiler_callback_t)(
261  const rocprofiler_callback_data_t* callback_data, // [in] callback data
262  void* user_data, // [in/out] user data passed to the callback
263  rocprofiler_group_t* group); // [out] returned profiling group
264 
265 // Queue callbacks
266 typedef struct {
267  rocprofiler_callback_t dispatch; // dispatch callback
268  hsa_status_t (*create)(hsa_queue_t* queue, void* data); // create callback
269  hsa_status_t (*destroy)(hsa_queue_t* queue, void* data); // destroy callback
271 
272 // Set queue callbacks
274  rocprofiler_queue_callbacks_t callbacks, // callbacks
275  void* data); // [in/out] passed callbacks data
276 
277 // Remove queue callbacks
279 
280 // Start/stop queue callbacks
283 
285 // Start/stop profiling
286 //
287 // Start/stop the context profiling invocation, have to be as many as
288 // contect.invocations' to collect all profiling data
289 
290 // Start profiling
291 hsa_status_t rocprofiler_start(rocprofiler_t* context, // [in/out] profiling context
292  uint32_t group_index); // group index
293 
294 // Stop profiling
295 hsa_status_t rocprofiler_stop(rocprofiler_t* context, // [in/out] profiling context
296  uint32_t group_index); // group index
297 
298 // Read profiling
299 hsa_status_t rocprofiler_read(rocprofiler_t* context, // [in/out] profiling context
300  uint32_t group_index); // group index
301 
302 // Read profiling data
303 hsa_status_t rocprofiler_get_data(rocprofiler_t* context, // [in/out] profiling context
304  uint32_t group_index); // group index
305 
306 // Get profiling groups count
307 hsa_status_t rocprofiler_group_count(const rocprofiler_t* context, // [in] profiling context
308  uint32_t* group_count); // [out] profiling groups count
309 
310 // Get profiling group for a given index
311 hsa_status_t rocprofiler_get_group(rocprofiler_t* context, // [in] profiling context
312  uint32_t group_index, // profiling group index
313  rocprofiler_group_t* group); // [out] profiling group
314 
315 // Start profiling
316 hsa_status_t rocprofiler_group_start(rocprofiler_group_t* group); // [in/out] profiling group
317 
318 // Stop profiling
319 hsa_status_t rocprofiler_group_stop(rocprofiler_group_t* group); // [in/out] profiling group
320 
321 // Read profiling
322 hsa_status_t rocprofiler_group_read(rocprofiler_group_t* group); // [in/out] profiling group
323 
324 // Get profiling data
325 hsa_status_t rocprofiler_group_get_data(rocprofiler_group_t* group); // [in/out] profiling group
326 
327 // Get metrics data
328 hsa_status_t rocprofiler_get_metrics(const rocprofiler_t* context); // [in/out] profiling context
329 
330 // Definition of output data iterator callback
331 typedef hsa_ven_amd_aqlprofile_data_callback_t rocprofiler_trace_data_callback_t;
332 
333 // Method for iterating the events output data
335  rocprofiler_t* context, // [in] profiling context
336  rocprofiler_trace_data_callback_t callback, // callback to iterate the output data
337  void* data); // [in/out] callback data
338 
340 // Profiling features and data
341 //
342 // Profiling features objects have profiling feature info, type, parameters and data
343 // Also profiling data samplaes can be iterated using a callback
344 
345 // Profiling info kind
346 typedef enum {
347  ROCPROFILER_INFO_KIND_METRIC = 0, // metric info
348  ROCPROFILER_INFO_KIND_METRIC_COUNT = 1, // metric features count, int32
349  ROCPROFILER_INFO_KIND_TRACE = 2, // trace info
350  ROCPROFILER_INFO_KIND_TRACE_COUNT = 3, // trace features count, int32
351  ROCPROFILER_INFO_KIND_TRACE_PARAMETER = 4, // trace parameter info
352  ROCPROFILER_INFO_KIND_TRACE_PARAMETER_COUNT = 5 // trace parameter count, int32
354 
355 // Profiling info query
356 typedef union {
357  rocprofiler_info_kind_t info_kind; // queried profiling info kind
358  struct {
359  const char* trace_name; // queried info trace name
360  } trace_parameter;
362 
363 // Profiling info data
364 typedef struct {
365  uint32_t agent_index; // GPU HSA agent index
366  rocprofiler_info_kind_t kind; // info data kind
367  union {
368  struct {
369  const char* name; // metric name
370  uint32_t instances; // instances number
371  const char* expr; // metric expression, NULL for basic counters
372  const char* description; // metric description
373  const char* block_name; // block name
374  uint32_t block_counters; // number of block counters
375  } metric;
376  struct {
377  const char* name; // trace name
378  const char* description; // trace description
379  uint32_t parameter_count; // supported by the trace number parameters
380  } trace;
381  struct {
382  uint32_t code; // parameter code
383  const char* trace_name; // trace name
384  const char* parameter_name; // parameter name
385  const char* description; // trace parameter description
386  } trace_parameter;
387  };
389 
390 // Return the info for a given info kind
391 hsa_status_t rocprofiler_get_info(
392  const hsa_agent_t* agent, // [in] GFXIP handle
393  rocprofiler_info_kind_t kind, // kind of iterated info
394  void *data); // [in/out] returned data
395 
396 // Iterate over the info for a given info kind, and invoke an application-defined callback on every iteration
398  const hsa_agent_t* agent, // [in] GFXIP handle
399  rocprofiler_info_kind_t kind, // kind of iterated info
400  hsa_status_t (*callback)(const rocprofiler_info_data_t info, void *data), // callback
401  void *data); // [in/out] data passed to callback
402 
403 // Iterate over the info for a given info query, and invoke an application-defined callback on every iteration
405  const hsa_agent_t *agent, // [in] GFXIP handle
406  rocprofiler_info_query_t query, // iterated info query
407  hsa_status_t (*callback)(const rocprofiler_info_data_t info, void *data), // callback
408  void *data); // [in/out] data passed to callback
409 
410 // Create a profiled queue. All dispatches on this queue will be profiled
412  hsa_agent_t agent_handle,uint32_t size, hsa_queue_type32_t type,
413  void (*callback)(hsa_status_t status, hsa_queue_t* source, void* data),
414  void* data, uint32_t private_segment_size, uint32_t group_segment_size,
415  hsa_queue_t** queue);
416 
418 // Profiling pool
419 //
420 // Support for profiling contexts pool
421 // The API provide capability to create a contexts pool for a given agent and a set of features,
422 // to fetch/relase a context entry, to register a callback for the contexts completion.
423 
424 // Profiling pool handle
425 typedef void rocprofiler_pool_t;
426 
427 // Profiling pool entry
428 typedef struct {
429  rocprofiler_t* context; // context object
430  void* payload; // payload data object
432 
433 // Profiling handler, calling on profiling completion
434 typedef bool (*rocprofiler_pool_handler_t)(const rocprofiler_pool_entry_t* entry, void* arg);
435 
436 // Profiling preperties
437 typedef struct {
438  uint32_t num_entries; // pool size entries
439  uint32_t payload_bytes; // payload size bytes
440  rocprofiler_pool_handler_t handler; // handler on context completion
441  void* handler_arg; // the handler arg
443 
444 // Open profiling pool
446  hsa_agent_t agent, // GPU handle
447  rocprofiler_feature_t* features, // [in] profiling features array
448  uint32_t feature_count, // profiling info count
449  rocprofiler_pool_t** pool, // [out] context object
450  uint32_t mode, // profiling mode mask
451  rocprofiler_pool_properties_t*); // pool properties
452 
453 // Close profiling pool
455  rocprofiler_pool_t* pool); // profiling pool handle
456 
457 // Fetch profiling pool entry
459  rocprofiler_pool_t* pool, // profiling pool handle
460  rocprofiler_pool_entry_t* entry); // [out] empty profiling pool entry
461 
462 // Release profiling pool entry
464  rocprofiler_pool_entry_t* entry); // released profiling pool entry
465 
466 // Iterate fetched profiling pool entries
468  rocprofiler_pool_t* pool, // profiling pool handle
469  hsa_status_t (*callback)(rocprofiler_pool_entry_t* entry, void* data), // callback
470  void *data); // [in/out] data passed to callback
471 
472 // Flush completed entries in profiling pool
474  rocprofiler_pool_t* pool); // profiling pool handle
475 
477 // HSA intercepting API
478 
479 // HSA callbacks ID enumeration
480 typedef enum {
481  ROCPROFILER_HSA_CB_ID_ALLOCATE = 0, // Memory allocate callback
482  ROCPROFILER_HSA_CB_ID_DEVICE = 1, // Device assign callback
483  ROCPROFILER_HSA_CB_ID_MEMCOPY = 2, // Memcopy callback
484  ROCPROFILER_HSA_CB_ID_SUBMIT = 3, // Packet submit callback
485  ROCPROFILER_HSA_CB_ID_KSYMBOL = 4, // Loading/unloading of kernel symbol
486  ROCPROFILER_HSA_CB_ID_CODEOBJ = 5 // Loading/unloading of kernel symbol
488 
489 // HSA callback data type
490 typedef struct {
491  union {
492  struct {
493  const void* ptr; // allocated area ptr
494  size_t size; // allocated area size, zero size means 'free' callback
495  hsa_amd_segment_t segment; // allocated area's memory segment type
496  hsa_amd_memory_pool_global_flag_t global_flag; // allocated area's memory global flag
497  int is_code; // equal to 1 if code is allocated
498  } allocate;
499  struct {
500  hsa_device_type_t type; // type of assigned device
501  uint32_t id; // id of assigned device
502  hsa_agent_t agent; // device HSA agent handle
503  const void* ptr; // ptr the device is assigned to
504  } device;
505  struct {
506  const void* dst; // memcopy dst ptr
507  const void* src; // memcopy src ptr
508  size_t size; // memcopy size bytes
509  } memcopy;
510  struct {
511  const void* packet; // submitted to GPU packet
512  const char* kernel_name; // kernel name, not NULL if dispatch
513  hsa_queue_t* queue; // HSA queue the kernel was submitted to
514  uint32_t device_type; // type of device the packed is submitted to
515  uint32_t device_id; // id of device the packed is submitted to
516  } submit;
517  struct {
518  uint64_t object; // kernel symbol object
519  const char* name; // kernel symbol name
520  uint32_t name_length; // kernel symbol name length
521  int unload; // symbol executable destroy
522  } ksymbol;
523  struct {
524  uint32_t storage_type; // code object storage type
525  int storage_file; // origin file descriptor
526  uint64_t memory_base; // origin memory base
527  uint64_t memory_size; // origin memory size
528  uint64_t load_base; // codeobj load base
529  uint64_t load_size; // codeobj load size
530  uint64_t load_delta; // codeobj load size
531  uint32_t uri_length; // URI string length
532  char* uri; // URI string
533  int unload; // unload flag
534  } codeobj;
535  };
537 
538 // HSA callback function type
539 typedef hsa_status_t (*rocprofiler_hsa_callback_fun_t)(
540  rocprofiler_hsa_cb_id_t id, // callback id
541  const rocprofiler_hsa_callback_data_t* data, // [in] callback data
542  void* arg); // [in/out] user passed data
543 
544 // HSA callbacks structure
545 typedef struct {
546  rocprofiler_hsa_callback_fun_t allocate; // memory allocate callback
547  rocprofiler_hsa_callback_fun_t device; // agent assign callback
548  rocprofiler_hsa_callback_fun_t memcopy; // memory copy callback
549  rocprofiler_hsa_callback_fun_t submit; // packet submit callback
550  rocprofiler_hsa_callback_fun_t ksymbol; // kernel symbol callback
551  rocprofiler_hsa_callback_fun_t codeobj; // codeobject load/unload callback
553 
554 // Set callbacks. If the callback is NULL then it is disabled.
555 // If callback returns a value that is not HSA_STATUS_SUCCESS the callback
556 // will be unregistered.
558  const rocprofiler_hsa_callbacks_t callbacks, // HSA callback function
559  void* arg); // callback user data
560 
561 #ifdef __cplusplus
562 } // extern "C" block
563 #endif // __cplusplus
564 
565 #endif // INC_ROCPROFILER_H_
rocprofiler_data_kind_t
Definition: rocprofiler.h:104
@ ROCPROFILER_DATA_KIND_DOUBLE
Definition: rocprofiler.h:109
@ ROCPROFILER_DATA_KIND_BYTES
Definition: rocprofiler.h:110
@ ROCPROFILER_DATA_KIND_INT32
Definition: rocprofiler.h:106
@ ROCPROFILER_DATA_KIND_INT64
Definition: rocprofiler.h:107
@ ROCPROFILER_DATA_KIND_FLOAT
Definition: rocprofiler.h:108
@ ROCPROFILER_DATA_KIND_UNINIT
Definition: rocprofiler.h:105
hsa_status_t rocprofiler_get_metrics(const rocprofiler_t *context)
hsa_status_t rocprofiler_query_info(const hsa_agent_t *agent, rocprofiler_info_query_t query, hsa_status_t(*callback)(const rocprofiler_info_data_t info, void *data), void *data)
hsa_status_t rocprofiler_iterate_trace_data(rocprofiler_t *context, rocprofiler_trace_data_callback_t callback, void *data)
hsa_status_t rocprofiler_get_info(const hsa_agent_t *agent, rocprofiler_info_kind_t kind, void *data)
hsa_status_t rocprofiler_group_get_data(rocprofiler_group_t *group)
hsa_status_t(* rocprofiler_callback_t)(const rocprofiler_callback_data_t *callback_data, void *user_data, rocprofiler_group_t *group)
Definition: rocprofiler.h:260
hsa_status_t rocprofiler_pool_iterate(rocprofiler_pool_t *pool, hsa_status_t(*callback)(rocprofiler_pool_entry_t *entry, void *data), void *data)
rocprofiler_hsa_cb_id_t
Definition: rocprofiler.h:480
@ ROCPROFILER_HSA_CB_ID_ALLOCATE
Definition: rocprofiler.h:481
@ ROCPROFILER_HSA_CB_ID_DEVICE
Definition: rocprofiler.h:482
@ ROCPROFILER_HSA_CB_ID_KSYMBOL
Definition: rocprofiler.h:485
@ ROCPROFILER_HSA_CB_ID_SUBMIT
Definition: rocprofiler.h:484
@ ROCPROFILER_HSA_CB_ID_CODEOBJ
Definition: rocprofiler.h:486
@ ROCPROFILER_HSA_CB_ID_MEMCOPY
Definition: rocprofiler.h:483
hsa_status_t rocprofiler_open(hsa_agent_t agent, rocprofiler_feature_t *features, uint32_t feature_count, rocprofiler_t **context, uint32_t mode, rocprofiler_properties_t *properties)
hsa_status_t rocprofiler_start_queue_callbacks()
hsa_status_t rocprofiler_pool_flush(rocprofiler_pool_t *pool)
uint32_t rocprofiler_version_minor()
hsa_status_t rocprofiler_add_feature(const rocprofiler_feature_t *feature, rocprofiler_feature_set_t *features_set)
rocprofiler_info_kind_t
Definition: rocprofiler.h:346
@ ROCPROFILER_INFO_KIND_METRIC_COUNT
Definition: rocprofiler.h:348
@ ROCPROFILER_INFO_KIND_METRIC
Definition: rocprofiler.h:347
@ ROCPROFILER_INFO_KIND_TRACE_PARAMETER
Definition: rocprofiler.h:351
@ ROCPROFILER_INFO_KIND_TRACE_COUNT
Definition: rocprofiler.h:350
@ ROCPROFILER_INFO_KIND_TRACE
Definition: rocprofiler.h:349
@ ROCPROFILER_INFO_KIND_TRACE_PARAMETER_COUNT
Definition: rocprofiler.h:352
hsa_status_t rocprofiler_group_stop(rocprofiler_group_t *group)
hsa_status_t rocprofiler_group_start(rocprofiler_group_t *group)
hsa_status_t rocprofiler_pool_open(hsa_agent_t agent, rocprofiler_feature_t *features, uint32_t feature_count, rocprofiler_pool_t **pool, uint32_t mode, rocprofiler_pool_properties_t *)
hsa_status_t rocprofiler_stop_queue_callbacks()
hsa_status_t rocprofiler_features_set_open(hsa_agent_t agent, rocprofiler_feature_set_t *features_set, rocprofiler_t **context, uint32_t mode, rocprofiler_properties_t *properties)
void rocprofiler_t
Definition: rocprofiler.h:154
rocprofiler_mode_t
Definition: rocprofiler.h:165
@ ROCPROFILER_MODE_CREATEQUEUE
Definition: rocprofiler.h:167
@ ROCPROFILER_MODE_SINGLEGROUP
Definition: rocprofiler.h:168
@ ROCPROFILER_MODE_STANDALONE
Definition: rocprofiler.h:166
hsa_status_t rocprofiler_get_group(rocprofiler_t *context, uint32_t group_index, rocprofiler_group_t *group)
void rocprofiler_feature_set_t
Definition: rocprofiler.h:146
hsa_status_t rocprofiler_group_count(const rocprofiler_t *context, uint32_t *group_count)
hsa_status_t rocprofiler_reset(rocprofiler_t *context, uint32_t group_index)
hsa_ven_amd_aqlprofile_parameter_t rocprofiler_parameter_t
Definition: rocprofiler.h:101
bool(* rocprofiler_handler_t)(rocprofiler_group_t group, void *arg)
Definition: rocprofiler.h:172
hsa_ven_amd_aqlprofile_data_callback_t rocprofiler_trace_data_callback_t
Definition: rocprofiler.h:331
bool(* rocprofiler_pool_handler_t)(const rocprofiler_pool_entry_t *entry, void *arg)
Definition: rocprofiler.h:434
hsa_status_t rocprofiler_pool_fetch(rocprofiler_pool_t *pool, rocprofiler_pool_entry_t *entry)
hsa_status_t rocprofiler_get_data(rocprofiler_t *context, uint32_t group_index)
hsa_status_t(* rocprofiler_hsa_callback_fun_t)(rocprofiler_hsa_cb_id_t id, const rocprofiler_hsa_callback_data_t *data, void *arg)
Definition: rocprofiler.h:539
hsa_status_t rocprofiler_iterate_info(const hsa_agent_t *agent, rocprofiler_info_kind_t kind, hsa_status_t(*callback)(const rocprofiler_info_data_t info, void *data), void *data)
hsa_status_t rocprofiler_get_agent(rocprofiler_t *context, hsa_agent_t *agent)
hsa_status_t rocprofiler_queue_create_profiled(hsa_agent_t agent_handle, uint32_t size, hsa_queue_type32_t type, void(*callback)(hsa_status_t status, hsa_queue_t *source, void *data), void *data, uint32_t private_segment_size, uint32_t group_segment_size, hsa_queue_t **queue)
hsa_status_t rocprofiler_close(rocprofiler_t *context)
hsa_status_t rocprofiler_pool_release(rocprofiler_pool_entry_t *entry)
rocprofiler_feature_kind_t
Definition: rocprofiler.h:93
@ ROCPROFILER_FEATURE_KIND_METRIC
Definition: rocprofiler.h:94
@ ROCPROFILER_FEATURE_KIND_PCSMP_MOD
Definition: rocprofiler.h:97
@ ROCPROFILER_FEATURE_KIND_TRACE
Definition: rocprofiler.h:95
@ ROCPROFILER_FEATURE_KIND_SPM_MOD
Definition: rocprofiler.h:96
hsa_status_t rocprofiler_start(rocprofiler_t *context, uint32_t group_index)
hsa_status_t rocprofiler_remove_queue_callbacks()
hsa_status_t rocprofiler_error_string(const char **str)
uint32_t rocprofiler_version_major()
rocprofiler_time_id_t
Definition: rocprofiler.h:214
@ ROCPROFILER_TIME_ID_CLOCK_MONOTONIC_RAW
Definition: rocprofiler.h:219
@ ROCPROFILER_TIME_ID_CLOCK_REALTIME_COARSE
Definition: rocprofiler.h:216
@ ROCPROFILER_TIME_ID_CLOCK_REALTIME
Definition: rocprofiler.h:215
@ ROCPROFILER_TIME_ID_CLOCK_MONOTONIC_COARSE
Definition: rocprofiler.h:218
@ ROCPROFILER_TIME_ID_CLOCK_MONOTONIC
Definition: rocprofiler.h:217
hsa_status_t rocprofiler_get_time(rocprofiler_time_id_t time_id, uint64_t timestamp, uint64_t *value_ns, uint64_t *error_ns)
hsa_status_t rocprofiler_read(rocprofiler_t *context, uint32_t group_index)
void rocprofiler_pool_t
Definition: rocprofiler.h:425
hsa_status_t rocprofiler_stop(rocprofiler_t *context, uint32_t group_index)
hsa_status_t rocprofiler_pool_close(rocprofiler_pool_t *pool)
hsa_status_t rocprofiler_set_hsa_callbacks(const rocprofiler_hsa_callbacks_t callbacks, void *arg)
hsa_status_t rocprofiler_group_read(rocprofiler_group_t *group)
hsa_status_t rocprofiler_set_queue_callbacks(rocprofiler_queue_callbacks_t callbacks, void *data)
Definition: rocprofiler.h:244
hsa_agent_t agent
Definition: rocprofiler.h:245
uint32_t queue_id
Definition: rocprofiler.h:249
uint64_t kernel_object
Definition: rocprofiler.h:253
hsa_signal_t completion_signal
Definition: rocprofiler.h:250
const rocprofiler_dispatch_record_t * record
Definition: rocprofiler.h:256
uint64_t queue_index
Definition: rocprofiler.h:248
const amd_kernel_code_t * kernel_code
Definition: rocprofiler.h:254
const hsa_queue_t * queue
Definition: rocprofiler.h:247
uint32_t agent_index
Definition: rocprofiler.h:246
const hsa_kernel_dispatch_packet_t * packet
Definition: rocprofiler.h:251
const char * kernel_name
Definition: rocprofiler.h:252
uint32_t thread_id
Definition: rocprofiler.h:255
Definition: rocprofiler.h:114
rocprofiler_data_kind_t kind
Definition: rocprofiler.h:115
uint32_t instance_count
Definition: rocprofiler.h:124
uint32_t result_int32
Definition: rocprofiler.h:117
void * ptr
Definition: rocprofiler.h:122
bool copy
Definition: rocprofiler.h:125
double result_double
Definition: rocprofiler.h:120
float result_float
Definition: rocprofiler.h:119
uint32_t size
Definition: rocprofiler.h:123
uint64_t result_int64
Definition: rocprofiler.h:118
Definition: rocprofiler.h:236
uint64_t end
Definition: rocprofiler.h:239
uint64_t complete
Definition: rocprofiler.h:240
uint64_t begin
Definition: rocprofiler.h:238
uint64_t dispatch
Definition: rocprofiler.h:237
Definition: rocprofiler.h:131
const rocprofiler_parameter_t * parameters
Definition: rocprofiler.h:140
rocprofiler_feature_kind_t kind
Definition: rocprofiler.h:132
uint32_t parameter_count
Definition: rocprofiler.h:141
const char * block
Definition: rocprofiler.h:136
const char * name
Definition: rocprofiler.h:134
uint32_t event
Definition: rocprofiler.h:137
rocprofiler_data_t data
Definition: rocprofiler.h:142
Definition: rocprofiler.h:157
uint32_t feature_count
Definition: rocprofiler.h:160
rocprofiler_feature_t ** features
Definition: rocprofiler.h:159
rocprofiler_t * context
Definition: rocprofiler.h:161
unsigned index
Definition: rocprofiler.h:158
Definition: rocprofiler.h:490
hsa_agent_t agent
Definition: rocprofiler.h:502
uint32_t uri_length
Definition: rocprofiler.h:531
char * uri
Definition: rocprofiler.h:532
hsa_amd_segment_t segment
Definition: rocprofiler.h:495
hsa_queue_t * queue
Definition: rocprofiler.h:513
uint32_t device_id
Definition: rocprofiler.h:515
const void * packet
Definition: rocprofiler.h:511
const void * src
Definition: rocprofiler.h:507
uint64_t load_base
Definition: rocprofiler.h:528
uint32_t name_length
Definition: rocprofiler.h:520
int is_code
Definition: rocprofiler.h:497
uint64_t load_size
Definition: rocprofiler.h:529
int storage_file
Definition: rocprofiler.h:525
uint32_t id
Definition: rocprofiler.h:501
const char * name
Definition: rocprofiler.h:519
uint64_t load_delta
Definition: rocprofiler.h:530
uint64_t memory_size
Definition: rocprofiler.h:527
size_t size
Definition: rocprofiler.h:494
hsa_device_type_t type
Definition: rocprofiler.h:500
uint32_t storage_type
Definition: rocprofiler.h:524
const char * kernel_name
Definition: rocprofiler.h:512
uint32_t device_type
Definition: rocprofiler.h:514
uint64_t object
Definition: rocprofiler.h:518
int unload
Definition: rocprofiler.h:521
const void * dst
Definition: rocprofiler.h:506
const void * ptr
Definition: rocprofiler.h:493
uint64_t memory_base
Definition: rocprofiler.h:526
hsa_amd_memory_pool_global_flag_t global_flag
Definition: rocprofiler.h:496
Definition: rocprofiler.h:545
rocprofiler_hsa_callback_fun_t allocate
Definition: rocprofiler.h:546
rocprofiler_hsa_callback_fun_t device
Definition: rocprofiler.h:547
rocprofiler_hsa_callback_fun_t codeobj
Definition: rocprofiler.h:551
rocprofiler_hsa_callback_fun_t submit
Definition: rocprofiler.h:549
rocprofiler_hsa_callback_fun_t ksymbol
Definition: rocprofiler.h:550
rocprofiler_hsa_callback_fun_t memcopy
Definition: rocprofiler.h:548
Definition: rocprofiler.h:364
const char * block_name
Definition: rocprofiler.h:373
uint32_t agent_index
Definition: rocprofiler.h:365
const char * description
Definition: rocprofiler.h:372
uint32_t code
Definition: rocprofiler.h:382
rocprofiler_info_kind_t kind
Definition: rocprofiler.h:366
const char * name
Definition: rocprofiler.h:369
const char * expr
Definition: rocprofiler.h:371
uint32_t parameter_count
Definition: rocprofiler.h:379
const char * trace_name
Definition: rocprofiler.h:383
const char * parameter_name
Definition: rocprofiler.h:384
uint32_t block_counters
Definition: rocprofiler.h:374
uint32_t instances
Definition: rocprofiler.h:370
Definition: rocprofiler.h:428
rocprofiler_t * context
Definition: rocprofiler.h:429
void * payload
Definition: rocprofiler.h:430
Definition: rocprofiler.h:437
uint32_t payload_bytes
Definition: rocprofiler.h:439
void * handler_arg
Definition: rocprofiler.h:441
uint32_t num_entries
Definition: rocprofiler.h:438
rocprofiler_pool_handler_t handler
Definition: rocprofiler.h:440
Definition: rocprofiler.h:175
hsa_queue_t * queue
Definition: rocprofiler.h:176
void * handler_arg
Definition: rocprofiler.h:180
uint32_t queue_depth
Definition: rocprofiler.h:178
rocprofiler_handler_t handler
Definition: rocprofiler.h:179
Definition: rocprofiler.h:266
rocprofiler_callback_t dispatch
Definition: rocprofiler.h:267
Definition: rocprofiler.h:66
uint32_t trace_size
Definition: rocprofiler.h:70
uint32_t obj_dumping
Definition: rocprofiler.h:77
uint32_t k_concurrent
Definition: rocprofiler.h:75
uint32_t hsa_intercepting
Definition: rocprofiler.h:74
uint32_t code_obj_tracking
Definition: rocprofiler.h:68
uint32_t timestamp_on
Definition: rocprofiler.h:73
uint32_t opt_mode
Definition: rocprofiler.h:76
uint32_t intercept_mode
Definition: rocprofiler.h:67
uint32_t memcopy_tracking
Definition: rocprofiler.h:69
uint64_t timeout
Definition: rocprofiler.h:72
uint32_t trace_local
Definition: rocprofiler.h:71
Definition: rocprofiler.h:356
const char * trace_name
Definition: rocprofiler.h:359
rocprofiler_info_kind_t info_kind
Definition: rocprofiler.h:357