Tools API¶
oneAPI Level Zero Specification - Version 1.2.43
Common¶
Enumerations
Structures
Common Enums¶
zet_structure_type_t¶
-
enum
zet_structure_type_t
¶ Defines structure types.
Values:
-
ZET_STRUCTURE_TYPE_METRIC_GROUP_PROPERTIES
= 0x1¶
-
ZET_STRUCTURE_TYPE_METRIC_PROPERTIES
= 0x2¶
-
ZET_STRUCTURE_TYPE_METRIC_STREAMER_DESC
= 0x3¶
-
ZET_STRUCTURE_TYPE_METRIC_QUERY_POOL_DESC
= 0x4¶
-
ZET_STRUCTURE_TYPE_PROFILE_PROPERTIES
= 0x5¶
-
ZET_STRUCTURE_TYPE_DEVICE_DEBUG_PROPERTIES
= 0x6¶
-
ZET_STRUCTURE_TYPE_DEBUG_MEMORY_SPACE_DESC
= 0x7¶
-
ZET_STRUCTURE_TYPE_DEBUG_REGSET_PROPERTIES
= 0x8¶
-
ZET_STRUCTURE_TYPE_TRACER_EXP_DESC
= 0x00010001¶
-
ZET_STRUCTURE_TYPE_FORCE_UINT32
= 0x7fffffff¶
-
zet_value_type_t¶
-
enum
zet_value_type_t
¶ Supported value types.
Values:
-
ZET_VALUE_TYPE_UINT32
= 0¶ 32-bit unsigned-integer
-
ZET_VALUE_TYPE_UINT64
= 1¶ 64-bit unsigned-integer
-
ZET_VALUE_TYPE_FLOAT32
= 2¶ 32-bit floating-point
-
ZET_VALUE_TYPE_FLOAT64
= 3¶ 64-bit floating-point
-
ZET_VALUE_TYPE_BOOL8
= 4¶ 8-bit boolean
-
ZET_VALUE_TYPE_FORCE_UINT32
= 0x7fffffff¶
-
Common Structures¶
zet_base_properties_t¶
-
struct
zet_base_properties_t
¶ Base for all properties types.
Public Members
-
zet_structure_type_t
stype
¶ [in] type of this structure
-
void *
pNext
¶ [in,out][optional] pointer to extension-specific structure
-
zet_structure_type_t
zet_base_desc_t¶
-
struct
zet_base_desc_t
¶ Base for all descriptor types.
Public Members
-
zet_structure_type_t
stype
¶ [in] type of this structure
-
const void *
pNext
¶ [in][optional] pointer to extension-specific structure
-
zet_structure_type_t
Module¶
Functions
Enumerations
Module Functions¶
zetModuleGetDebugInfo¶
-
ZE_APIEXPORT ze_result_t ZE_APICALL
zetModuleGetDebugInfo
(zet_module_handle_t hModule, zet_module_debug_info_format_t format, size_t *pSize, uint8_t *pDebugInfo)¶ Retrieve debug info from module.
- Parameters
hModule
: [in] handle of the moduleformat
: [in] debug info format requestedpSize
: [in,out] size of debug info in bytespDebugInfo
: [in,out][optional] byte pointer to debug info
The caller can pass nullptr for pDebugInfo when querying only for size.
The implementation will copy the native binary into a buffer supplied by the caller.
The application may call this function from simultaneous threads.
The implementation of this function should be lock-free.
- Return
Debug¶
Functions
Enumerations
Structures
Debug Functions¶
zetDeviceGetDebugProperties¶
-
ZE_APIEXPORT ze_result_t ZE_APICALL
zetDeviceGetDebugProperties
(zet_device_handle_t hDevice, zet_device_debug_properties_t *pDebugProperties)¶ Retrieves debug properties of the device.
- Parameters
hDevice
: [in] device handlepDebugProperties
: [in,out] query result for debug properties
- Return
ZE_RESULT_ERROR_INVALID_NULL_HANDLE
nullptr == hDevice
ZE_RESULT_ERROR_INVALID_NULL_POINTER
nullptr == pDebugProperties
zetDebugAttach¶
-
ZE_APIEXPORT ze_result_t ZE_APICALL
zetDebugAttach
(zet_device_handle_t hDevice, const zet_debug_config_t *config, zet_debug_session_handle_t *phDebug)¶ Attach to a device.
- Parameters
hDevice
: [in] device handleconfig
: [in] the debug configurationphDebug
: [out] debug session handle
The device must be enabled for debug; see zesSchedulerSetComputeUnitDebugMode.
- Return
ZE_RESULT_ERROR_INVALID_NULL_HANDLE
nullptr == hDevice
ZE_RESULT_ERROR_INVALID_NULL_POINTER
nullptr == config
nullptr == phDebug
ZE_RESULT_ERROR_UNSUPPORTED_FEATURE
attaching to this device is not supported
ZE_RESULT_ERROR_INSUFFICIENT_PERMISSIONS
caller does not have sufficient permissions
a debugger is already attached
zetDebugDetach¶
-
ZE_APIEXPORT ze_result_t ZE_APICALL
zetDebugDetach
(zet_debug_session_handle_t hDebug)¶ Close a debug session.
- Parameters
hDebug
: [in][release] debug session handle
- Return
zetDebugReadEvent¶
-
ZE_APIEXPORT ze_result_t ZE_APICALL
zetDebugReadEvent
(zet_debug_session_handle_t hDebug, uint64_t timeout, zet_debug_event_t *event)¶ Read the topmost debug event.
- Parameters
hDebug
: [in] debug session handletimeout
: [in] if non-zero, then indicates the maximum time (in milliseconds) to yield before returning ZE_RESULT_SUCCESS or ZE_RESULT_NOT_READY; if zero, then immediately returns the status of the event; if UINT64_MAX, then function will not return until complete or device is lost. Due to external dependencies, timeout may be rounded to the closest value allowed by the accuracy of those dependencies.event
: [in,out] a pointer to a zet_debug_event_t.
- Return
ZE_RESULT_ERROR_INVALID_NULL_HANDLE
nullptr == hDebug
ZE_RESULT_ERROR_INVALID_NULL_POINTER
nullptr == event
the timeout expired
zetDebugAcknowledgeEvent¶
-
ZE_APIEXPORT ze_result_t ZE_APICALL
zetDebugAcknowledgeEvent
(zet_debug_session_handle_t hDebug, const zet_debug_event_t *event)¶ Acknowledge a debug event.
- Parameters
hDebug
: [in] debug session handleevent
: [in] a pointer to a zet_debug_event_t.
- Return
ZE_RESULT_ERROR_INVALID_NULL_HANDLE
nullptr == hDebug
ZE_RESULT_ERROR_INVALID_NULL_POINTER
nullptr == event
zetDebugInterrupt¶
-
ZE_APIEXPORT ze_result_t ZE_APICALL
zetDebugInterrupt
(zet_debug_session_handle_t hDebug, ze_device_thread_t thread)¶ Interrupt device threads.
- Parameters
hDebug
: [in] debug session handlethread
: [in] the thread to interrupt
- Return
ZE_RESULT_ERROR_INVALID_NULL_HANDLE
nullptr == hDebug
the thread is already stopped or unavailable
zetDebugResume¶
-
ZE_APIEXPORT ze_result_t ZE_APICALL
zetDebugResume
(zet_debug_session_handle_t hDebug, ze_device_thread_t thread)¶ Resume device threads.
- Parameters
hDebug
: [in] debug session handlethread
: [in] the thread to resume
- Return
ZE_RESULT_ERROR_INVALID_NULL_HANDLE
nullptr == hDebug
the thread is already running or unavailable
zetDebugReadMemory¶
-
ZE_APIEXPORT ze_result_t ZE_APICALL
zetDebugReadMemory
(zet_debug_session_handle_t hDebug, ze_device_thread_t thread, const zet_debug_memory_space_desc_t *desc, size_t size, void *buffer)¶ Read memory.
- Parameters
hDebug
: [in] debug session handlethread
: [in] the thread identifier.desc
: [in] memory space descriptorsize
: [in] the number of bytes to readbuffer
: [in,out] a buffer to hold a copy of the memory
The thread identifier ‘all’ can be used for accessing the default memory space, e.g. for setting breakpoints.
- Return
ZE_RESULT_ERROR_INVALID_NULL_HANDLE
nullptr == hDebug
ZE_RESULT_ERROR_INVALID_NULL_POINTER
nullptr == desc
nullptr == buffer
ZE_RESULT_ERROR_INVALID_ENUMERATION
ZET_DEBUG_MEMORY_SPACE_TYPE_SLM < desc->type
the thread is running or unavailable
the memory cannot be accessed from the supplied thread
zetDebugWriteMemory¶
-
ZE_APIEXPORT ze_result_t ZE_APICALL
zetDebugWriteMemory
(zet_debug_session_handle_t hDebug, ze_device_thread_t thread, const zet_debug_memory_space_desc_t *desc, size_t size, const void *buffer)¶ Write memory.
- Parameters
hDebug
: [in] debug session handlethread
: [in] the thread identifier.desc
: [in] memory space descriptorsize
: [in] the number of bytes to writebuffer
: [in] a buffer holding the pattern to write
The thread identifier ‘all’ can be used for accessing the default memory space, e.g. for setting breakpoints.
- Return
ZE_RESULT_ERROR_INVALID_NULL_HANDLE
nullptr == hDebug
ZE_RESULT_ERROR_INVALID_NULL_POINTER
nullptr == desc
nullptr == buffer
ZE_RESULT_ERROR_INVALID_ENUMERATION
ZET_DEBUG_MEMORY_SPACE_TYPE_SLM < desc->type
the thread is running or unavailable
the memory cannot be accessed from the supplied thread
zetDebugGetRegisterSetProperties¶
-
ZE_APIEXPORT ze_result_t ZE_APICALL
zetDebugGetRegisterSetProperties
(zet_device_handle_t hDevice, uint32_t *pCount, zet_debug_regset_properties_t *pRegisterSetProperties)¶ Retrieves debug register set properties.
- Parameters
hDevice
: [in] device handlepCount
: [in,out] pointer to the number of register set properties. if count is zero, then the driver shall update the value with the total number of register set properties available. if count is greater than the number of register set properties available, then the driver shall update the value with the correct number of registry set properties available.pRegisterSetProperties
: [in,out][optional][range(0, *pCount)] array of query results for register set properties. if count is less than the number of register set properties available, then driver shall only retrieve that number of register set properties.
- Return
ZE_RESULT_ERROR_INVALID_NULL_HANDLE
nullptr == hDevice
ZE_RESULT_ERROR_INVALID_NULL_POINTER
nullptr == pCount
zetDebugReadRegisters¶
-
ZE_APIEXPORT ze_result_t ZE_APICALL
zetDebugReadRegisters
(zet_debug_session_handle_t hDebug, ze_device_thread_t thread, uint32_t type, uint32_t start, uint32_t count, void *pRegisterValues)¶ Read register state.
- Parameters
hDebug
: [in] debug session handlethread
: [in] the thread identifiertype
: [in] register set typestart
: [in] the starting offset into the register state area; must be less than zet_debug_regset_properties_t.count for the typecount
: [in] the number of registers to read; start+count must be <= zet_debug_register_group_properties_t.count for the typepRegisterValues
: [in,out][optional][range(0, count)] buffer of register values
- Return
ZE_RESULT_ERROR_INVALID_NULL_HANDLE
nullptr == hDebug
the thread is running or unavailable
zetDebugWriteRegisters¶
-
ZE_APIEXPORT ze_result_t ZE_APICALL
zetDebugWriteRegisters
(zet_debug_session_handle_t hDebug, ze_device_thread_t thread, uint32_t type, uint32_t start, uint32_t count, void *pRegisterValues)¶ Write register state.
- Parameters
hDebug
: [in] debug session handlethread
: [in] the thread identifiertype
: [in] register set typestart
: [in] the starting offset into the register state area; must be less than zet_debug_regset_properties_t.count for the typecount
: [in] the number of registers to write; start+count must be <= zet_debug_register_group_properties_t.count for the typepRegisterValues
: [in,out][optional][range(0, count)] buffer of register values
- Return
ZE_RESULT_ERROR_INVALID_NULL_HANDLE
nullptr == hDebug
the thread is running or unavailable
Debug Enums¶
zet_device_debug_property_flags_t¶
zet_debug_event_flags_t¶
-
enum
zet_debug_event_flag_t
¶ Values:
-
ZET_DEBUG_EVENT_FLAG_NEED_ACK
= ZE_BIT(0)¶ The event needs to be acknowledged by calling zetDebugAcknowledgeEvent.
-
ZET_DEBUG_EVENT_FLAG_FORCE_UINT32
= 0x7fffffff¶
-
zet_debug_event_type_t¶
-
enum
zet_debug_event_type_t
¶ Supported debug event types.
Values:
-
ZET_DEBUG_EVENT_TYPE_INVALID
= 0¶ The event is invalid.
-
ZET_DEBUG_EVENT_TYPE_DETACHED
= 1¶ The tool was detached.
-
ZET_DEBUG_EVENT_TYPE_PROCESS_ENTRY
= 2¶ The debuggee process created command queues on the device.
-
ZET_DEBUG_EVENT_TYPE_PROCESS_EXIT
= 3¶ The debuggee process destroyed all command queues on the device.
-
ZET_DEBUG_EVENT_TYPE_MODULE_LOAD
= 4¶ An in-memory module was loaded onto the device.
-
ZET_DEBUG_EVENT_TYPE_MODULE_UNLOAD
= 5¶ An in-memory module is about to get unloaded from the device.
-
ZET_DEBUG_EVENT_TYPE_THREAD_STOPPED
= 6¶ The thread stopped due to a device exception.
-
ZET_DEBUG_EVENT_TYPE_THREAD_UNAVAILABLE
= 7¶ The thread is not available to be stopped.
-
ZET_DEBUG_EVENT_TYPE_PAGE_FAULT
= 8¶ A page request could not be completed on the device.
-
ZET_DEBUG_EVENT_TYPE_FORCE_UINT32
= 0x7fffffff¶
-
zet_debug_detach_reason_t¶
zet_debug_page_fault_reason_t¶
-
enum
zet_debug_page_fault_reason_t
¶ Page fault reasons.
Values:
-
ZET_DEBUG_PAGE_FAULT_REASON_INVALID
= 0¶ The page fault reason is not valid.
-
ZET_DEBUG_PAGE_FAULT_REASON_MAPPING_ERROR
= 1¶ The address is not mapped.
-
ZET_DEBUG_PAGE_FAULT_REASON_PERMISSION_ERROR
= 2¶ Invalid access permissions.
-
ZET_DEBUG_PAGE_FAULT_REASON_FORCE_UINT32
= 0x7fffffff¶
-
zet_debug_memory_space_type_t¶
Debug Structures¶
zet_device_debug_properties_t¶
-
struct
zet_device_debug_properties_t
¶ Device debug properties queried using zetDeviceGetDebugProperties.
Public Members
-
zet_structure_type_t
stype
¶ [in] type of this structure
-
void *
pNext
¶ [in,out][optional] pointer to extension-specific structure
-
zet_device_debug_property_flags_t
flags
¶ [out] returns 0 (none) or a valid combination of zet_device_debug_property_flag_t
-
zet_structure_type_t
zet_debug_config_t¶
-
struct
zet_debug_config_t
¶ Debug configuration provided to zetDebugAttach.
Public Members
-
uint32_t
pid
¶ [in] the host process identifier
-
uint32_t
zet_debug_event_info_detached_t¶
-
struct
zet_debug_event_info_detached_t
¶ Event information for ZET_DEBUG_EVENT_TYPE_DETACHED.
Public Members
-
zet_debug_detach_reason_t
reason
¶ [out] the detach reason
-
zet_debug_detach_reason_t
zet_debug_event_info_module_t¶
-
struct
zet_debug_event_info_module_t
¶ Event information for ZET_DEBUG_EVENT_TYPE_MODULE_LOAD and ZET_DEBUG_EVENT_TYPE_MODULE_UNLOAD.
Public Members
-
zet_module_debug_info_format_t
format
¶ [out] the module format
-
uint64_t
moduleBegin
¶ [out] the begin address of the in-memory module
-
uint64_t
moduleEnd
¶ [out] the end address of the in-memory module
-
uint64_t
load
¶ [out] the load address of the module on the device
-
zet_module_debug_info_format_t
zet_debug_event_info_thread_stopped_t¶
-
struct
zet_debug_event_info_thread_stopped_t
¶ Event information for ZET_DEBUG_EVENT_TYPE_THREAD_STOPPED and ZET_DEBUG_EVENT_TYPE_THREAD_UNAVAILABLE.
Public Members
-
ze_device_thread_t
thread
¶ [out] the stopped/unavailable thread
-
ze_device_thread_t
zet_debug_event_info_page_fault_t¶
-
struct
zet_debug_event_info_page_fault_t
¶ Event information for ZET_DEBUG_EVENT_TYPE_PAGE_FAULT.
Public Members
-
uint64_t
address
¶ [out] the faulting address
-
uint64_t
mask
¶ [out] the alignment mask
-
zet_debug_page_fault_reason_t
reason
¶ [out] the page fault reason
-
uint64_t
zet_debug_event_info_t¶
-
union
zet_debug_event_info_t
¶ - #include <zet_api.h>
Event type-specific information.
Public Members
-
zet_debug_event_info_detached_t
detached
¶ [out] type == ZET_DEBUG_EVENT_TYPE_DETACHED
-
zet_debug_event_info_module_t
module
¶ [out] type == ZET_DEBUG_EVENT_TYPE_MODULE_LOAD or ZET_DEBUG_EVENT_TYPE_MODULE_UNLOAD
-
zet_debug_event_info_thread_stopped_t
thread
¶ [out] type == ZET_DEBUG_EVENT_TYPE_THREAD_STOPPED or ZET_DEBUG_EVENT_TYPE_THREAD_UNAVAILABLE
-
zet_debug_event_info_page_fault_t
page_fault
¶ [out] type == ZET_DEBUG_EVENT_TYPE_PAGE_FAULT
-
zet_debug_event_info_detached_t
zet_debug_event_t¶
-
struct
zet_debug_event_t
¶ A debug event on the device.
Public Members
-
zet_debug_event_type_t
type
¶ [out] the event type
-
zet_debug_event_flags_t
flags
¶ [out] returns 0 (none) or a combination of zet_debug_event_flag_t
-
zet_debug_event_info_t
info
¶ [out] event type specific information
-
zet_debug_event_type_t
zet_debug_memory_space_desc_t¶
-
struct
zet_debug_memory_space_desc_t
¶ Device memory space descriptor.
Public Members
-
zet_structure_type_t
stype
¶ [in] type of this structure
-
const void *
pNext
¶ [in][optional] pointer to extension-specific structure
-
zet_debug_memory_space_type_t
type
¶ [in] type of memory space
-
uint64_t
address
¶ [in] the virtual address within the memory space
-
zet_structure_type_t
zet_debug_regset_properties_t¶
-
struct
zet_debug_regset_properties_t
¶ Device register set properties queried using zetDebugGetRegisterSetProperties.
Public Members
-
zet_structure_type_t
stype
¶ [in] type of this structure
-
void *
pNext
¶ [in,out][optional] pointer to extension-specific structure
-
uint32_t
type
¶ [out] device-specific register set type
-
uint32_t
version
¶ [out] device-specific version of this register set
-
zet_debug_regset_flags_t
generalFlags
¶ [out] general register set flags
-
uint32_t
deviceFlags
¶ [out] device-specific register set flags
-
uint32_t
count
¶ [out] number of registers in the set
-
uint32_t
bitSize
¶ [out] the size of a register in bits
-
uint32_t
byteSize
¶ [out] the size required for reading or writing a register in bytes
-
zet_structure_type_t
Metric¶
Functions
Enumerations
Structures
Metric Functions¶
zetMetricGroupGet¶
-
ZE_APIEXPORT ze_result_t ZE_APICALL
zetMetricGroupGet
(zet_device_handle_t hDevice, uint32_t *pCount, zet_metric_group_handle_t *phMetricGroups)¶ Retrieves metric group for a device.
- Parameters
hDevice
: [in] handle of the devicepCount
: [in,out] pointer to the number of metric groups. if count is zero, then the driver shall update the value with the total number of metric groups available. if count is greater than the number of metric groups available, then the driver shall update the value with the correct number of metric groups available.phMetricGroups
: [in,out][optional][range(0, *pCount)] array of handle of metric groups. if count is less than the number of metric groups available, then driver shall only retrieve that number of metric groups.
The application may call this function from simultaneous threads.
- Return
ZE_RESULT_ERROR_INVALID_NULL_HANDLE
nullptr == hDevice
ZE_RESULT_ERROR_INVALID_NULL_POINTER
nullptr == pCount
zetMetricGroupGetProperties¶
-
ZE_APIEXPORT ze_result_t ZE_APICALL
zetMetricGroupGetProperties
(zet_metric_group_handle_t hMetricGroup, zet_metric_group_properties_t *pProperties)¶ Retrieves attributes of a metric group.
- Parameters
hMetricGroup
: [in] handle of the metric grouppProperties
: [in,out] metric group properties
The application may call this function from simultaneous threads.
- Return
ZE_RESULT_ERROR_INVALID_NULL_HANDLE
nullptr == hMetricGroup
ZE_RESULT_ERROR_INVALID_NULL_POINTER
nullptr == pProperties
zetMetricGroupCalculateMetricValues¶
-
ZE_APIEXPORT ze_result_t ZE_APICALL
zetMetricGroupCalculateMetricValues
(zet_metric_group_handle_t hMetricGroup, zet_metric_group_calculation_type_t type, size_t rawDataSize, const uint8_t *pRawData, uint32_t *pMetricValueCount, zet_typed_value_t *pMetricValues)¶ Calculates metric values from raw data.
- Parameters
hMetricGroup
: [in] handle of the metric grouptype
: [in] calculation type to be applied on raw datarawDataSize
: [in] size in bytes of raw data bufferpRawData
: [in][range(0, rawDataSize)] buffer of raw data to calculatepMetricValueCount
: [in,out] pointer to number of metric values calculated. if count is zero, then the driver shall update the value with the total number of metric values to be calculated. if count is greater than the number available in the raw data buffer, then the driver shall update the value with the actual number of metric values to be calculated.pMetricValues
: [in,out][optional][range(0, *pMetricValueCount)] buffer of calculated metrics. if count is less than the number available in the raw data buffer, then driver shall only calculate that number of metric values.
The application may call this function from simultaneous threads.
- Return
ZE_RESULT_ERROR_INVALID_NULL_HANDLE
nullptr == hMetricGroup
ZE_RESULT_ERROR_INVALID_NULL_POINTER
nullptr == pRawData
nullptr == pMetricValueCount
zetMetricGet¶
-
ZE_APIEXPORT ze_result_t ZE_APICALL
zetMetricGet
(zet_metric_group_handle_t hMetricGroup, uint32_t *pCount, zet_metric_handle_t *phMetrics)¶ Retrieves metric from a metric group.
- Parameters
hMetricGroup
: [in] handle of the metric grouppCount
: [in,out] pointer to the number of metrics. if count is zero, then the driver shall update the value with the total number of metrics available. if count is greater than the number of metrics available, then the driver shall update the value with the correct number of metrics available.phMetrics
: [in,out][optional][range(0, *pCount)] array of handle of metrics. if count is less than the number of metrics available, then driver shall only retrieve that number of metrics.
The application may call this function from simultaneous threads.
- Return
ZE_RESULT_ERROR_INVALID_NULL_HANDLE
nullptr == hMetricGroup
ZE_RESULT_ERROR_INVALID_NULL_POINTER
nullptr == pCount
zetMetricGetProperties¶
-
ZE_APIEXPORT ze_result_t ZE_APICALL
zetMetricGetProperties
(zet_metric_handle_t hMetric, zet_metric_properties_t *pProperties)¶ Retrieves attributes of a metric.
- Parameters
hMetric
: [in] handle of the metricpProperties
: [in,out] metric properties
The application may call this function from simultaneous threads.
- Return
ZE_RESULT_ERROR_INVALID_NULL_HANDLE
nullptr == hMetric
ZE_RESULT_ERROR_INVALID_NULL_POINTER
nullptr == pProperties
zetContextActivateMetricGroups¶
-
ZE_APIEXPORT ze_result_t ZE_APICALL
zetContextActivateMetricGroups
(zet_context_handle_t hContext, zet_device_handle_t hDevice, uint32_t count, zet_metric_group_handle_t *phMetricGroups)¶ Activates metric groups.
- Parameters
hContext
: [in] handle of the context objecthDevice
: [in] handle of the devicecount
: [in] metric group count to activate; must be 0 if `nullptr == phMetricGroups`phMetricGroups
: [in][optional][range(0, count)] handles of the metric groups to activate. nullptr deactivates all previously used metric groups. all metrics groups must come from a different domains. metric query and metric stream must use activated metric groups.
Immediately reconfigures the device to activate only those metric groups provided.
Any metric groups previously activated but not provided will be deactivated.
Deactivating metric groups that are still in-use will result in undefined behavior.
All metric groups must have different domains, see zet_metric_group_properties_t.
The application must not call this function from simultaneous threads with the same device handle.
- Return
ZE_RESULT_ERROR_INVALID_NULL_HANDLE
nullptr == hContext
nullptr == hDevice
(nullptr == phMetricGroups) && (0 < count)
ZE_RESULT_ERROR_INVALID_ARGUMENT
Multiple metric groups share the same domain
zetMetricStreamerOpen¶
-
ZE_APIEXPORT ze_result_t ZE_APICALL
zetMetricStreamerOpen
(zet_context_handle_t hContext, zet_device_handle_t hDevice, zet_metric_group_handle_t hMetricGroup, zet_metric_streamer_desc_t *desc, ze_event_handle_t hNotificationEvent, zet_metric_streamer_handle_t *phMetricStreamer)¶ Opens metric streamer for a device.
- Parameters
hContext
: [in] handle of the context objecthDevice
: [in] handle of the devicehMetricGroup
: [in] handle of the metric groupdesc
: [in,out] metric streamer descriptorhNotificationEvent
: [in][optional] event used for report availability notificationphMetricStreamer
: [out] handle of metric streamer
The notification event must have been created from an event pool that was created using ZE_EVENT_POOL_FLAG_HOST_VISIBLE flag.
The duration of the signal event created from an event pool that was created using ZE_EVENT_POOL_FLAG_KERNEL_TIMESTAMP flag is undefined. However, for consistency and orthogonality the event will report correctly as signaled when used by other event API functionality.
The application must not call this function from simultaneous threads with the same device handle.
- Return
ZE_RESULT_ERROR_INVALID_NULL_HANDLE
nullptr == hContext
nullptr == hDevice
nullptr == hMetricGroup
ZE_RESULT_ERROR_INVALID_NULL_POINTER
nullptr == desc
nullptr == phMetricStreamer
zetCommandListAppendMetricStreamerMarker¶
-
ZE_APIEXPORT ze_result_t ZE_APICALL
zetCommandListAppendMetricStreamerMarker
(zet_command_list_handle_t hCommandList, zet_metric_streamer_handle_t hMetricStreamer, uint32_t value)¶ Append metric streamer marker into a command list.
- Parameters
hCommandList
: [in] handle of the command listhMetricStreamer
: [in] handle of the metric streamervalue
: [in] streamer marker value
The application must ensure the metric streamer is accessible by the device on which the command list was created.
The application must ensure the command list and metric streamer were created on the same context.
The application must not call this function from simultaneous threads with the same command list handle.
Allow to associate metric stream time based metrics with executed workload.
- Return
ZE_RESULT_ERROR_INVALID_NULL_HANDLE
nullptr == hCommandList
nullptr == hMetricStreamer
zetMetricStreamerClose¶
-
ZE_APIEXPORT ze_result_t ZE_APICALL
zetMetricStreamerClose
(zet_metric_streamer_handle_t hMetricStreamer)¶ Closes metric streamer.
- Parameters
hMetricStreamer
: [in][release] handle of the metric streamer
The application must not call this function from simultaneous threads with the same metric streamer handle.
- Return
ZE_RESULT_ERROR_INVALID_NULL_HANDLE
nullptr == hMetricStreamer
zetMetricStreamerReadData¶
-
ZE_APIEXPORT ze_result_t ZE_APICALL
zetMetricStreamerReadData
(zet_metric_streamer_handle_t hMetricStreamer, uint32_t maxReportCount, size_t *pRawDataSize, uint8_t *pRawData)¶ Reads data from metric streamer.
- Parameters
hMetricStreamer
: [in] handle of the metric streamermaxReportCount
: [in] the maximum number of reports the application wants to receive. if UINT32_MAX, then function will retrieve all reports availablepRawDataSize
: [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 reports available. if size is non-zero, then driver will only retrieve the number of reports that fit into the buffer. if size is larger than size needed for all reports, then driver will update the value with the actual size needed.pRawData
: [in,out][optional][range(0, *pRawDataSize)] buffer containing streamer reports in raw format
The application may call this function from simultaneous threads.
- Return
ZE_RESULT_ERROR_INVALID_NULL_HANDLE
nullptr == hMetricStreamer
ZE_RESULT_ERROR_INVALID_NULL_POINTER
nullptr == pRawDataSize
zetMetricQueryPoolCreate¶
-
ZE_APIEXPORT ze_result_t ZE_APICALL
zetMetricQueryPoolCreate
(zet_context_handle_t hContext, zet_device_handle_t hDevice, zet_metric_group_handle_t hMetricGroup, const zet_metric_query_pool_desc_t *desc, zet_metric_query_pool_handle_t *phMetricQueryPool)¶ Creates a pool of metric queries on the context.
- Parameters
hContext
: [in] handle of the context objecthDevice
: [in] handle of the devicehMetricGroup
: [in] metric group associated with the query object.desc
: [in] metric query pool descriptorphMetricQueryPool
: [out] handle of metric query pool
The application may call this function from simultaneous threads.
The implementation of this function must be thread-safe.
- Return
ZE_RESULT_ERROR_INVALID_NULL_HANDLE
nullptr == hContext
nullptr == hDevice
nullptr == hMetricGroup
ZE_RESULT_ERROR_INVALID_NULL_POINTER
nullptr == desc
nullptr == phMetricQueryPool
ZE_RESULT_ERROR_INVALID_ENUMERATION
ZET_METRIC_QUERY_POOL_TYPE_EXECUTION < desc->type
zetMetricQueryPoolDestroy¶
-
ZE_APIEXPORT ze_result_t ZE_APICALL
zetMetricQueryPoolDestroy
(zet_metric_query_pool_handle_t hMetricQueryPool)¶ Deletes a query pool object.
- Parameters
hMetricQueryPool
: [in][release] handle of the metric query pool
The application must destroy all query handles created from the pool before destroying the pool itself.
The application must ensure the device is not currently referencing the any query within the pool before it is deleted.
The application must not call this function from simultaneous threads with the same query pool handle.
The implementation of this function must be thread-safe.
- Return
zetMetricQueryCreate¶
-
ZE_APIEXPORT ze_result_t ZE_APICALL
zetMetricQueryCreate
(zet_metric_query_pool_handle_t hMetricQueryPool, uint32_t index, zet_metric_query_handle_t *phMetricQuery)¶ Creates metric query from the pool.
- Parameters
hMetricQueryPool
: [in] handle of the metric query poolindex
: [in] index of the query within the poolphMetricQuery
: [out] handle of metric query
The application may call this function from simultaneous threads.
The implementation of this function must be thread-safe.
- Return
ZE_RESULT_ERROR_INVALID_NULL_HANDLE
nullptr == hMetricQueryPool
ZE_RESULT_ERROR_INVALID_NULL_POINTER
nullptr == phMetricQuery
zetMetricQueryDestroy¶
-
ZE_APIEXPORT ze_result_t ZE_APICALL
zetMetricQueryDestroy
(zet_metric_query_handle_t hMetricQuery)¶ Deletes a metric query object.
- Parameters
hMetricQuery
: [in][release] handle of metric query
The application must ensure the device is not currently referencing the query before it is deleted.
The application must not call this function from simultaneous threads with the same query handle.
The implementation of this function must be thread-safe.
zetMetricQueryReset¶
-
ZE_APIEXPORT ze_result_t ZE_APICALL
zetMetricQueryReset
(zet_metric_query_handle_t hMetricQuery)¶ Resets a metric query object back to inital state.
- Parameters
hMetricQuery
: [in] handle of metric query
The application must ensure the device is not currently referencing the query before it is reset
The application must not call this function from simultaneous threads with the same query handle.
- Return
ZE_RESULT_ERROR_INVALID_NULL_HANDLE
nullptr == hMetricQuery
zetCommandListAppendMetricQueryBegin¶
-
ZE_APIEXPORT ze_result_t ZE_APICALL
zetCommandListAppendMetricQueryBegin
(zet_command_list_handle_t hCommandList, zet_metric_query_handle_t hMetricQuery)¶ Appends metric query begin into a command list.
- Parameters
hCommandList
: [in] handle of the command listhMetricQuery
: [in] handle of the metric query
The application must ensure the metric query is accessible by the device on which the command list was created.
The application must ensure the command list and metric query were created on the same context.
This command blocks all following commands from beginning until the execution of the query completes.
The application must not call this function from simultaneous threads with the same command list handle.
- Return
ZE_RESULT_ERROR_INVALID_NULL_HANDLE
nullptr == hCommandList
nullptr == hMetricQuery
zetCommandListAppendMetricQueryEnd¶
-
ZE_APIEXPORT ze_result_t ZE_APICALL
zetCommandListAppendMetricQueryEnd
(zet_command_list_handle_t hCommandList, zet_metric_query_handle_t hMetricQuery, ze_event_handle_t hSignalEvent, uint32_t numWaitEvents, ze_event_handle_t *phWaitEvents)¶ Appends metric query end into a command list.
- Parameters
hCommandList
: [in] handle of the command listhMetricQuery
: [in] handle of the metric queryhSignalEvent
: [in][optional] handle of the event to signal on completionnumWaitEvents
: [in] must be zerophWaitEvents
: [in][mbz] must be nullptr
The application must ensure the metric query and events are accessible by the device on which the command list was created.
The application must ensure the command list, events and metric query were created on the same context.
The duration of the signal event created from an event pool that was created using ZE_EVENT_POOL_FLAG_KERNEL_TIMESTAMP flag is undefined. However, for consistency and orthogonality the event will report correctly as signaled when used by other event API functionality.
If numWaitEvents is zero, then all previous commands are completed prior to the execution of the query.
If numWaitEvents is non-zero, then all phWaitEvents must be signaled prior to the execution of the query.
This command blocks all following commands from beginning until the execution of the query completes.
The application must not call this function from simultaneous threads with the same command list handle.
- Return
ZE_RESULT_ERROR_INVALID_NULL_HANDLE
nullptr == hCommandList
nullptr == hMetricQuery
ZE_RESULT_ERROR_INVALID_NULL_POINTER
nullptr == phWaitEvents
(nullptr == phWaitEvents) && (0 < numWaitEvents)
zetCommandListAppendMetricMemoryBarrier¶
-
ZE_APIEXPORT ze_result_t ZE_APICALL
zetCommandListAppendMetricMemoryBarrier
(zet_command_list_handle_t hCommandList)¶ Appends metric query commands to flush all caches.
- Parameters
hCommandList
: [in] handle of the command list
The application must not call this function from simultaneous threads with the same command list handle.
- Return
ZE_RESULT_ERROR_INVALID_NULL_HANDLE
nullptr == hCommandList
zetMetricQueryGetData¶
-
ZE_APIEXPORT ze_result_t ZE_APICALL
zetMetricQueryGetData
(zet_metric_query_handle_t hMetricQuery, size_t *pRawDataSize, uint8_t *pRawData)¶ Retrieves raw data for a given metric query.
- Parameters
hMetricQuery
: [in] handle of the metric querypRawDataSize
: [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 reports available. if size is non-zero, then driver will only retrieve the number of reports that fit into the buffer. if size is larger than size needed for all reports, then driver will update the value with the actual size needed.pRawData
: [in,out][optional][range(0, *pRawDataSize)] buffer containing query reports in raw format
The application may call this function from simultaneous threads.
- Return
ZE_RESULT_ERROR_INVALID_NULL_HANDLE
nullptr == hMetricQuery
ZE_RESULT_ERROR_INVALID_NULL_POINTER
nullptr == pRawDataSize
Metric Enums¶
zet_metric_group_sampling_type_flags_t¶
zet_metric_type_t¶
-
enum
zet_metric_type_t
¶ Metric types.
Values:
-
ZET_METRIC_TYPE_DURATION
= 0¶ Metric type: duration.
-
ZET_METRIC_TYPE_EVENT
= 1¶ Metric type: event.
-
ZET_METRIC_TYPE_EVENT_WITH_RANGE
= 2¶ Metric type: event with range.
-
ZET_METRIC_TYPE_THROUGHPUT
= 3¶ Metric type: throughput.
-
ZET_METRIC_TYPE_TIMESTAMP
= 4¶ Metric type: timestamp.
-
ZET_METRIC_TYPE_FLAG
= 5¶ Metric type: flag.
-
ZET_METRIC_TYPE_RATIO
= 6¶ Metric type: ratio.
-
ZET_METRIC_TYPE_RAW
= 7¶ Metric type: raw.
-
ZET_METRIC_TYPE_FORCE_UINT32
= 0x7fffffff¶
-
zet_metric_group_calculation_type_t¶
-
enum
zet_metric_group_calculation_type_t
¶ Metric group calculation type.
Values:
-
ZET_METRIC_GROUP_CALCULATION_TYPE_METRIC_VALUES
= 0¶ Calculated metric values from raw data.
-
ZET_METRIC_GROUP_CALCULATION_TYPE_MAX_METRIC_VALUES
= 1¶ Maximum metric values.
-
ZET_METRIC_GROUP_CALCULATION_TYPE_FORCE_UINT32
= 0x7fffffff¶
-
zet_metric_query_pool_type_t¶
Metric Structures¶
zet_metric_group_properties_t¶
-
struct
zet_metric_group_properties_t
¶ Metric group properties queried using zetMetricGroupGetProperties.
Public Members
-
zet_structure_type_t
stype
¶ [in] type of this structure
-
void *
pNext
¶ [in,out][optional] pointer to extension-specific structure
-
char
name
[ZET_MAX_METRIC_GROUP_NAME
]¶ [out] metric group name
-
char
description
[ZET_MAX_METRIC_GROUP_DESCRIPTION
]¶ [out] metric group description
-
zet_metric_group_sampling_type_flags_t
samplingType
¶ returns a combination of zet_metric_group_sampling_type_flag_t.
[out] metric group sampling type.
-
uint32_t
domain
¶ [out] metric group domain number. Cannot use multiple, simultaneous metric groups from the same domain.
-
uint32_t
metricCount
¶ [out] metric count belonging to this group
-
zet_structure_type_t
zet_metric_properties_t¶
-
struct
zet_metric_properties_t
¶ Metric properties queried using zetMetricGetProperties.
Public Members
-
zet_structure_type_t
stype
¶ [in] type of this structure
-
void *
pNext
¶ [in,out][optional] pointer to extension-specific structure
-
char
name
[ZET_MAX_METRIC_NAME
]¶ [out] metric name
-
char
description
[ZET_MAX_METRIC_DESCRIPTION
]¶ [out] metric description
-
char
component
[ZET_MAX_METRIC_COMPONENT
]¶ [out] metric component
-
uint32_t
tierNumber
¶ [out] number of tier
-
zet_metric_type_t
metricType
¶ [out] metric type
-
zet_value_type_t
resultType
¶ [out] metric result type
-
char
resultUnits
[ZET_MAX_METRIC_RESULT_UNITS
]¶ [out] metric result units
-
zet_structure_type_t
zet_metric_streamer_desc_t¶
-
struct
zet_metric_streamer_desc_t
¶ Metric streamer descriptor.
Public Members
-
zet_structure_type_t
stype
¶ [in] type of this structure
-
const void *
pNext
¶ [in][optional] pointer to extension-specific structure
-
uint32_t
notifyEveryNReports
¶ [in,out] number of collected reports after which notification event will be signalled
-
uint32_t
samplingPeriod
¶ [in,out] streamer sampling period in nanoseconds
-
zet_structure_type_t
zet_metric_query_pool_desc_t¶
-
struct
zet_metric_query_pool_desc_t
¶ Metric query pool description.
Public Members
-
zet_structure_type_t
stype
¶ [in] type of this structure
-
const void *
pNext
¶ [in][optional] pointer to extension-specific structure
-
zet_metric_query_pool_type_t
type
¶ [in] Query pool type.
-
uint32_t
count
¶ [in] Internal slots count within query pool object.
-
zet_structure_type_t
Pin¶
Functions
Enumerations
Structures
Pin Functions¶
zetKernelGetProfileInfo¶
-
ZE_APIEXPORT ze_result_t ZE_APICALL
zetKernelGetProfileInfo
(zet_kernel_handle_t hKernel, zet_profile_properties_t *pProfileProperties)¶ Retrieve profiling information generated for the kernel.
- Parameters
hKernel
: [in] handle to kernelpProfileProperties
: [out] pointer to profile properties
Module must be created using the following build option:
”-zet-profile-flags <n>” - enable generation of profile information
”<n>” must be a combination of zet_profile_flag_t, in hex
The application may call this function from simultaneous threads.
The implementation of this function should be lock-free.
- Return
ZE_RESULT_ERROR_INVALID_NULL_HANDLE
nullptr == hKernel
ZE_RESULT_ERROR_INVALID_NULL_POINTER
nullptr == pProfileProperties
Pin Enums¶
zet_profile_flags_t¶
-
enum
zet_profile_flag_t
¶ Values:
-
ZET_PROFILE_FLAG_REGISTER_REALLOCATION
= ZE_BIT(0)¶ possible to allow for instrumentation
request the compiler attempt to minimize register usage as much as
-
ZET_PROFILE_FLAG_FREE_REGISTER_INFO
= ZE_BIT(1)¶ request the compiler generate free register info
-
ZET_PROFILE_FLAG_FORCE_UINT32
= 0x7fffffff¶
-
Pin Structures¶
zet_profile_properties_t¶
-
struct
zet_profile_properties_t
¶ Profiling meta-data for instrumentation.
Public Members
-
zet_structure_type_t
stype
¶ [in] type of this structure
-
void *
pNext
¶ [in,out][optional] pointer to extension-specific structure
-
zet_profile_flags_t
flags
¶ [out] indicates which flags were enabled during compilation. returns 0 (none) or a combination of zet_profile_flag_t
-
uint32_t
numTokens
¶ [out] number of tokens immediately following this structure
-
zet_structure_type_t
zet_profile_free_register_token_t¶
-
struct
zet_profile_free_register_token_t
¶ Profile free register token detailing unused registers in the current function.
Public Members
-
zet_profile_token_type_t
type
¶ [out] type of token
-
uint32_t
size
¶ [out] total size of the token, in bytes
-
uint32_t
count
¶ [out] number of register sequences immediately following this structure
-
zet_profile_token_type_t
Tracing¶
Functions
Enumerations
Structures
Tracing Functions¶
zetTracerExpCreate¶
-
ZE_APIEXPORT ze_result_t ZE_APICALL
zetTracerExpCreate
(zet_context_handle_t hContext, const zet_tracer_exp_desc_t *desc, zet_tracer_exp_handle_t *phTracer)¶ Creates a tracer on the context.
- Parameters
hContext
: [in] handle of the context objectdesc
: [in] pointer to tracer descriptorphTracer
: [out] pointer to handle of tracer object created
The application must only use the tracer for the context which was provided during creation.
The tracer is created in the disabled state.
The application may call this function from simultaneous threads.
The implementation of this function must be thread-safe.
- Return
ZE_RESULT_ERROR_INVALID_NULL_HANDLE
nullptr == hContext
ZE_RESULT_ERROR_INVALID_NULL_POINTER
nullptr == desc
nullptr == desc->pUserData
nullptr == phTracer
zetTracerExpDestroy¶
-
ZE_APIEXPORT ze_result_t ZE_APICALL
zetTracerExpDestroy
(zet_tracer_exp_handle_t hTracer)¶ Destroys a tracer.
- Parameters
hTracer
: [in][release] handle of tracer object to destroy
The application must not call this function from simultaneous threads with the same tracer handle.
The implementation of this function must be thread-safe.
The implementation of this function will stall and wait on any outstanding threads executing callbacks before freeing any Host allocations associated with this tracer.
zetTracerExpSetPrologues¶
-
ZE_APIEXPORT ze_result_t ZE_APICALL
zetTracerExpSetPrologues
(zet_tracer_exp_handle_t hTracer, zet_core_callbacks_t *pCoreCbs)¶ Sets the collection of callbacks to be executed before driver execution.
- Parameters
hTracer
: [in] handle of the tracerpCoreCbs
: [in] pointer to table of ‘core’ callback function pointers
The application only needs to set the function pointers it is interested in receiving; all others should be ‘nullptr’
The application must ensure that no other threads are executing functions for which the tracing functions are changing.
The application must not call this function from simultaneous threads with the same tracer handle.
- Return
ZE_RESULT_ERROR_INVALID_NULL_HANDLE
nullptr == hTracer
ZE_RESULT_ERROR_INVALID_NULL_POINTER
nullptr == pCoreCbs
zetTracerExpSetEpilogues¶
-
ZE_APIEXPORT ze_result_t ZE_APICALL
zetTracerExpSetEpilogues
(zet_tracer_exp_handle_t hTracer, zet_core_callbacks_t *pCoreCbs)¶ Sets the collection of callbacks to be executed after driver execution.
- Parameters
hTracer
: [in] handle of the tracerpCoreCbs
: [in] pointer to table of ‘core’ callback function pointers
The application only needs to set the function pointers it is interested in receiving; all others should be ‘nullptr’
The application must ensure that no other threads are executing functions for which the tracing functions are changing.
The application must not call this function from simultaneous threads with the same tracer handle.
- Return
ZE_RESULT_ERROR_INVALID_NULL_HANDLE
nullptr == hTracer
ZE_RESULT_ERROR_INVALID_NULL_POINTER
nullptr == pCoreCbs
zetTracerExpSetEnabled¶
-
ZE_APIEXPORT ze_result_t ZE_APICALL
zetTracerExpSetEnabled
(zet_tracer_exp_handle_t hTracer, ze_bool_t enable)¶ Enables (or disables) the tracer.
- Parameters
hTracer
: [in] handle of the tracerenable
: [in] enable the tracer if true; disable if false
The application must not call this function from simultaneous threads with the same tracer handle.
- Return