PAPI 7.1.0.0
Loading...
Searching...
No Matches
rocm.c
Go to the documentation of this file.
1
16#include <string.h>
17#include "papi.h"
18#include "papi_internal.h"
19#include "papi_memory.h"
20#include "papi_vector.h"
21#include "extras.h"
22#include "roc_dispatch.h"
23
24/* Init and finalize */
25static int rocm_init_component(int cid);
26static int rocm_init_thread(hwd_context_t *ctx);
28static int rocm_init_private(void);
29static int rocm_shutdown_component(void);
30static int rocm_shutdown_thread(hwd_context_t *ctx);
32static void rocm_dispatch_timer(int n, hwd_siginfo_t *info, void *uc);
33
34/* set and update component state */
36 NativeInfo_t *ntv_info,
37 int ntv_count, hwd_context_t *ctx);
38static int rocm_set_domain(hwd_control_state_t *ctl, int domain);
39static int rocm_ctrl(hwd_context_t *ctx, int code, _papi_int_option_t *option);
40
41/* start and stop monitoring of hardware counters */
42static int rocm_start(hwd_context_t *ctx, hwd_control_state_t *ctl);
44 long long **val, int flags);
45static int rocm_stop(hwd_context_t *ctx, hwd_control_state_t *ctl);
47
48/* event conversion utilities */
49static int rocm_ntv_enum_events(unsigned int *event_code, int modifier);
50static int rocm_ntv_code_to_name(unsigned int event_code, char *name, int len);
51static int rocm_ntv_name_to_code(const char *name, unsigned int *event_code);
52static int rocm_ntv_code_to_descr(unsigned int event_code, char *descr,
53 int len);
54static int rocm_ntv_code_to_info(unsigned int event_code, PAPI_event_info_t *info);
55
56typedef struct {
58 int state;
61
62typedef struct {
64 unsigned int domain;
65 unsigned int granularity;
66 unsigned int overflow;
67 unsigned int overflow_signal;
68 unsigned int attached;
70 uint64_t *events_id;
71 rocd_ctx_t rocd_ctx;
73
75 .cmp_info = {
76 .name = "rocm",
77 .short_name = "rocm",
78 .version = "2.0",
79 .description = "GPU events and metrics via AMD ROCm-PL API",
80 .num_mpx_cntrs = PAPI_ROCM_MAX_COUNTERS,
81 .num_cntrs = PAPI_ROCM_MAX_COUNTERS,
82 .default_domain = PAPI_DOM_USER,
83 .default_granularity = PAPI_GRN_THR,
84 .available_granularities = PAPI_GRN_THR,
85 .hardware_intr_sig = PAPI_INT_SIGNAL,
86 .fast_real_timer = 0,
87 .fast_virtual_timer = 0,
88 .attach = 0,
89 .attach_must_ptrace = 0,
90 .available_domains = PAPI_DOM_USER | PAPI_DOM_KERNEL,
91 .initialized = 0,
92 },
93
94 .size = {
95 .context = sizeof(rocm_context_t),
96 .control_state = sizeof(rocm_control_t),
97 .reg_value = 1,
98 .reg_alloc = 1,
99 },
100
101 .init_component = rocm_init_component,
102 .init_thread = rocm_init_thread,
103 .init_control_state = rocm_init_control_state,
104 .shutdown_component = rocm_shutdown_component,
105 .shutdown_thread = rocm_shutdown_thread,
106 .cleanup_eventset = rocm_cleanup_eventset,
107 .dispatch_timer = rocm_dispatch_timer,
108
109 .update_control_state = rocm_update_control_state,
110 .set_domain = rocm_set_domain,
111 .ctl = rocm_ctrl,
112
113 .start = rocm_start,
114 .stop = rocm_stop,
115 .read = rocm_read,
116 .reset = rocm_reset,
117
118 .ntv_enum_events = rocm_ntv_enum_events,
119 .ntv_code_to_name = rocm_ntv_code_to_name,
120 .ntv_name_to_code = rocm_ntv_name_to_code,
121 .ntv_code_to_descr = rocm_ntv_code_to_descr,
122 .ntv_code_to_info = rocm_ntv_code_to_info,
123};
124
125static int check_n_initialize(void);
126
127int
129{
134 SUBDBG("ENTER: cid: %d\n", cid);
135
136 int papi_errno = rocd_init_environment();
137 if (papi_errno != PAPI_OK) {
139 _rocm_vector.cmp_info.disabled = papi_errno;
140 const char *err_string;
141 rocd_err_get_last(&err_string);
142 int expect = snprintf(_rocm_vector.cmp_info.disabled_reason,
143 PAPI_MAX_STR_LEN, "%s", err_string);
144 if (expect > PAPI_MAX_STR_LEN) {
145 SUBDBG("disabled_reason truncated");
146 }
147 goto fn_fail;
148 }
149
151 "Not initialized. Access component events to initialize it.");
152 papi_errno = PAPI_EDELAY_INIT;
153 _rocm_vector.cmp_info.disabled = papi_errno;
154
155 fn_exit:
156 SUBDBG("EXIT: %s\n", PAPI_strerror(papi_errno));
157 return papi_errno;
158 fn_fail:
159 goto fn_exit;
160}
161
162int
164{
165 rocm_context_t *rocm_ctx = (rocm_context_t *) ctx;
166 memset(rocm_ctx, 0, sizeof(*rocm_ctx));
167 rocm_ctx->initialized = 1;
169 return PAPI_OK;
170}
171
172int
174{
175 return check_n_initialize();
176}
177
178static int
180{
181 uint64_t event_code = 0;
182
183 if (rocd_evt_enum(&event_code, PAPI_ENUM_FIRST) == PAPI_OK) {
184 ++(*count);
185 }
186 while (rocd_evt_enum(&event_code, PAPI_ENUM_EVENTS) == PAPI_OK) {
187 ++(*count);
188 }
189
190 return PAPI_OK;
191}
192
193int
195{
196 int papi_errno = PAPI_OK;
197
199 SUBDBG("ENTER\n");
200
202 papi_errno = _rocm_vector.cmp_info.disabled;
203 goto fn_exit;
204 }
205
206 papi_errno = rocd_init();
207 if (papi_errno != PAPI_OK) {
208 _rocm_vector.cmp_info.disabled = papi_errno;
209 const char *err_string;
210 rocd_err_get_last(&err_string);
211 int expect = snprintf(_rocm_vector.cmp_info.disabled_reason,
212 PAPI_MAX_STR_LEN, "%s", err_string);
213 if (expect > PAPI_MAX_STR_LEN) {
214 SUBDBG("disabled_reason truncated");
215 }
216
217 goto fn_fail;
218 }
219
220 int count = 0;
221 papi_errno = evt_get_count(&count);
224
225 fn_exit:
227 _rocm_vector.cmp_info.disabled = papi_errno;
228 SUBDBG("EXIT: %s\n", PAPI_strerror(papi_errno));
230 return papi_errno;
231 fn_fail:
232 goto fn_exit;
233}
234
235int
237{
238 int papi_errno = PAPI_OK;
239 int orig_state = _rocm_vector.cmp_info.initialized;
241 SUBDBG("ENTER\n");
242
244 goto fn_exit;
245 }
246
248 goto fn_exit;
249 }
250
251 papi_errno = rocd_shutdown();
252 if (papi_errno != PAPI_OK) {
253 goto fn_fail;
254 }
255
256 fn_exit:
257 SUBDBG("EXIT: %s\n", PAPI_strerror(papi_errno));
258 return papi_errno;
259 fn_fail:
260 _rocm_vector.cmp_info.initialized = orig_state;
261 goto fn_exit;
262}
263
264int
266{
267 rocm_context_t *rocm_ctx = (rocm_context_t *) ctx;
268 rocm_ctx->initialized = 0;
269 rocm_ctx->state = 0;
270 return PAPI_OK;
271}
272
273int
275{
276 rocm_control_t *rocm_ctl = (rocm_control_t *) ctl;
277
278 if (rocm_ctl->rocd_ctx != NULL) {
279 SUBDBG("Cannot cleanup an eventset that is running.");
280 return PAPI_ECMP;
281 }
282
283 papi_free(rocm_ctl->events_id);
284 rocm_ctl->events_id = NULL;
285 rocm_ctl->num_events = 0;
286
287 return PAPI_OK;
288}
289
290static int
292{
294}
295
296void
297rocm_dispatch_timer(int n __attribute__((unused)), hwd_siginfo_t *info, void *uc)
298{
299 _papi_hwi_context_t hw_context;
300 vptr_t address;
301 EventSetInfo_t *ESI;
303 int cidx;
304
306 SUBDBG("Counter sampling is not compatible with intercept mode");
307 return;
308 }
309
311
314
315 if (thread == NULL) {
316 SUBDBG("thread == NULL in user_signal_handler!");
317 goto fn_exit;
318 }
319
320 ESI = thread->running_eventset[cidx];
321 rocm_control_t *rocm_ctl = (rocm_control_t *) ESI->ctl_state;
322
323 if (rocm_ctl->rocd_ctx == NULL) {
324 SUBDBG("ESI == NULL in user_signal_handler!");
325 goto fn_exit;
326 }
327
328 hw_context.si = info;
329 hw_context.ucontext = (hwd_ucontext_t *) uc;
330
331 address = GET_OVERFLOW_ADDRESS(hw_context);
332
333 _papi_hwi_dispatch_overflow_signal((void *)&hw_context, address, NULL, 0, 0,
334 &thread, cidx);
335
336 fn_exit:
338 return;
339}
340
342static int try_open_events(rocm_control_t *);
343
344int
346 int ntv_count,
347 hwd_context_t *ctx __attribute__((unused)))
348{
349 SUBDBG("ENTER: ctl: %p, ntv_info: %p, ntv_count: %d, ctx: %p\n", ctl, ntv_info, ntv_count, ctx);
350 int papi_errno = check_n_initialize();
351 if (papi_errno != PAPI_OK) {
352 goto fn_fail;
353 }
354
355 rocm_control_t *rocm_ctl = (rocm_control_t *) ctl;
356
357 if (rocm_ctl->rocd_ctx != NULL) {
358 SUBDBG("Cannot update events in an eventset that has been already "
359 "started.");
360 papi_errno = PAPI_ECMP;
361 goto fn_fail;
362 }
363
364 papi_errno = update_native_events(rocm_ctl, ntv_info, ntv_count);
365 if (papi_errno != PAPI_OK) {
366 goto fn_fail;
367 }
368
369 papi_errno = try_open_events(rocm_ctl);
370
371 fn_exit:
372 SUBDBG("EXIT: %s\n", PAPI_strerror(papi_errno));
373 return papi_errno;
374 fn_fail:
375 goto fn_exit;
376}
377
381};
382
383static int
384compare(const void *a, const void *b)
385{
386 struct event_map_item *A = (struct event_map_item *) a;
387 struct event_map_item *B = (struct event_map_item *) b;
388 return A->event_id - B->event_id;
389}
390
391int
393 int ntv_count)
394{
395 int papi_errno = PAPI_OK;
396 struct event_map_item sorted_events[PAPI_ROCM_MAX_COUNTERS];
397
398 if (ntv_count != ctl->num_events) {
399 ctl->events_id = papi_realloc(ctl->events_id,
400 ntv_count * sizeof(*ctl->events_id));
401 if (ctl->events_id == NULL) {
402 papi_errno = PAPI_ENOMEM;
403 goto fn_fail;
404 }
405
406 ctl->num_events = ntv_count;
407 }
408
409 int i;
410 for (i = 0; i < ntv_count; ++i) {
411 sorted_events[i].event_id = ntv_info[i].ni_event;
412 sorted_events[i].frontend_idx = i;
413 }
414
415 qsort(sorted_events, ntv_count, sizeof(struct event_map_item), compare);
416
417 for (i = 0; i < ntv_count; ++i) {
418 ctl->events_id[i] = sorted_events[i].event_id;
419 ntv_info[sorted_events[i].frontend_idx].ni_position = i;
420 }
421
422 fn_exit:
423 return papi_errno;
424 fn_fail:
425 ctl->num_events = 0;
426 goto fn_exit;
427}
428
429int
431{
432 int papi_errno = PAPI_OK;
433 rocd_ctx_t rocd_ctx;
434
436 /* Do not try open for intercept mode */
437 return papi_errno;
438 }
439
440 if (rocm_ctl->num_events <= 0) {
441 return PAPI_OK;
442 }
443
444 papi_errno = rocd_ctx_open(rocm_ctl->events_id, rocm_ctl->num_events,
445 &rocd_ctx);
446 if (papi_errno != PAPI_OK) {
447 rocm_cleanup_eventset(rocm_ctl);
448 return papi_errno;
449 }
450
451 return rocd_ctx_close(rocd_ctx);
452}
453
454int
456 int domain __attribute__((unused)))
457{
458 return PAPI_OK;
459}
460
461int
463 int code __attribute__((unused)),
464 _papi_int_option_t *option __attribute__((unused)))
465{
466 return PAPI_OK;
467}
468
469int
471{
472 int papi_errno = PAPI_OK;
473 rocm_context_t *rocm_ctx = (rocm_context_t *) ctx;
474 rocm_control_t *rocm_ctl = (rocm_control_t *) ctl;
475 SUBDBG("ENTER: ctx: %p, ctl: %p\n", ctx, ctl);
476
477 if (rocm_ctx->state & ROCM_EVENTS_OPENED) {
478 SUBDBG("Error! Cannot PAPI_start more than one eventset at a time for every component.");
479 papi_errno = PAPI_ECNFLCT;
480 goto fn_fail;
481 }
482
483 papi_errno = rocd_ctx_open(rocm_ctl->events_id, rocm_ctl->num_events,
484 &rocm_ctl->rocd_ctx);
485 if (papi_errno != PAPI_OK) {
486 goto fn_fail;
487 }
488
489 rocm_ctx->state = ROCM_EVENTS_OPENED;
490
491 papi_errno = rocd_ctx_start(rocm_ctl->rocd_ctx);
492 if (papi_errno != PAPI_OK) {
493 goto fn_fail;
494 }
495
496 rocm_ctx->state |= ROCM_EVENTS_RUNNING;
497
498 fn_exit:
499 SUBDBG("EXIT: %s\n", PAPI_strerror(papi_errno));
500 return papi_errno;
501 fn_fail:
502 if (rocm_ctx->state == ROCM_EVENTS_OPENED) {
503 rocd_ctx_close(rocm_ctl->rocd_ctx);
504 }
505 rocm_ctx->state = 0;
506 goto fn_exit;
507}
508
509int
511 long long **val, int flags __attribute__((unused)))
512{
513 int papi_errno = PAPI_OK;
514 rocm_control_t *rocm_ctl = (rocm_control_t *) ctl;
515 SUBDBG("ENTER: ctx: %p, ctl: %p, val: %p, flags: %d\n", ctx, ctl, val, flags);
516
517 if (rocm_ctl->rocd_ctx == NULL) {
518 SUBDBG("Error! Cannot PAPI_read counters for an eventset that has not been PAPI_start'ed.");
519 papi_errno = PAPI_EMISC;
520 goto fn_fail;
521 }
522
523 papi_errno = rocd_ctx_read(rocm_ctl->rocd_ctx, val);
524
525 fn_exit:
526 SUBDBG("EXIT: %s\n", PAPI_strerror(papi_errno));
527 return papi_errno;
528 fn_fail:
529 goto fn_exit;
530}
531
532int
534{
535 int papi_errno = PAPI_OK;
536 rocm_context_t *rocm_ctx = (rocm_context_t *) ctx;
537 rocm_control_t *rocm_ctl = (rocm_control_t *) ctl;
538 SUBDBG("ENTER: ctx: %p, ctl: %p\n", ctx, ctl);
539
540 if (!(rocm_ctx->state & ROCM_EVENTS_OPENED)) {
541 SUBDBG("Error! Cannot PAPI_stop counters for an eventset that has not been PAPI_start'ed.");
542 papi_errno = PAPI_EMISC;
543 goto fn_fail;
544 }
545
546 papi_errno = rocd_ctx_stop(rocm_ctl->rocd_ctx);
547 if (papi_errno != PAPI_OK) {
548 goto fn_fail;
549 }
550
551 rocm_ctx->state &= ~ROCM_EVENTS_RUNNING;
552
553 papi_errno = rocd_ctx_close(rocm_ctl->rocd_ctx);
554 if (papi_errno != PAPI_OK) {
555 goto fn_fail;
556 }
557
558 rocm_ctx->state = 0;
559 rocm_ctl->rocd_ctx = NULL;
560
561 fn_exit:
562 SUBDBG("EXIT: %s\n", PAPI_strerror(papi_errno));
563 return papi_errno;
564 fn_fail:
565 goto fn_exit;
566}
567
568int
570{
571 rocm_control_t *rocm_ctl = (rocm_control_t *) ctl;
572
573 if (rocm_ctl->rocd_ctx == NULL) {
574 SUBDBG("Cannot reset counters for an eventset that has not been started.");
575 return PAPI_EMISC;
576 }
577
578 return rocd_ctx_reset(rocm_ctl->rocd_ctx);
579}
580
581int
582rocm_ntv_enum_events(unsigned int *event_code, int modifier)
583{
584 SUBDBG("ENTER: event_code: %u, modifier: %d\n", *event_code, modifier);
585 int papi_errno = check_n_initialize();
586 if (papi_errno != PAPI_OK) {
587 goto fn_fail;
588 }
589
590 uint64_t code = *(uint64_t *) event_code;
591 papi_errno = rocd_evt_enum(&code, modifier);
592 *event_code = (unsigned int) code;
593
594 fn_exit:
595 SUBDBG("EXIT: %s\n", PAPI_strerror(papi_errno));
596 return papi_errno;
597 fn_fail:
598 goto fn_exit;
599}
600
601int
602rocm_ntv_code_to_name(unsigned int event_code, char *name, int len)
603{
604 SUBDBG("ENTER: event_code: %u, name: %p, len: %d\n", event_code, name, len);
605 int papi_errno = check_n_initialize();
606 if (papi_errno != PAPI_OK) {
607 goto fn_fail;
608 }
609
610 papi_errno = rocd_evt_code_to_name((uint64_t) event_code, name, len);
611
612 fn_exit:
613 SUBDBG("EXIT: %s\n", PAPI_strerror(papi_errno));
614 return papi_errno;
615 fn_fail:
616 goto fn_exit;
617}
618
619int
620rocm_ntv_name_to_code(const char *name, unsigned int *code)
621{
622 SUBDBG("ENTER: name: %s, code: %p\n", name, code);
623 int papi_errno = check_n_initialize();
624 if (papi_errno != PAPI_OK) {
625 goto fn_fail;
626 }
627
628 uint64_t event_code;
629 papi_errno = rocd_evt_name_to_code(name, &event_code);
630 *code = (unsigned int) event_code;
631
632 fn_exit:
633 SUBDBG("EXIT: %s\n", PAPI_strerror(papi_errno));
634 return papi_errno;
635 fn_fail:
636 goto fn_exit;
637}
638
639int
640rocm_ntv_code_to_descr(unsigned int event_code, char *descr, int len)
641{
642 SUBDBG("ENTER: event_code: %u, descr: %p, len: %d\n", event_code, descr, len);
643 int papi_errno = check_n_initialize();
644 if (papi_errno != PAPI_OK) {
645 goto fn_fail;
646 }
647
648 papi_errno = rocd_evt_code_to_descr((uint64_t) event_code, descr, len);
649
650 fn_exit:
651 SUBDBG("EXIT: %s\n", PAPI_strerror(papi_errno));
652 return papi_errno;
653 fn_fail:
654 goto fn_exit;
655}
656
657int
658rocm_ntv_code_to_info(unsigned int event_code, PAPI_event_info_t *info)
659{
660 SUBDBG("ENTER: event_code: %u, info: %p\n", event_code, info);
661 int papi_errno = check_n_initialize();
662 if (papi_errno != PAPI_OK) {
663 goto fn_fail;
664 }
665
666 papi_errno = rocd_evt_code_to_info((uint64_t) event_code, info);
667
668 fn_exit:
669 SUBDBG("EXIT: %s\n", PAPI_strerror(papi_errno));
670 return papi_errno;
671 fn_fail:
672 goto fn_exit;
673}
674
675int
677{
679 return rocm_init_private();
680 }
682}
int i
#define GET_OVERFLOW_ADDRESS(ctx)
Definition: aix-context.h:12
static long count
Returns a string describing the PAPI error code.
int _papi_hwi_dispatch_overflow_signal(void *papiContext, vptr_t address, int *isHardware, long long overflow_bit, int genOverflowBit, ThreadInfo_t **t, int cidx)
Definition: extras.c:216
#define PAPI_DOM_USER
Definition: f90papi.h:174
#define PAPI_ENUM_EVENTS
Definition: f90papi.h:224
#define PAPI_OK
Definition: f90papi.h:73
#define PAPI_ENUM_FIRST
Definition: f90papi.h:85
#define PAPI_NUM_LOCK
Definition: f90papi.h:80
#define PAPI_ECNFLCT
Definition: f90papi.h:234
#define PAPI_DOM_KERNEL
Definition: f90papi.h:254
#define PAPI_EDELAY_INIT
Definition: f90papi.h:271
#define PAPI_MAX_STR_LEN
Definition: f90papi.h:77
#define PAPI_EMISC
Definition: f90papi.h:122
#define PAPI_ECMP
Definition: f90papi.h:214
#define PAPI_ENOMEM
Definition: f90papi.h:16
#define PAPI_GRN_THR
Definition: f90papi.h:265
void * thread(void *arg)
Definition: kufrin.c:38
static double a[MATRIX_SIZE][MATRIX_SIZE]
Definition: libmsr_basic.c:38
static double b[MATRIX_SIZE][MATRIX_SIZE]
Definition: libmsr_basic.c:39
unsigned long AO_t __attribute__((__aligned__(4)))
Definition: m68k.h:21
Return codes and api definitions.
void * vptr_t
Definition: papi.h:576
#define SUBDBG(format, args...)
Definition: papi_debug.h:64
#define COMPONENT_LOCK
Definition: papi_internal.h:90
#define PAPI_INT_SIGNAL
Definition: papi_internal.h:52
#define NUM_INNER_LOCK
Definition: papi_lock.h:17
#define papi_free(a)
Definition: papi_memory.h:35
#define papi_realloc(a, b)
Definition: papi_memory.h:36
static int cidx
if(file==NULL) goto out
int rocd_evt_code_to_info(uint64_t event_code, PAPI_event_info_t *info)
Definition: roc_dispatch.c:67
int rocd_ctx_reset(rocd_ctx_t ctx)
Definition: roc_dispatch.c:109
int rocd_err_get_last(const char **error_str)
Definition: roc_dispatch.c:73
int rocd_ctx_open(uint64_t *events_id, int num_events, rocd_ctx_t *ctx)
Definition: roc_dispatch.c:79
int rocd_shutdown(void)
Definition: roc_dispatch.c:32
int rocd_evt_code_to_name(uint64_t event_code, char *name, int len)
Definition: roc_dispatch.c:61
int rocd_ctx_read(rocd_ctx_t ctx, long long **counters)
Definition: roc_dispatch.c:103
int rocd_init_environment(void)
Definition: roc_dispatch.c:15
int rocd_ctx_start(rocd_ctx_t ctx)
Definition: roc_dispatch.c:91
int rocd_ctx_stop(rocd_ctx_t ctx)
Definition: roc_dispatch.c:97
int rocd_evt_name_to_code(const char *name, uint64_t *event_code)
Definition: roc_dispatch.c:55
int rocd_ctx_close(rocd_ctx_t ctx)
Definition: roc_dispatch.c:85
int rocd_init(void)
Definition: roc_dispatch.c:21
int rocd_evt_enum(uint64_t *event_code, int modifier)
Definition: roc_dispatch.c:43
int rocd_evt_code_to_descr(uint64_t event_code, char *descr, int len)
Definition: roc_dispatch.c:49
rocm component dispatch layer. Dispatches profiling to the appropriate backend interface (e....
unsigned int _rocm_lock
Definition: roc_profiler.c:85
unsigned int rocm_prof_mode
Definition: roc_profiler.c:84
#define ROCM_PROFILE_SAMPLING_MODE
#define ROCM_EVENTS_RUNNING
#define PAPI_ROCM_MAX_COUNTERS
#define ROCM_EVENTS_OPENED
static int counter_sampling_compatible_with_prof_mode(void)
Definition: rocm.c:291
papi_vector_t _rocm_vector
Definition: rocm.c:74
static int rocm_ctrl(hwd_context_t *ctx, int code, _papi_int_option_t *option)
static int rocm_shutdown_thread(hwd_context_t *ctx)
Definition: rocm.c:265
static int update_native_events(rocm_control_t *, NativeInfo_t *, int)
Definition: rocm.c:392
static int rocm_init_component(int cid)
Definition: rocm.c:128
static int rocm_ntv_code_to_info(unsigned int event_code, PAPI_event_info_t *info)
Definition: rocm.c:658
static int rocm_init_thread(hwd_context_t *ctx)
Definition: rocm.c:163
static int rocm_init_control_state(hwd_control_state_t *ctl)
static int rocm_start(hwd_context_t *ctx, hwd_control_state_t *ctl)
Definition: rocm.c:470
static void rocm_dispatch_timer(int n, hwd_siginfo_t *info, void *uc)
static int compare(const void *a, const void *b)
Definition: rocm.c:384
static int rocm_ntv_code_to_name(unsigned int event_code, char *name, int len)
Definition: rocm.c:602
static int evt_get_count(int *count)
Definition: rocm.c:179
static int try_open_events(rocm_control_t *)
Definition: rocm.c:430
static int rocm_stop(hwd_context_t *ctx, hwd_control_state_t *ctl)
Definition: rocm.c:533
static int rocm_ntv_name_to_code(const char *name, unsigned int *event_code)
Definition: rocm.c:620
static int rocm_ntv_enum_events(unsigned int *event_code, int modifier)
Definition: rocm.c:582
static int rocm_set_domain(hwd_control_state_t *ctl, int domain)
static int rocm_shutdown_component(void)
Definition: rocm.c:236
static int rocm_cleanup_eventset(hwd_control_state_t *ctl)
Definition: rocm.c:274
static int check_n_initialize(void)
Definition: rocm.c:676
static int rocm_init_private(void)
Definition: rocm.c:194
static int rocm_reset(hwd_context_t *ctx, hwd_control_state_t *ctl)
static int rocm_update_control_state(hwd_control_state_t *ctl, NativeInfo_t *ntv_info, int ntv_count, hwd_context_t *ctx)
static int rocm_read(hwd_context_t *ctx, hwd_control_state_t *ctl, long long **val, int flags)
static int rocm_ntv_code_to_descr(unsigned int event_code, char *descr, int len)
Definition: rocm.c:640
const char * name
Definition: rocs.c:225
int
Definition: sde_internal.h:89
hwd_control_state_t * ctl_state
char name[PAPI_MAX_STR_LEN]
Definition: papi.h:627
char disabled_reason[PAPI_HUGE_STR_LEN]
Definition: papi.h:634
hwd_siginfo_t * si
hwd_ucontext_t * ucontext
int frontend_idx
Definition: rocm.c:380
int event_id
Definition: rocm.c:379
PAPI_component_info_t cmp_info
Definition: papi_vector.h:20
int state
Definition: rocm.c:58
int component_id
Definition: rocm.c:59
int initialized
Definition: rocm.c:57
unsigned int overflow_signal
Definition: rocm.c:67
unsigned int overflow
Definition: rocm.c:66
unsigned int domain
Definition: rocm.c:64
int component_id
Definition: rocm.c:69
unsigned int attached
Definition: rocm.c:68
rocd_ctx_t rocd_ctx
Definition: rocm.c:71
unsigned int granularity
Definition: rocm.c:65
int num_events
Definition: rocm.c:63
uint64_t * events_id
Definition: rocm.c:70
inline_static ThreadInfo_t * _papi_hwi_lookup_thread(int custom_tid)
Definition: threads.h:97
inline_static int _papi_hwi_lock(int lck)
Definition: threads.h:69
inline_static int _papi_hwi_unlock(int lck)
Definition: threads.h:83
char * descr