From ecd768797efe8fa5e552dc9dfee0c8f358267f00 Mon Sep 17 00:00:00 2001 From: Giovanni LB Date: Tue, 21 Nov 2023 12:50:19 -0300 Subject: [PATCH] Extending AQLprofile API to include counter dimensions Change-Id: If59489a085959f3f765a30e3e445df5151e30350 [ROCm/ROCR-Runtime commit: e0c6c5e5bf200675c1e21d4c324a117fbb188d43] --- .../hsa-runtime/inc/hsa_ven_amd_aqlprofile.h | 47 ++++++++++++++++++- 1 file changed, 45 insertions(+), 2 deletions(-) diff --git a/projects/rocr-runtime/runtime/hsa-runtime/inc/hsa_ven_amd_aqlprofile.h b/projects/rocr-runtime/runtime/hsa-runtime/inc/hsa_ven_amd_aqlprofile.h index 7aea7858fb..3a7bf95199 100644 --- a/projects/rocr-runtime/runtime/hsa-runtime/inc/hsa_ven_amd_aqlprofile.h +++ b/projects/rocr-runtime/runtime/hsa-runtime/inc/hsa_ven_amd_aqlprofile.h @@ -270,17 +270,16 @@ typedef enum { // in info_data object HSA_VEN_AMD_AQLPROFILE_INFO_TRACE_DATA = 3, // get_info returns trace buffer ptr/size // in info_data object - // HSA_VEN_AMD_AQLPROFILE_INFO_BLOCK_COUNTERS = 4, // get_info returns number of block counter HSA_VEN_AMD_AQLPROFILE_INFO_BLOCK_ID = 5, // get_info returns block id, instances // by name string using _id_query_t - // HSA_VEN_AMD_AQLPROFILE_INFO_ENABLE_CMD = 6, // get_info returns size/pointer for // counters enable command buffer HSA_VEN_AMD_AQLPROFILE_INFO_DISABLE_CMD = 7, // get_info returns size/pointer for // counters disable command buffer } hsa_ven_amd_aqlprofile_info_type_t; + // Definition of output data iterator callback typedef hsa_status_t (*hsa_ven_amd_aqlprofile_data_callback_t)( hsa_ven_amd_aqlprofile_info_type_t info_type, // [in] data type, PMC or trace data @@ -303,6 +302,50 @@ hsa_status_t hsa_ven_amd_aqlprofile_iterate_data( hsa_status_t hsa_ven_amd_aqlprofile_error_string( const char** str); // [out] pointer on the error string +/** + * @brief Returns the number of available dimension ids for given event. + * @param[in] agent HSA Agent + * @param[in] event event (counter+block) to query the num_ids for. + * @param[out] num_ids number of valid dimension IDs. + * @return HSA_STATUS_SUCCESS on successful query. + * @return HSA_STATUS_ERROR for invalid agent/event combination. + */ +hsa_status_t hsa_ven_amd_aqlprofile_get_event_num_ids( + hsa_agent_t agent, + hsa_ven_amd_aqlprofile_event_t event, + uint64_t* num_ids +); + +typedef enum { + // value is of type uint64_t*. get_event_info returns the name length of a dimension id. + HSA_VEN_AMD_AQLPROFILE_INFO_EVENT_DIMENSION_NAME_LENGTH = 0, + // value is of type char*, with minimum capacity returned by INFO_EVENT_DIMENSION_NAME_LENGTH. + // get_event_info copies the name of dimension id to value. + HSA_VEN_AMD_AQLPROFILE_INFO_EVENT_DIMENSION_NAME = 1, + // value is of type uint64_t*. get_event_info returns the extent of a dimension id. + HSA_VEN_AMD_AQLPROFILE_INFO_EVENT_DIMENSION_EXTENT = 2, +} hsa_ven_amd_aqlprofile_event_attribute_t; + +/** + * @brief Returns a query for a given event and dimension id. + * The maximum value of dim_id can be queried with _get_event_num_ids(). + * @param[in] agent HSA Agent + * @param[in] event event (counter+block) to query the attribute for. + * @param[in] attribute what is going to be queried for event. + * @param[in] dim_id dimension id in the range [0,_get_event_num_ids()-1] + * @param[out] value returned data, of type defined by attribute. + * @return HSA_STATUS_SUCCESS on successful query. + * @return HSA_STATUS_ERROR_INVALID_ARGUMENT for invalid attribute. + * @return HSA_STATUS_ERROR for invalid agent/event combination. + */ +hsa_status_t hsa_ven_amd_aqlprofile_get_event_info( + hsa_agent_t agent, + hsa_ven_amd_aqlprofile_event_t event, + hsa_ven_amd_aqlprofile_event_attribute_t attribute, + uint64_t dim_id, + void* value +); + /** * @brief Extension version. */