Extend L0 Metrics support with new collection paradigm that allows retrieving asynchronous events. The proposed sampling name is "Tracer based metrics"
Details
Motivation
Existing L0 metrics collection modes (streamer and query) are limited to events that are produced in a defined occurrence rate (defined during configuration). Therefore, the proposal is to add extensions APIs to allow events from different nature, for example asynchronous.
[in] expected to be set to ZET_STRUCTURE_TYPE_METRIC_TRACER_DESC_EXP
pNext
[in,out][optional] must be null or a pointer to an extension-specific structure (i.e. contains stype and pNext)
notifyEveryNBytes
[in,out] number of collected bytes after which notification event will be signaled. If the requested value is not supported exactly, then the driver may use a value that is the closest supported approximation and shall update this member during zetMetricTracerCreate()
The notification event must have been created from an event pool that was created using [ZE_EVENT_POOL_FLAG_HOST_VISIBLE]
The duration of the signal event created from an event pool that was created using [ZE_EVENT_POOL_FLAG_KERNEL_TIMESTAMP]
The application must not call this function from simultaneous threads with the same device handle.
Tracer is created in “disabled” state
Metric groups must be of the sampling type ZET_METRIC_SAMPLING_TYPE_EXP_FLAG_TRACER_BASED
All metric groups must be first activated
Parameter
Description
hContext
[in] handle of the context object
hDevice
[in] handle of the device
metricGroupCount
[in] metric group count
phMetricGroups
[in][range(0, metricGroupCount )] handles of the metric groups to trace
desc
[in,out] metric tracer descriptor
hNotificationEvent
[in][optional] event used for report availability notification. Note: If buffer is not drained when the event it flagged, there is a risk of HW event buffer being overrun
Data can be retrieved even if the tracer is in disabled state
Parameter
Description
hMetricTracer
[in] handle of the metric tracer
pRawDataSize
[in,out] pointer to size in bytes of raw data requested to read. if size is zero, then the driver will update the value with the total size in bytes needed for all data available. if size is non-zero, then driver will only retrieve the amount of data that fits into the buffer. If size is larger than size needed for all data, then driver will update the value with the actual size needed
pRawData
[in,out][optional][range(0, *pRawDataSize)] buffer containing tracer events in raw format
Summary
Extend L0 Metrics support with new collection paradigm that allows retrieving asynchronous events. The proposed sampling name is "Tracer based metrics"
Details
Motivation
Existing L0 metrics collection modes (streamer and query) are limited to events that are produced in a defined occurrence rate (defined during configuration). Therefore, the proposal is to add extensions APIs to allow events from different nature, for example asynchronous.
Interoperability with Other APIs
A new type of sampling will be added to https://spec.oneapi.io/level-zero/latest/tools/api.html#zet-metric-group-sampling-type-flags-t to differentiate what metric groups can be used with the new set of APIs. APIs that are independent of collection mode (e.g. zetMetricGroupGet(), zetMetricGroupGetProperties(), zetMetricGet() ) will work with all metric groups.
Proposed APIs
New Enumerations
ZET_METRIC_SAMPLING_TYPE_EXP_FLAG_TRACER_BASED
extend the sampling types
New Stypes
ZET_STRUCTURE_TYPE_METRIC_TRACER_DESC_EXP
extend tools stypes
New Handles
zet_metric_tracer_exp_handle_t
Metric tracer Handle
New Structures
zet_metric_tracer_desc_t
New Functions
zetMetricTracerCreateExp
Open a metric tracer on a device.
zetMetricTracerDestroyExp
Deletes the metric tracer object
zetMetricTracerEnableExp
Lightweight call that starts the event collections.
zetMetricTracerDisableExp
Lightweight call that stops the event collections.
zetMetricTracerReadDataExp
Reads data from metric tracer
Usage Example