[1/N] Agent Counter Collection Implementation (#832)

Added public API call to setup agent counter collection on a context.

Refactored the return types internally for dispatch counter collection
to use rocprofiler_status_t (allow for more verbose failures to be
surfaced via the API)

Subsequent commits will fill out the sampling functionality for agent
counter collection.

Co-authored-by: Benjamin Welton <ben@amd.com>
This commit is contained in:
Benjamin Welton
2024-05-01 13:34:54 -07:00
zatwierdzone przez GitHub
rodzic e21609c80e
commit cb3fc070c7
14 zmienionych plików z 192 dodań i 53 usunięć
@@ -34,30 +34,18 @@ ROCPROFILER_EXTERN_C_INIT
* @{
*/
/**
* @brief ROCProfiler Agent Profile Counting Data.
*
* Counters, including identifiers to get counter information and Counters values
*/
typedef struct
{
/**
*/
rocprofiler_record_counter_t* counters;
uint64_t counters_count;
} rocprofiler_agent_profile_counting_data_t;
/**
* @brief Configure Profile Counting Service for agent.
*
* @param [in] buffer_id
* @param [in] profile_config_id
* @param [in] context_id context id
* @param [in] buffer_id id of the buffer to use for the counting service
* @param [in] config_id Profile config detailing the counters to collect for this kernel
* @return ::rocprofiler_status_t
*/
rocprofiler_status_t ROCPROFILER_API
rocprofiler_configure_agent_profile_counting_service(
rocprofiler_buffer_id_t buffer_id,
rocprofiler_profile_config_id_t profile_config_id);
rocprofiler_configure_agent_profile_counting_service(rocprofiler_context_id_t context_id,
rocprofiler_buffer_id_t buffer_id,
rocprofiler_profile_config_id_t config_id);
/**
* @brief Sample Profile Counting Service for agent.
@@ -66,7 +54,7 @@ rocprofiler_configure_agent_profile_counting_service(
* @return ::rocprofiler_status_t
*/
rocprofiler_status_t ROCPROFILER_API
rocprofiler_sample_agent_profile_counting_service(rocprofiler_agent_profile_counting_data_t* data);
rocprofiler_sample_agent_profile_counting_service(rocprofiler_context_id_t context_id);
/** @} */
+3 -1
Wyświetl plik
@@ -92,7 +92,9 @@ typedef enum // NOLINT(performance-enum-size)
ROCPROFILER_STATUS_ERROR_INCOMPATIBLE_KERNEL, ///< A service depends on a newer version of KFD
///< (amdgpu kernel driver). Check logs for
///< service that report incompatibility
ROCPROFILER_STATUS_ERROR_PROFILE_NOT_FOUND, ///< Could not find the counter profile
ROCPROFILER_STATUS_ERROR_AGENT_DISPATCH_CONFLICT, ///< Cannot enable both agent and dispatch
///< counting in the same context.
ROCPROFILER_STATUS_LAST,
} rocprofiler_status_t;
@@ -65,7 +65,7 @@ ROCPROFILER_EXTERN_C_FINI
/** @} */
#include "rocprofiler-sdk/agent.h"
// #include "rocprofiler-sdk/agent_profile.h"
#include "rocprofiler-sdk/agent_profile.h"
#include "rocprofiler-sdk/buffer.h"
#include "rocprofiler-sdk/buffer_tracing.h"
#include "rocprofiler-sdk/callback_tracing.h"