Skip to content
Open
Show file tree
Hide file tree
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
4 changes: 2 additions & 2 deletions src/components/cuda/cupti_event_and_metric.c
Original file line number Diff line number Diff line change
Expand Up @@ -1581,7 +1581,7 @@ int cuptie_evt_code_to_descr(uint32_t event_code, char *descr, int len)
* Cuda native event code.
* @param modifier
* Modifies the search logic. Three modifiers are used PAPI_ENUM_FIRST,
* PAPI_ENUM_EVENTS, and PAPI_NTV_ENUM_UMASKS.
* PAPI_ENUM_EVENTS, and PAPI_NTV_ENUM_DEFAULT_QUALIFIERS.
*/
int cuptie_evt_enum(uint32_t *event_code, int modifier)
{
Expand Down Expand Up @@ -1615,7 +1615,7 @@ int cuptie_evt_enum(uint32_t *event_code, int modifier)
}
papi_errno = PAPI_ENOEVNT;
break;
case PAPI_NTV_ENUM_UMASKS:
case PAPI_NTV_ENUM_DEFAULT_QUALIFIERS:
papi_errno = event_and_metric_id_to_info(*event_code, &info);
if (papi_errno != PAPI_OK) {
break;
Expand Down
4 changes: 2 additions & 2 deletions src/components/cuda/cupti_profiler.c
Original file line number Diff line number Diff line change
Expand Up @@ -1555,7 +1555,7 @@ static void shutdown_event_stats_table(void)
* Cuda native event code.
* @param modifier
* Modifies the search logic. Three modifiers are used PAPI_ENUM_FIRST,
* PAPI_ENUM_EVENTS, and PAPI_NTV_ENUM_UMASKS.
* PAPI_ENUM_EVENTS, and PAPI_NTV_ENUM_DEFAULT_QUALIFIERS.
*/
int cuptip_evt_enum(uint32_t *event_code, int modifier)
{
Expand Down Expand Up @@ -1590,7 +1590,7 @@ int cuptip_evt_enum(uint32_t *event_code, int modifier)
}
papi_errno = PAPI_ENOEVNT;
break;
case PAPI_NTV_ENUM_UMASKS:
case PAPI_NTV_ENUM_DEFAULT_QUALIFIERS:
papi_errno = evt_id_to_info(*event_code, &info);
if (papi_errno != PAPI_OK) {
break;
Expand Down
2 changes: 1 addition & 1 deletion src/components/libmsr/linux-libmsr.c
Original file line number Diff line number Diff line change
Expand Up @@ -829,7 +829,7 @@ int _libmsr_ntv_enum_events( unsigned int *EventCode, int modifier )
return PAPI_ENOEVNT;
}
break;
// case PAPI_NTV_ENUM_UMASKS:
// case PAPI_NTV_ENUM_DEFAULT_QUALIFIERS:
default:
return PAPI_EINVAL;
}
Expand Down
4 changes: 2 additions & 2 deletions src/components/pcp/linux-pcp.c
Original file line number Diff line number Diff line change
Expand Up @@ -1691,7 +1691,7 @@ static int _pcp_set_domain(hwd_control_state_t *ctl, int domain)
//----------------------------------------------------------------------------

//----------------------------------------------------------------------------
// Enumerate events. PAPI_NTV_ENUM_UMASKS has nothing to do; we don't have
// Enumerate events. PAPI_NTV_ENUM_DEFAULT_QUALIFIERS has nothing to do; we don't have
// qualifying masks or options on any of our events.
//----------------------------------------------------------------------------

Expand All @@ -1714,7 +1714,7 @@ static int _pcp_ntv_enum_events(unsigned int *EventCode, int modifier)
return PAPI_OK; // And exit.
break; // END CASE.

case PAPI_NTV_ENUM_UMASKS: // Note we HAVE no qualifiers or masks.
case PAPI_NTV_ENUM_DEFAULT_QUALIFIERS: // Note we HAVE no qualifiers or masks.
return PAPI_ENOEVNT; // There are no qualifiers to list.

default: // If we don't understand the modifier,
Expand Down
2 changes: 1 addition & 1 deletion src/components/pcp/tests/testPCP.c
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,7 @@ int main(int argc, char **argv) { // args

firstTime = 0; // Don't test the one-time functions again.

} while(PAPI_enum_cmp_event(&k,PAPI_NTV_ENUM_UMASKS,cid)==PAPI_OK); // Get next umask entry (bits different) (should return PAPI_NOEVNT).
} while(PAPI_enum_cmp_event(&k,PAPI_NTV_ENUM_DEFAULT_QUALIFIERS,cid)==PAPI_OK); // Get next qualifier entry (bits different) (should return PAPI_NOEVNT).
} while(PAPI_enum_cmp_event(&m,PAPI_ENUM_EVENTS,cid)==PAPI_OK); // Get next event code.

