Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rocm: fix bug in intercept mode path #106

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions src/components/rocm/roc_profiler.c
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ static void *rocp_dlp = NULL;
static ntv_event_table_t ntv_table;
static ntv_event_table_t *ntv_table_p;
static void *htable;
static void *htable_intercept;

/* rocp_init_environment - initialize ROCm environment variables */
int
Expand All @@ -128,6 +129,10 @@ rocp_init(void)

htable_init(&htable);

if (rocm_prof_mode != ROCM_PROFILE_SAMPLING_MODE) {
htable_init(&htable_intercept);
}

papi_errno = init_event_table();
if (papi_errno != PAPI_OK) {
(*hsa_shut_down_p)();
Expand Down Expand Up @@ -1399,6 +1404,7 @@ intercept_shutdown(void)

shutdown_event_table();
htable_shutdown(htable);
htable_shutdown(htable_intercept);

(*hsa_shut_down_p)();

Expand Down Expand Up @@ -1434,7 +1440,7 @@ verify_events(unsigned int *events_id, int num_events)

for (i = 0; i < num_events; ++i) {
void *out;
if (htable_find(htable, ntv_table_p->events[events_id[i]].name, &out)) {
if (htable_find(htable_intercept, ntv_table_p->events[events_id[i]].feature, &out)) {
return PAPI_ECNFLCT;
}
}
Expand Down Expand Up @@ -1489,7 +1495,7 @@ intercept_ctx_init(unsigned int *events_id, int num_events, rocp_ctx_t *rocp_ctx

int i;
for (i = 0; i < num_events; ++i) {
htable_insert(htable, ntv_table_p->events[events_id[i]].name, NULL);
htable_insert(htable_intercept, ntv_table_p->events[events_id[i]].feature, NULL);
}
}

Expand Down