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

No PAPI_get_event_info for component events? #93

Open
bertwesarg opened this issue Sep 28, 2023 · 4 comments
Open

No PAPI_get_event_info for component events? #93

bertwesarg opened this issue Sep 28, 2023 · 4 comments

Comments

@bertwesarg
Copy link
Contributor

bertwesarg commented Sep 28, 2023

AMD is investigating providing more metadata for its metrics. At least PAPI_DATATYPE, PAPI_VALUETYPE, and PAPI_TIMESCOPE would be great. However, I don't currently see any code in PAPI that would allow a component to actually provide this information to the caller of PAPI_get_event_info. Can the PAPI team comment on this? Thanks.

@gcongiu
Copy link
Contributor

gcongiu commented Oct 24, 2023

@bertwesarg sorry for the delay. From what I can see some components use PAPI_DATATYPE (e.g., linux-emon.c). I am not sure how useful PAPI_DATATYPE is though because PAPI always casts every counter value to long long regardless the original type. I think full support would require a change in the PAPI_read interface as well. Adding PAPI_DATATYPE (and company) support in the ROCm component should be doable and if that is useful to the user we can do that. Maybe @jagode or @adanalis can further comment on this.

@bertwesarg
Copy link
Contributor Author

Thanks, datatype is probably the least interesting here ;-) But my understanding was, that not everything is cast to long long, but a union is used to transport a double in a long long and the caller can then use a union again to get out the double. And when looking at linux-emon.c, it uses a union indeed:

	union {
		long long ll;
		double fp;
	} return_value;
	return_value.fp = -1;

	EMONDBG( "_emon_accessor, enter this_state = %x\n", this_state);
	return_value.fp = EMON_GetPower_impl( volts, amps );
	EMONDBG("_emon_accessor, after EMON_GetPower %lf \n", return_value.fp);
	if ( -1 == return_value.fp ) {
		PAPIERROR("EMON_GetPower() failed!\n");
		return ( PAPI_ESYS );
	}

	this_state->counters[7] = return_value.ll;

@gcongiu
Copy link
Contributor

gcongiu commented Oct 24, 2023

But the component is not exposing a pointer to a union to the user (in such case PAPI would need to expose the union description as well so that the user knows what field to access in the union) it is merely copying the value inside the union to a long long:

this_state->counters[7] = return_value.ll;

PAPI_read has a long long * type signature so I am skeptical what you described actually works. I will take a look at the code more closely to verify that is the case.

@bertwesarg
Copy link
Contributor Author

bertwesarg commented Oct 24, 2023

But I'm actually more interested in VALUETYPE and TIMESCOPE ;-) And I have now found out, that there is indeed a way for the component to provide this to the caller of PAPI_get_event_info, its the .ntv_code_to_info member of papi_vector_t.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants