Dispatch counting service#
-
typedef void (*rocprofiler_dispatch_counting_service_cb_t)(rocprofiler_dispatch_counting_service_data_t dispatch_data, rocprofiler_counter_config_id_t *config, rocprofiler_user_data_t *user_data, void *callback_data_args)#
(experimental) Kernel Dispatch Callback. This is a callback that is invoked before the kernel is enqueued into the HSA queue. What counters to collect for a kernel are set via passing back a profile config (config) in this callback. These counters will be collected and emplaced in the buffer with rocprofiler_buffer_id_t used when setting up this callback.
- Param dispatch_data:
[in]
- Param config:
[out] Profile config detailing the counters to collect for this kernel
- Param user_data:
[out] User data unique to this dispatch. Returned in record callback
- Param callback_data_args:
[in] Callback supplied via buffered_dispatch_counting_service
-
typedef void (*rocprofiler_dispatch_counting_record_cb_t)(rocprofiler_dispatch_counting_service_data_t dispatch_data, rocprofiler_counter_record_t *record_data, unsigned long record_count, rocprofiler_user_data_t user_data, void *callback_data_args)#
(experimental) Counting record callback. This is a callback is invoked when the kernel execution is complete and contains the counter profile data requested in rocprofiler_dispatch_counting_service_cb_t. Only used with rocprofiler_configure_callback_dispatch_counting_service.
- Param dispatch_data:
[in]
- Param record_data:
[in] Counter record data.
- Param record_count:
[in] Number of counter records.
- Param user_data:
[in] User data instance from dispatch callback
- Param callback_data_args:
[in] Callback supplied via buffered_dispatch_counting_service
-
rocprofiler_status_t rocprofiler_configure_buffer_dispatch_counting_service(rocprofiler_context_id_t context_id, rocprofiler_buffer_id_t buffer_id, rocprofiler_dispatch_counting_service_cb_t callback, void *callback_data_args)#
(experimental) Configure buffered dispatch profile Counting Service. Collects the counters in dispatch packets and stores them in a buffer with
buffer_id. The buffer may contain packets from more than one dispatch (denoted by correlation id). Will trigger the callback based on the parameters setup in buffer_id_t.- Parameters:
context_id – [in] context id
buffer_id – [in] id of the buffer to use for the counting service
callback – [in] callback to perform when dispatch is enqueued
callback_data_args – [in] callback data
- Returns:
-
rocprofiler_status_t rocprofiler_configure_callback_dispatch_counting_service(rocprofiler_context_id_t context_id, rocprofiler_dispatch_counting_service_cb_t dispatch_callback, void *dispatch_callback_args, rocprofiler_dispatch_counting_record_cb_t record_callback, void *record_callback_args)#
(experimental) Configure buffered dispatch profile Counting Service. Collects the counters in dispatch packets and calls a callback with the counters collected during that dispatch.
- Parameters:
context_id – [in] context id
dispatch_callback – [in] callback to perform when dispatch is enqueued
dispatch_callback_args – [in] callback data for dispatch callback
record_callback – [in] Record callback for completed profile data
record_callback_args – [in] Callback args for record callback
- Returns:
-
rocprofiler_status_t rocprofiler_dispatch_counting_service_set_agents(rocprofiler_context_id_t context_id, const rocprofiler_agent_id_t *agents, unsigned long num_agents)#
(experimental) Restrict a dispatch counting service to a set of GPU agents.
By default a dispatch counting service applies to every GPU agent: the dispatch callback is invoked for kernels on all agents, and kernel dispatches are serialized on all agents for as long as the context is active. A tool can already decline to profile a dispatch by leaving the ::rocprofiler_counter_config_id_t output of ::rocprofiler_dispatch_counting_service_cb_t set to zero, but that only suppresses counter collection -- the dispatch is still serialized. This function narrows the service so that agents outside @p agents are neither instrumented nor serialized. Restricting the agent set also relaxes the counter-collection context conflict: two contexts may each configure a dispatch counting service and be active at the same time provided their agent sets are disjoint. Contexts that leave the agent set unrestricted claim every agent and therefore still conflict with each other. Must be called after a dispatch counting service has been configured on @p context_id and before the context is started. Calling it more than once replaces the previous set. Passing @p num_agents of zero restores the default of all agents.
- Parameters:
context_id – [in] context id with a configured dispatch counting service
agents – [in] array of GPU agent ids to restrict collection to
num_agents – [in] number of entries in
agents
- Return values:
ROCPROFILER_STATUS_SUCCESS – agent set was applied
ROCPROFILER_STATUS_ERROR_CONTEXT_INVALID –
context_idis not a valid contextROCPROFILER_STATUS_ERROR_CONTEXT_NOT_FOUND – no dispatch counting service has been configured on
context_idROCPROFILER_STATUS_ERROR_INVALID_ARGUMENT –
agentsis null with a non-zeronum_agentsROCPROFILER_STATUS_ERROR_AGENT_NOT_FOUND – an entry in
agentsis not a GPU agentROCPROFILER_STATUS_ERROR_CONFIGURATION_LOCKED – the context is currently active
- Returns:
-
struct rocprofiler_dispatch_counting_service_data_t#
- #include <rocprofiler-sdk/dispatch_counting_service.h>
(experimental) Kernel dispatch data for profile counting callbacks.
-
struct rocprofiler_dispatch_counting_service_record_t#
- #include <rocprofiler-sdk/dispatch_counting_service.h>
(experimental) ROCProfiler Profile Counting Counter Record Header Information
This is buffer equivalent of rocprofiler_dispatch_counting_service_data_t