// Round 2: Try to load all events into one Event Set.
Expand Down
2 changes: 1 addition & 1 deletion src/components/rocm/roc_profiler.c
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ rocp_evt_enum(uint64_t *event_code, int modifier)
}
papi_errno = PAPI_ENOEVNT;
break;
case PAPI_NTV_ENUM_UMASKS:
case PAPI_NTV_ENUM_DEFAULT_QUALIFIERS:
papi_errno = evt_id_to_info(*event_code, &info);
if (papi_errno != PAPI_OK) {
break;
Expand Down
2 changes: 1 addition & 1 deletion src/components/rocm_smi/tests/rocm_smi_all.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -380,7 +380,7 @@ int main(int argc, char *argv[])
if (isString) printf("%-64s: %-64s\n", info.symbol, ((char*) value));
else printf("%-64s: %lli\n", info.symbol, value);
}
} while(PAPI_enum_cmp_event(&k,PAPI_NTV_ENUM_UMASKS,cid)==PAPI_OK); // Get next umask entry (bits different) (should return PAPI_NOEVNT).
} while(PAPI_enum_cmp_event(&k,PAPI_NTV_ENUM_DEFAULT_QUALIFIERS,cid)==PAPI_OK); // Get next qualifier entry (bits different) (should return PAPI_NOEVNT).
} while(PAPI_enum_cmp_event(&m,PAPI_ENUM_EVENTS,cid)==PAPI_OK); // Get next event code.

