Renamed agent profiling service to device counting service (#1132)

* Renamed agent profiling service to device counting service

Name more aptly represents what agent profiling did (device wide
counter collection). Conversion of existing user code can be
performed by the following find/sed command:

find . -type f -exec sed -i 's/rocprofiler_agent_profile_callback_t/rocprofiler_device_counting_service_callback_t/g; s/rocprofiler_configure_agent_profile_counting_service/rocprofiler_configure_device_counting_service/g; s/agent_profile.h/device_counting_service.h/g; s/rocprofiler_sample_agent_profile_counting_service/rocprofiler_sample_device_counting_service/g' {} +

* Converted dispatch profile to dispatch counting service

* Debug for functioal counters test

* Minor changes for CI

* Minor fix

* More fixes for CI

* Update evaluate_ast.cpp

---------

Co-authored-by: Benjamin Welton <ben@amd.com>
Αυτή η υποβολή περιλαμβάνεται σε:
Benjamin Welton
2024-10-18 01:44:11 -07:00
υποβλήθηκε από GitHub
γονέας 320427b5f5
υποβολή bb69467765
44 αρχεία άλλαξαν με 327 προσθήκες και 264 διαγραφές
@@ -11,14 +11,14 @@ set(ROCPROFILER_HEADER_FILES
rocprofiler.h
# secondary headers
agent.h
agent_profile.h
device_counting_service.h
buffer.h
buffer_tracing.h
callback_tracing.h
context.h
counters.h
defines.h
dispatch_profile.h
dispatch_counting_service.h
external_correlation.h
fwd.h
hip.h
@@ -345,7 +345,7 @@ save(ArchiveT& ar, rocprofiler_callback_tracing_rccl_api_data_t data)
template <typename ArchiveT>
void
save(ArchiveT& ar, rocprofiler_profile_counting_dispatch_data_t data)
save(ArchiveT& ar, rocprofiler_dispatch_counting_service_data_t data)
{
ROCP_SDK_SAVE_DATA_FIELD(size);
ROCP_SDK_SAVE_DATA_FIELD(correlation_id);
@@ -356,7 +356,7 @@ save(ArchiveT& ar, rocprofiler_profile_counting_dispatch_data_t data)
template <typename ArchiveT>
void
save(ArchiveT& ar, rocprofiler_profile_counting_dispatch_record_t data)
save(ArchiveT& ar, rocprofiler_dispatch_counting_service_record_t data)
{
ROCP_SDK_SAVE_DATA_FIELD(size);
ROCP_SDK_SAVE_DATA_FIELD(num_records);
@@ -26,7 +26,7 @@
#include <rocprofiler-sdk/fwd.h>
/**
* @defgroup AGENT_PROFILE_COUNTING_SERVICE Agent Profile Counting Service
* @defgroup device_counting_service Agent Profile Counting Service
* @brief needs brief description
*
* @{
@@ -59,23 +59,23 @@ typedef rocprofiler_status_t (*rocprofiler_agent_set_profile_callback_t)(
* @param [in] agent_id agent id
* @param [in] set_config Function to call to set the profile config (see
* rocprofiler_agent_set_profile_callback_t)
* @param [in] user_data Data supplied to rocprofiler_configure_agent_profile_counting_service
* @param [in] user_data Data supplied to rocprofiler_configure_device_counting_service
*/
typedef void (*rocprofiler_agent_profile_callback_t)(
typedef void (*rocprofiler_device_counting_service_callback_t)(
rocprofiler_context_id_t context_id,
rocprofiler_agent_id_t agent_id,
rocprofiler_agent_set_profile_callback_t set_config,
void* user_data);
/**
* @brief Configure Profile Counting Service for agent. There may only be one agent profile
* configured per context and can be only one active context that is profiling a single agent
* at a time. Multiple agent contexts can be started at the same time if they are profiling
* @brief Configure Device Counting Service for agent. There may only be one counting service
* configured per agent in a context and can be only one active context that is profiling a single
* agent at a time. Multiple agent contexts can be started at the same time if they are profiling
* different agents.
*
* @param [in] context_id context id
* @param [in] buffer_id id of the buffer to use for the counting service. When
* rocprofiler_sample_agent_profile_counting_service is called, counter data will be written
* rocprofiler_sample_device_counting_service is called, counter data will be written
* to this buffer.
* @param [in] agent_id agent to configure profiling on.
* @param [in] cb Callback called when the context is started for the tool to specify what
@@ -87,16 +87,16 @@ typedef void (*rocprofiler_agent_profile_callback_t)(
* @retval ::ROCPROFILER_STATUS_SUCCESS Returned if succesfully configured
*/
rocprofiler_status_t
rocprofiler_configure_agent_profile_counting_service(rocprofiler_context_id_t context_id,
rocprofiler_buffer_id_t buffer_id,
rocprofiler_agent_id_t agent_id,
rocprofiler_agent_profile_callback_t cb,
void* user_data)
rocprofiler_configure_device_counting_service(rocprofiler_context_id_t context_id,
rocprofiler_buffer_id_t buffer_id,
rocprofiler_agent_id_t agent_id,
rocprofiler_device_counting_service_callback_t cb,
void* user_data)
ROCPROFILER_NONNULL(4) ROCPROFILER_API;
/**
* @brief Trigger a read of the counter data for the agent profile. The counter data will be
* written to the buffer specified in rocprofiler_configure_agent_profile_counting_service.
* written to the buffer specified in rocprofiler_configure_device_counting_service.
* The data in rocprofiler_user_data_t will be written to the buffer along with the counter data.
* flags can be used to specify if this call should be performed asynchronously (default is
* synchronous).
@@ -113,9 +113,9 @@ rocprofiler_configure_agent_profile_counting_service(rocprofiler_context_id_t co
* @retval ::ROCPROFILER_STATUS_SUCCESS Returned if read request was successful.
*/
rocprofiler_status_t
rocprofiler_sample_agent_profile_counting_service(rocprofiler_context_id_t context_id,
rocprofiler_user_data_t user_data,
rocprofiler_counter_flag_t flags) ROCPROFILER_API;
rocprofiler_sample_device_counting_service(rocprofiler_context_id_t context_id,
rocprofiler_user_data_t user_data,
rocprofiler_counter_flag_t flags) ROCPROFILER_API;
/** @} */
@@ -31,7 +31,7 @@
ROCPROFILER_EXTERN_C_INIT
/**
* @defgroup DISPATCH_PROFILE_COUNTING_SERVICE Dispatch Profile Counting Service
* @defgroup dispatch_counting_service Dispatch Profile Counting Service
* @brief Per-dispatch hardware counter collection service
*
* @{
@@ -41,21 +41,21 @@ ROCPROFILER_EXTERN_C_INIT
* @brief Kernel dispatch data for profile counting callbacks.
*
*/
typedef struct rocprofiler_profile_counting_dispatch_data_t
typedef struct rocprofiler_dispatch_counting_service_data_t
{
uint64_t size; ///< Size of this struct
rocprofiler_correlation_id_t correlation_id; ///< Correlation ID for this dispatch
rocprofiler_timestamp_t start_timestamp; ///< start time in nanoseconds
rocprofiler_timestamp_t end_timestamp; ///< end time in nanoseconds
rocprofiler_kernel_dispatch_info_t dispatch_info; ///< Dispatch info
} rocprofiler_profile_counting_dispatch_data_t;
} rocprofiler_dispatch_counting_service_data_t;
/**
* @brief ROCProfiler Profile Counting Counter Record Header Information
*
* This is buffer equivalent of ::rocprofiler_profile_counting_dispatch_data_t
* This is buffer equivalent of ::rocprofiler_dispatch_counting_service_data_t
*/
typedef struct rocprofiler_profile_counting_dispatch_record_t
typedef struct rocprofiler_dispatch_counting_service_record_t
{
uint64_t size; ///< Size of this struct
uint64_t num_records; ///< number of ::rocprofiler_record_counter_t records
@@ -63,7 +63,7 @@ typedef struct rocprofiler_profile_counting_dispatch_record_t
rocprofiler_timestamp_t start_timestamp; ///< start time in nanoseconds
rocprofiler_timestamp_t end_timestamp; ///< end time in nanoseconds
rocprofiler_kernel_dispatch_info_t dispatch_info; ///< Contains the `dispatch_id`
} rocprofiler_profile_counting_dispatch_record_t;
} rocprofiler_dispatch_counting_service_record_t;
/**
* @brief Kernel Dispatch Callback. This is a callback that is invoked before the kernel
@@ -72,13 +72,13 @@ typedef struct rocprofiler_profile_counting_dispatch_record_t
* will be collected and emplaced in the buffer with @ref rocprofiler_buffer_id_t used when
* setting up this callback.
*
* @param [in] dispatch_data @see ::rocprofiler_profile_counting_dispatch_data_t
* @param [in] dispatch_data @see ::rocprofiler_dispatch_counting_service_data_t
* @param [out] config Profile config detailing the counters to collect for this kernel
* @param [out] user_data User data unique to this dispatch. Returned in record callback
* @param [in] callback_data_args Callback supplied via buffered_dispatch_profile_counting_service
* @param [in] callback_data_args Callback supplied via buffered_dispatch_counting_service
*/
typedef void (*rocprofiler_profile_counting_dispatch_callback_t)(
rocprofiler_profile_counting_dispatch_data_t dispatch_data,
typedef void (*rocprofiler_dispatch_counting_service_callback_t)(
rocprofiler_dispatch_counting_service_data_t dispatch_data,
rocprofiler_profile_config_id_t* config,
rocprofiler_user_data_t* user_data,
void* callback_data_args);
@@ -86,17 +86,17 @@ typedef void (*rocprofiler_profile_counting_dispatch_callback_t)(
/**
* @brief Counting record callback. This is a callback is invoked when the kernel
* execution is complete and contains the counter profile data requested in
* @ref rocprofiler_profile_counting_dispatch_callback_t. Only used with
* @ref rocprofiler_configure_callback_dispatch_profile_counting_service.
* @ref rocprofiler_dispatch_counting_service_callback_t. Only used with
* @ref rocprofiler_configure_callback_dispatch_counting_service.
*
* @param [in] dispatch_data @see ::rocprofiler_profile_counting_dispatch_data_t
* @param [in] dispatch_data @see ::rocprofiler_dispatch_counting_service_data_t
* @param [in] record_data Counter record data.
* @param [in] record_count Number of counter records.
* @param [in] user_data User data instance from dispatch callback
* @param [in] callback_data_args Callback supplied via buffered_dispatch_profile_counting_service
* @param [in] callback_data_args Callback supplied via buffered_dispatch_counting_service
*/
typedef void (*rocprofiler_profile_counting_record_callback_t)(
rocprofiler_profile_counting_dispatch_data_t dispatch_data,
rocprofiler_dispatch_counting_service_data_t dispatch_data,
rocprofiler_record_counter_t* record_data,
size_t record_count,
rocprofiler_user_data_t user_data,
@@ -112,14 +112,14 @@ typedef void (*rocprofiler_profile_counting_record_callback_t)(
* NOTE: Interface is up for comment as to whether restrictions
* on agent should be made here (limiting the CB based on agent)
* or if the restriction should be performed by the tool in
* @ref rocprofiler_profile_counting_dispatch_callback_t (i.e.
* @ref rocprofiler_dispatch_counting_service_callback_t (i.e.
* tool code checking the agent param to see if they want to profile
* it).
*
* Interface is up for comment as to whether restrictions
* on agent should be made here (limiting the CB based on agent)
* or if the restriction should be performed by the tool in
* @ref rocprofiler_profile_counting_dispatch_callback_t (i.e.
* @ref rocprofiler_dispatch_counting_service_callback_t (i.e.
* tool code checking the agent param to see if they want to profile
* it).
*
@@ -130,10 +130,10 @@ typedef void (*rocprofiler_profile_counting_record_callback_t)(
* @return ::rocprofiler_status_t
*/
rocprofiler_status_t
rocprofiler_configure_buffered_dispatch_profile_counting_service(
rocprofiler_configure_buffered_dispatch_counting_service(
rocprofiler_context_id_t context_id,
rocprofiler_buffer_id_t buffer_id,
rocprofiler_profile_counting_dispatch_callback_t callback,
rocprofiler_dispatch_counting_service_callback_t callback,
void* callback_data_args) ROCPROFILER_API;
/**
@@ -149,9 +149,9 @@ rocprofiler_configure_buffered_dispatch_profile_counting_service(
* @return ::rocprofiler_status_t
*/
rocprofiler_status_t
rocprofiler_configure_callback_dispatch_profile_counting_service(
rocprofiler_configure_callback_dispatch_counting_service(
rocprofiler_context_id_t context_id,
rocprofiler_profile_counting_dispatch_callback_t dispatch_callback,
rocprofiler_dispatch_counting_service_callback_t dispatch_callback,
void* dispatch_callback_args,
rocprofiler_profile_counting_record_callback_t record_callback,
void* record_callback_args) ROCPROFILER_API;
@@ -390,13 +390,13 @@ typedef enum
typedef enum
{
ROCPROFILER_COUNTER_RECORD_NONE = 0,
ROCPROFILER_COUNTER_RECORD_PROFILE_COUNTING_DISPATCH_HEADER, ///< ::rocprofiler_profile_counting_dispatch_record_t
ROCPROFILER_COUNTER_RECORD_PROFILE_COUNTING_DISPATCH_HEADER, ///< ::rocprofiler_dispatch_counting_service_record_t
ROCPROFILER_COUNTER_RECORD_VALUE,
ROCPROFILER_COUNTER_RECORD_LAST,
/// @var ROCPROFILER_COUNTER_RECORD_KIND_DISPATCH_PROFILE_HEADER
/// @brief Indicates the payload type is of type
/// ::rocprofiler_profile_counting_dispatch_record_t
/// ::rocprofiler_dispatch_counting_service_record_t
} rocprofiler_counter_record_kind_t;
/**
@@ -694,9 +694,9 @@ typedef struct
/// specific dispatch.
///
/// This value can be mapped to a dispatch via the `dispatch_info` field (@see
/// ::rocprofiler_kernel_dispatch_info_t) of a ::rocprofiler_profile_counting_dispatch_data_t
/// ::rocprofiler_kernel_dispatch_info_t) of a ::rocprofiler_dispatch_counting_service_data_t
/// instance (provided during callback for profile config) or a
/// ::rocprofiler_profile_counting_dispatch_record_t records (which will be insert into the
/// ::rocprofiler_dispatch_counting_service_record_t records (which will be insert into the
/// buffer prior to the associated ::rocprofiler_record_counter_t records).
} rocprofiler_record_counter_t;
@@ -65,13 +65,13 @@ ROCPROFILER_EXTERN_C_FINI
/** @} */
#include "rocprofiler-sdk/agent.h"
#include "rocprofiler-sdk/agent_profile.h"
#include "rocprofiler-sdk/buffer.h"
#include "rocprofiler-sdk/buffer_tracing.h"
#include "rocprofiler-sdk/callback_tracing.h"
#include "rocprofiler-sdk/context.h"
#include "rocprofiler-sdk/counters.h"
#include "rocprofiler-sdk/dispatch_profile.h"
#include "rocprofiler-sdk/device_counting_service.h"
#include "rocprofiler-sdk/dispatch_counting_service.h"
#include "rocprofiler-sdk/external_correlation.h"
#include "rocprofiler-sdk/hip.h"
#include "rocprofiler-sdk/hsa.h"