// fprintf(stderr, "%s:%i Finished Event Loops.\n", __FILE__, __LINE__);
Expand Down
2 changes: 1 addition & 1 deletion src/components/rocp_sdk/sdk_class.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -941,7 +941,7 @@ evt_enum(unsigned int *event_code, int modifier){
*event_code = tmp_code;

break;
case PAPI_NTV_ENUM_UMASKS:
case PAPI_NTV_ENUM_DEFAULT_QUALIFIERS:
tmp_code = *event_code;

{
Expand Down
2 changes: 1 addition & 1 deletion src/components/template/vendor_profiler_v1.c
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,7 @@ vendorp1_evt_enum(unsigned int *event_code, int modifier)
++info.nameid;
papi_errno = evt_id_create(&info, event_code);
break;
case PAPI_NTV_ENUM_UMASKS:
case PAPI_NTV_ENUM_DEFAULT_QUALIFIERS:
if (info.flags == 0) {
info.flags = DEVICE_FLAG;
papi_errno = evt_id_create(&info, event_code);
Expand Down
15 changes: 13 additions & 2 deletions src/ctests/all_native_events.c
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,18 @@ main( int argc, char **argv )

/* Enumerate all umasks */
k = i;
if ( PAPI_enum_cmp_event(&k, PAPI_NTV_ENUM_UMASKS, cid )==PAPI_OK ) {

int modifier = -1;
// For the CPU components, we enumerate through umasks
if (PAPI_enum_cmp_event(&k, PAPI_NTV_ENUM_UMASKS, cid )==PAPI_OK) {
modifier = PAPI_NTV_ENUM_UMASKS;
}
// For the non-cpu components, we enumerate through qualifiers
else if (PAPI_enum_cmp_event(&k, PAPI_NTV_ENUM_DEFAULT_QUALIFIERS, cid)==PAPI_OK) {
modifier = PAPI_NTV_ENUM_DEFAULT_QUALIFIERS;
}

if (modifier != -1) {
do {
retval = PAPI_get_event_info( k, &info1 );
event_code = ( int ) info1.event_code;
Expand All @@ -194,7 +205,7 @@ main( int argc, char **argv )
else {
err_count++;
}
} while ( PAPI_enum_cmp_event( &k, PAPI_NTV_ENUM_UMASKS, cid ) == PAPI_OK );
} while ( PAPI_enum_cmp_event( &k, modifier, cid ) == PAPI_OK );
}
} while ( PAPI_enum_cmp_event( &i, PAPI_ENUM_EVENTS, cid ) == PAPI_OK );

Expand Down
93 changes: 48 additions & 45 deletions src/ctests/failed_events.c
Original file line number Diff line number Diff line change
Expand Up @@ -154,56 +154,59 @@ main( int argc, char **argv )
do {
retval = PAPI_get_event_info( i, &info );

k = i;
if ( PAPI_enum_cmp_event(&k, PAPI_NTV_ENUM_UMASKS, cid )==PAPI_OK ) {
do {
retval = PAPI_get_event_info( k, &info1 );



/* Skip perf_raw event as it is hard to error out */
if (strstr(info1.symbol,"perf_raw")) {
break;
}

// printf("%s\n",info1.symbol);

if (strlen(info1.symbol)>5) {
info1.symbol[strlen(info1.symbol)-4]^=0xa5;

retval=PAPI_add_named_event(EventSet,info1.symbol);
if (retval==PAPI_OK) {
if (!quiet) {
printf("Unexpectedly opened %s!\n",
info1.symbol);
err_count++;
}
k = i;
int modifier = -1;
// For the CPU components, we enumerate through umasks
if ( PAPI_enum_cmp_event(&k, PAPI_NTV_ENUM_UMASKS, cid )==PAPI_OK ) {
modifier = PAPI_NTV_ENUM_UMASKS;
}
}
} while ( PAPI_enum_cmp_event( &k, PAPI_NTV_ENUM_UMASKS, cid ) == PAPI_OK );
} else {
/* Event didn't have any umasks */

// PROBLEM: info1 is NOT initialized by anyone!
// Original code referenced info1, changed to info. [Tony C. 11-27-19]
// printf("%s\n",info.symbol);
if (strlen(info.symbol)>5) {
info.symbol[strlen(info.symbol)-4]^=0xa5;

retval=PAPI_add_named_event(EventSet,info.symbol);
if (retval==PAPI_OK) {
if (!quiet) {
printf("Unexpectedly opened %s!\n",
info.symbol);
err_count++;
// For the non-cpu components, we enumerate through qualifiers
else if ( PAPI_enum_cmp_event(&k, PAPI_NTV_ENUM_DEFAULT_QUALIFIERS, cid )==PAPI_OK ) {
modifier = PAPI_NTV_ENUM_DEFAULT_QUALIFIERS;
}

if (modifier != -1) {
do {
retval = PAPI_get_event_info( k, &info1 );
/* Skip perf_raw event as it is hard to error out */
if (strstr(info1.symbol,"perf_raw")) {
break;
}

if (strlen(info1.symbol)>5) {
info1.symbol[strlen(info1.symbol)-4]^=0xa5;
retval=PAPI_add_named_event(EventSet,info1.symbol);
if (retval==PAPI_OK) {
if (!quiet) {
printf("Unexpectedly opened %s!\n", info1.symbol);
err_count++;
}
}
}
} while ( PAPI_enum_cmp_event( &k, modifier, cid ) == PAPI_OK );
}
else {
/* Event didn't have any umasks */

// PROBLEM: info1 is NOT initialized by anyone!
// Original code referenced info1, changed to info. [Tony C. 11-27-19]
// printf("%s\n",info.symbol);
if (strlen(info.symbol)>5) {
info.symbol[strlen(info.symbol)-4]^=0xa5;

retval=PAPI_add_named_event(EventSet,info.symbol);
if (retval==PAPI_OK) {
if (!quiet) {
printf("Unexpectedly opened %s!\n", info.symbol);
err_count++;
}
}
}
}
}
}

} while ( PAPI_enum_cmp_event( &i, PAPI_ENUM_EVENTS, cid ) == PAPI_OK );
} while ( PAPI_enum_cmp_event( &i, PAPI_ENUM_EVENTS, cid ) == PAPI_OK );

}
}



Expand Down
5 changes: 4 additions & 1 deletion src/papi.c
Original file line number Diff line number Diff line change
Expand Up @@ -1747,6 +1747,8 @@ PAPI_event_name_to_code( const char *in, int *out )
* <li>PAPI_NTV_ENUM_UMASK_COMBOS -- Given an event, iterate
* through all possible combinations of umasks.
* This is not implemented on libpfm4.
* <li>PAPI_NTV_ENUM_DEFAULT_QUALIFIERS -- Given an event, iterate through
* its default qualifiers.
* </ul>
*
* @par Preset Modifiers
Expand Down Expand Up @@ -1788,7 +1790,8 @@ PAPI_enum_event( int *EventCode, int modifier )
modifier != PAPI_PRESET_ENUM_CPU_AVAIL &&
modifier != PAPI_PRESET_ENUM_FIRST_COMP &&
modifier != PAPI_NTV_ENUM_UMASKS &&
modifier != PAPI_NTV_ENUM_UMASK_COMBOS)
modifier != PAPI_NTV_ENUM_UMASK_COMBOS &&
modifier != PAPI_NTV_ENUM_DEFAULT_QUALIFIERS)
{
return PAPI_EINVAL;
}
Expand Down
1 change: 1 addition & 0 deletions src/papi.h
Original file line number Diff line number Diff line change
Expand Up @@ -511,6 +511,7 @@ enum {
/* PAPI native event related section */
PAPI_NTV_ENUM_UMASKS, /**< all individual bits for given group */
PAPI_NTV_ENUM_UMASK_COMBOS, /**< all combinations of mask bits for given group */
PAPI_NTV_ENUM_DEFAULT_QUALIFIERS, /**< Enumerate through an events default qualifiers */
PAPI_NTV_ENUM_IARR, /**< Enumerate events that support IAR (instruction address ranging) */
PAPI_NTV_ENUM_DARR, /**< Enumerate events that support DAR (data address ranging) */
PAPI_NTV_ENUM_OPCM, /**< Enumerate events that support OPC (opcode matching) */
Expand Down
Loading
Loading