diff --git a/include/ze.py b/include/ze.py index ca50bf3b..21fde3fa 100644 --- a/include/ze.py +++ b/include/ze.py @@ -4,7 +4,7 @@ SPDX-License-Identifier: MIT @file ze.py - @version v1.10-r1.10.0 + @version v1.11-r1.9.55 """ import platform @@ -1979,7 +1979,8 @@ def __str__(self): ############################################################################### ## @brief Supported physical memory creation flags class ze_physical_mem_flags_v(IntEnum): - TBD = ZE_BIT(0) ## reserved for future use. + ALLOCATE_ON_DEVICE = ZE_BIT(0) ## [default] allocate physical device memory. + ALLOCATE_ON_HOST = ZE_BIT(1) ## Allocate physical host memory instead. class ze_physical_mem_flags_t(c_int): def __str__(self): @@ -1994,7 +1995,8 @@ class ze_physical_mem_desc_t(Structure): ("pNext", c_void_p), ## [in][optional] must be null or a pointer to an extension-specific ## structure (i.e. contains stype and pNext). ("flags", ze_physical_mem_flags_t), ## [in] creation flags. - ## must be 0 (default) or a valid combination of ::ze_physical_mem_flag_t. + ## must be 0 (default) or a valid combination of + ## ::ze_physical_mem_flag_t; default is to create physical device memory. ("size", c_size_t) ## [in] size in bytes to reserve; must be page aligned. ] @@ -2257,6 +2259,10 @@ class ze_relaxed_allocation_limits_exp_desc_t(Structure): ## must be 0 (default) or a valid combination of ::ze_relaxed_allocation_limits_exp_flag_t; ] +############################################################################### +## @brief Get Kernel Binary Extension Name +ZE_GET_KERNEL_BINARY_EXP_NAME = "ZE_extension_kernel_binary_exp" + ############################################################################### ## @brief Cache_Reservation Extension Name ZE_CACHE_RESERVATION_EXT_NAME = "ZE_extension_cache_reservation" diff --git a/include/ze_api.h b/include/ze_api.h index 1b81dacc..05a3b88d 100644 --- a/include/ze_api.h +++ b/include/ze_api.h @@ -5,7 +5,7 @@ * SPDX-License-Identifier: MIT * * @file ze_api.h - * @version v1.10-r1.10.0 + * @version v1.11-r1.9.55 * */ #ifndef _ZE_API_H @@ -2275,13 +2275,15 @@ zeDeviceGetStatus( /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == hostTimestamp` /// + `nullptr == deviceTimestamp` +/// - ::ZE_RESULT_ERROR_UNSUPPORTED_FEATURE +/// + The feature is not supported by the underlying platform. ZE_APIEXPORT ze_result_t ZE_APICALL zeDeviceGetGlobalTimestamps( ze_device_handle_t hDevice, ///< [in] handle of the device uint64_t* hostTimestamp, ///< [out] value of the Host's global timestamp that correlates with the - ///< Device's global timestamp value + ///< Device's global timestamp value. uint64_t* deviceTimestamp ///< [out] value of the Device's global timestamp that correlates with the - ///< Host's global timestamp value + ///< Host's global timestamp value. ); #if !defined(__GNUC__) @@ -7250,7 +7252,8 @@ zeVirtualMemQueryPageSize( typedef uint32_t ze_physical_mem_flags_t; typedef enum _ze_physical_mem_flag_t { - ZE_PHYSICAL_MEM_FLAG_TBD = ZE_BIT(0), ///< reserved for future use. + ZE_PHYSICAL_MEM_FLAG_ALLOCATE_ON_DEVICE = ZE_BIT(0), ///< [default] allocate physical device memory. + ZE_PHYSICAL_MEM_FLAG_ALLOCATE_ON_HOST = ZE_BIT(1), ///< Allocate physical host memory instead. ZE_PHYSICAL_MEM_FLAG_FORCE_UINT32 = 0x7fffffff } ze_physical_mem_flag_t; @@ -7263,7 +7266,8 @@ typedef struct _ze_physical_mem_desc_t const void* pNext; ///< [in][optional] must be null or a pointer to an extension-specific ///< structure (i.e. contains stype and pNext). ze_physical_mem_flags_t flags; ///< [in] creation flags. - ///< must be 0 (default) or a valid combination of ::ze_physical_mem_flag_t. + ///< must be 0 (default) or a valid combination of + ///< ::ze_physical_mem_flag_t; default is to create physical device memory. size_t size; ///< [in] size in bytes to reserve; must be page aligned. } ze_physical_mem_desc_t; @@ -7274,7 +7278,9 @@ typedef struct _ze_physical_mem_desc_t /// @details /// - The application must only use the physical memory object on the /// context for which it was created. -/// - The size must be page aligned. See ::zeVirtualMemQueryPageSize. +/// - The size must be page aligned. For host memory, the operating system +/// page size should be used. For device memory, see +/// ::zeVirtualMemQueryPageSize. /// - The application may call this function from simultaneous threads. /// - The implementation of this function must be thread-safe. /// @@ -7291,14 +7297,15 @@ typedef struct _ze_physical_mem_desc_t /// + `nullptr == desc` /// + `nullptr == phPhysicalMemory` /// - ::ZE_RESULT_ERROR_INVALID_ENUMERATION -/// + `0x1 < desc->flags` +/// + `0x3 < desc->flags` /// - ::ZE_RESULT_ERROR_UNSUPPORTED_SIZE /// + `0 == desc->size` /// - ::ZE_RESULT_ERROR_UNSUPPORTED_ALIGNMENT ZE_APIEXPORT ze_result_t ZE_APICALL zePhysicalMemCreate( ze_context_handle_t hContext, ///< [in] handle of the context object - ze_device_handle_t hDevice, ///< [in] handle of the device object + ze_device_handle_t hDevice, ///< [in] handle of the device object, can be `nullptr` if creating + ///< physical host memory. ze_physical_mem_desc_t* desc, ///< [in] pointer to physical memory descriptor. ze_physical_mem_handle_t* phPhysicalMemory ///< [out] pointer to handle of physical memory object created ); @@ -8014,6 +8021,19 @@ typedef struct _ze_relaxed_allocation_limits_exp_desc_t } ze_relaxed_allocation_limits_exp_desc_t; +#if !defined(__GNUC__) +#pragma endregion +#endif +// Intel 'oneAPI' Level-Zero Extension for retrieving kernel binary program data. +#if !defined(__GNUC__) +#pragma region kernelBinary +#endif +/////////////////////////////////////////////////////////////////////////////// +#ifndef ZE_GET_KERNEL_BINARY_EXP_NAME +/// @brief Get Kernel Binary Extension Name +#define ZE_GET_KERNEL_BINARY_EXP_NAME "ZE_extension_kernel_binary_exp" +#endif // ZE_GET_KERNEL_BINARY_EXP_NAME + #if !defined(__GNUC__) #pragma endregion #endif diff --git a/include/ze_ddi.h b/include/ze_ddi.h index 5656622e..027ab81f 100644 --- a/include/ze_ddi.h +++ b/include/ze_ddi.h @@ -5,7 +5,7 @@ * SPDX-License-Identifier: MIT * * @file ze_ddi.h - * @version v1.10-r1.10.0 + * @version v1.11-r1.9.55 * */ #ifndef _ZE_DDI_H diff --git a/include/zes.py b/include/zes.py index cc44c840..019d1c89 100644 --- a/include/zes.py +++ b/include/zes.py @@ -4,7 +4,7 @@ SPDX-License-Identifier: MIT @file zes.py - @version v1.10-r1.10.0 + @version v1.11-r1.9.55 """ import platform @@ -162,9 +162,12 @@ class zes_structure_type_v(IntEnum): MEM_BANDWIDTH_COUNTER_BITS_EXP_PROPERTIES = 0x00020002 ## ::zes_mem_bandwidth_counter_bits_exp_properties_t MEMORY_PAGE_OFFLINE_STATE_EXP = 0x00020003 ## ::zes_mem_page_offline_state_exp_t SUBDEVICE_EXP_PROPERTIES = 0x00020004 ## ::zes_subdevice_exp_properties_t - VF_EXP_CAPABILITIES = 0x00020005 ## ::zes_vf_exp_capabilities_t + VF_EXP_PROPERTIES = 0x00020005 ## ::zes_vf_exp_properties_t VF_UTIL_MEM_EXP = 0x00020006 ## ::zes_vf_util_mem_exp_t VF_UTIL_ENGINE_EXP = 0x00020007 ## ::zes_vf_util_engine_exp_t + VF_EXP_CAPABILITIES = 0x00020008 ## ::zes_vf_exp_capabilities_t + VF_UTIL_MEM_EXP2 = 0x00020009 ## ::zes_vf_util_mem_exp2_t + VF_UTIL_ENGINE_EXP2 = 0x00020010 ## ::zes_vf_util_engine_exp2_t class zes_structure_type_t(c_int): def __str__(self): @@ -2432,14 +2435,78 @@ class zes_subdevice_exp_properties_t(Structure): ## @brief Virtual Function Management Extension Version(s) class zes_vf_management_exp_version_v(IntEnum): _1_0 = ZE_MAKE_VERSION( 1, 0 ) ## version 1.0 (deprecated) - _1_1 = ZE_MAKE_VERSION( 1, 1 ) ## version 1.1 - CURRENT = ZE_MAKE_VERSION( 1, 1 ) ## latest known version + _1_1 = ZE_MAKE_VERSION( 1, 1 ) ## version 1.1 (deprecated) + _1_2 = ZE_MAKE_VERSION( 1, 2 ) ## version 1.2 + CURRENT = ZE_MAKE_VERSION( 1, 2 ) ## latest known version class zes_vf_management_exp_version_t(c_int): def __str__(self): return str(zes_vf_management_exp_version_v(self.value)) +############################################################################### +## @brief Virtual function memory types (deprecated) +class zes_vf_info_mem_type_exp_flags_v(IntEnum): + MEM_TYPE_SYSTEM = ZE_BIT(0) ## System memory + MEM_TYPE_DEVICE = ZE_BIT(1) ## Device local memory + +class zes_vf_info_mem_type_exp_flags_t(c_int): + def __str__(self): + return hex(self.value) + + +############################################################################### +## @brief Virtual function utilization flag bit fields (deprecated) +class zes_vf_info_util_exp_flags_v(IntEnum): + INFO_NONE = ZE_BIT(0) ## No info associated with virtual function + INFO_MEM_CPU = ZE_BIT(1) ## System memory utilization associated with virtual function + INFO_MEM_GPU = ZE_BIT(2) ## Device memory utilization associated with virtual function + INFO_ENGINE = ZE_BIT(3) ## Engine utilization associated with virtual function + +class zes_vf_info_util_exp_flags_t(c_int): + def __str__(self): + return hex(self.value) + + +############################################################################### +## @brief Virtual function management properties (deprecated) +class zes_vf_exp_properties_t(Structure): + _fields_ = [ + ("stype", zes_structure_type_t), ## [in] type of this structure + ("pNext", c_void_p), ## [in,out][optional] must be null or a pointer to an extension-specific + ## structure (i.e. contains stype and pNext). + ("address", zes_pci_address_t), ## [out] Virtual function BDF address + ("uuid", zes_uuid_t), ## [out] universal unique identifier of the device + ("flags", zes_vf_info_util_exp_flags_t) ## [out] utilization flags available. May be 0 or a valid combination of + ## ::zes_vf_info_util_exp_flag_t. + ] + +############################################################################### +## @brief Provides memory utilization values for a virtual function (deprecated) +class zes_vf_util_mem_exp_t(Structure): + _fields_ = [ + ("stype", zes_structure_type_t), ## [in] type of this structure + ("pNext", c_void_p), ## [in][optional] must be null or a pointer to an extension-specific + ## structure (i.e. contains stype and pNext). + ("memTypeFlags", zes_vf_info_mem_type_exp_flags_t), ## [out] Memory type flags. + ("free", c_ulonglong), ## [out] Free memory size in bytes. + ("size", c_ulonglong), ## [out] Total allocatable memory in bytes. + ("timestamp", c_ulonglong) ## [out] Wall clock time from VF when value was sampled. + ] + +############################################################################### +## @brief Provides engine utilization values for a virtual function (deprecated) +class zes_vf_util_engine_exp_t(Structure): + _fields_ = [ + ("stype", zes_structure_type_t), ## [in] type of this structure + ("pNext", c_void_p), ## [in][optional] must be null or a pointer to an extension-specific + ## structure (i.e. contains stype and pNext). + ("type", zes_engine_group_t), ## [out] The engine group. + ("activeCounterValue", c_ulonglong), ## [out] Represents active counter. + ("samplingCounterValue", c_ulonglong), ## [out] Represents counter value when activeCounterValue was sampled. + ("timestamp", c_ulonglong) ## [out] Wall clock time when the activeCounterValue was sampled. + ] + ############################################################################### ## @brief Virtual function management capabilities class zes_vf_exp_capabilities_t(Structure): @@ -2454,7 +2521,7 @@ class zes_vf_exp_capabilities_t(Structure): ############################################################################### ## @brief Provides memory utilization values for a virtual function -class zes_vf_util_mem_exp_t(Structure): +class zes_vf_util_mem_exp2_t(Structure): _fields_ = [ ("stype", zes_structure_type_t), ## [in] type of this structure ("pNext", c_void_p), ## [in][optional] must be null or a pointer to an extension-specific @@ -2471,7 +2538,7 @@ class zes_vf_util_mem_exp_t(Structure): ## using the equation: %util = (s2.activeCounterValue - ## s1.activeCounterValue) / (s2.samplingCounterValue - ## s1.samplingCounterValue) -class zes_vf_util_engine_exp_t(Structure): +class zes_vf_util_engine_exp2_t(Structure): _fields_ = [ ("stype", zes_structure_type_t), ## [in] type of this structure ("pNext", c_void_p), ## [in][optional] must be null or a pointer to an extension-specific @@ -2803,6 +2870,13 @@ class _zes_device_dditable_t(Structure): ("pfnResetExt", c_void_p) ## _zesDeviceResetExt_t ] +############################################################################### +## @brief Function-pointer for zesDeviceEnumEnabledVFExp +if __use_win_types: + _zesDeviceEnumEnabledVFExp_t = WINFUNCTYPE( ze_result_t, zes_device_handle_t, POINTER(c_ulong), POINTER(zes_vf_handle_t) ) +else: + _zesDeviceEnumEnabledVFExp_t = CFUNCTYPE( ze_result_t, zes_device_handle_t, POINTER(c_ulong), POINTER(zes_vf_handle_t) ) + ############################################################################### ## @brief Function-pointer for zesDeviceGetSubDevicePropertiesExp if __use_win_types: @@ -2811,19 +2885,20 @@ class _zes_device_dditable_t(Structure): _zesDeviceGetSubDevicePropertiesExp_t = CFUNCTYPE( ze_result_t, zes_device_handle_t, POINTER(c_ulong), POINTER(zes_subdevice_exp_properties_t) ) ############################################################################### -## @brief Function-pointer for zesDeviceEnumEnabledVFExp +## @brief Function-pointer for zesDeviceEnumActiveVFExp if __use_win_types: - _zesDeviceEnumEnabledVFExp_t = WINFUNCTYPE( ze_result_t, zes_device_handle_t, POINTER(c_ulong), POINTER(zes_vf_handle_t) ) + _zesDeviceEnumActiveVFExp_t = WINFUNCTYPE( ze_result_t, zes_device_handle_t, POINTER(c_ulong), POINTER(zes_vf_handle_t) ) else: - _zesDeviceEnumEnabledVFExp_t = CFUNCTYPE( ze_result_t, zes_device_handle_t, POINTER(c_ulong), POINTER(zes_vf_handle_t) ) + _zesDeviceEnumActiveVFExp_t = CFUNCTYPE( ze_result_t, zes_device_handle_t, POINTER(c_ulong), POINTER(zes_vf_handle_t) ) ############################################################################### ## @brief Table of DeviceExp functions pointers class _zes_device_exp_dditable_t(Structure): _fields_ = [ + ("pfnEnumEnabledVFExp", c_void_p), ## _zesDeviceEnumEnabledVFExp_t ("pfnGetSubDevicePropertiesExp", c_void_p), ## _zesDeviceGetSubDevicePropertiesExp_t - ("pfnEnumEnabledVFExp", c_void_p) ## _zesDeviceEnumEnabledVFExp_t + ("pfnEnumActiveVFExp", c_void_p) ## _zesDeviceEnumActiveVFExp_t ] ############################################################################### @@ -3758,6 +3833,29 @@ class _zes_diagnostics_dditable_t(Structure): ("pfnRunTests", c_void_p) ## _zesDiagnosticsRunTests_t ] +############################################################################### +## @brief Function-pointer for zesVFManagementGetVFMemoryUtilizationExp2 +if __use_win_types: + _zesVFManagementGetVFMemoryUtilizationExp2_t = WINFUNCTYPE( ze_result_t, zes_vf_handle_t, POINTER(c_ulong), POINTER(zes_vf_util_mem_exp2_t) ) +else: + _zesVFManagementGetVFMemoryUtilizationExp2_t = CFUNCTYPE( ze_result_t, zes_vf_handle_t, POINTER(c_ulong), POINTER(zes_vf_util_mem_exp2_t) ) + +############################################################################### +## @brief Function-pointer for zesVFManagementGetVFEngineUtilizationExp2 +if __use_win_types: + _zesVFManagementGetVFEngineUtilizationExp2_t = WINFUNCTYPE( ze_result_t, zes_vf_handle_t, POINTER(c_ulong), POINTER(zes_vf_util_engine_exp2_t) ) +else: + _zesVFManagementGetVFEngineUtilizationExp2_t = CFUNCTYPE( ze_result_t, zes_vf_handle_t, POINTER(c_ulong), POINTER(zes_vf_util_engine_exp2_t) ) + + +############################################################################### +## @brief Table of VFManagement functions pointers +class _zes_vf_management_dditable_t(Structure): + _fields_ = [ + ("pfnGetVFMemoryUtilizationExp2", c_void_p), ## _zesVFManagementGetVFMemoryUtilizationExp2_t + ("pfnGetVFEngineUtilizationExp2", c_void_p) ## _zesVFManagementGetVFEngineUtilizationExp2_t + ] + ############################################################################### ## @brief Function-pointer for zesVFManagementGetVFCapabilitiesExp if __use_win_types: @@ -3765,6 +3863,13 @@ class _zes_diagnostics_dditable_t(Structure): else: _zesVFManagementGetVFCapabilitiesExp_t = CFUNCTYPE( ze_result_t, zes_vf_handle_t, POINTER(zes_vf_exp_capabilities_t) ) +############################################################################### +## @brief Function-pointer for zesVFManagementGetVFPropertiesExp +if __use_win_types: + _zesVFManagementGetVFPropertiesExp_t = WINFUNCTYPE( ze_result_t, zes_vf_handle_t, POINTER(zes_vf_exp_properties_t) ) +else: + _zesVFManagementGetVFPropertiesExp_t = CFUNCTYPE( ze_result_t, zes_vf_handle_t, POINTER(zes_vf_exp_properties_t) ) + ############################################################################### ## @brief Function-pointer for zesVFManagementGetVFMemoryUtilizationExp if __use_win_types: @@ -3779,14 +3884,31 @@ class _zes_diagnostics_dditable_t(Structure): else: _zesVFManagementGetVFEngineUtilizationExp_t = CFUNCTYPE( ze_result_t, zes_vf_handle_t, POINTER(c_ulong), POINTER(zes_vf_util_engine_exp_t) ) +############################################################################### +## @brief Function-pointer for zesVFManagementSetVFTelemetryModeExp +if __use_win_types: + _zesVFManagementSetVFTelemetryModeExp_t = WINFUNCTYPE( ze_result_t, zes_vf_handle_t, zes_vf_info_util_exp_flags_t, ze_bool_t ) +else: + _zesVFManagementSetVFTelemetryModeExp_t = CFUNCTYPE( ze_result_t, zes_vf_handle_t, zes_vf_info_util_exp_flags_t, ze_bool_t ) + +############################################################################### +## @brief Function-pointer for zesVFManagementSetVFTelemetrySamplingIntervalExp +if __use_win_types: + _zesVFManagementSetVFTelemetrySamplingIntervalExp_t = WINFUNCTYPE( ze_result_t, zes_vf_handle_t, zes_vf_info_util_exp_flags_t, c_ulonglong ) +else: + _zesVFManagementSetVFTelemetrySamplingIntervalExp_t = CFUNCTYPE( ze_result_t, zes_vf_handle_t, zes_vf_info_util_exp_flags_t, c_ulonglong ) + ############################################################################### ## @brief Table of VFManagementExp functions pointers class _zes_vf_management_exp_dditable_t(Structure): _fields_ = [ ("pfnGetVFCapabilitiesExp", c_void_p), ## _zesVFManagementGetVFCapabilitiesExp_t + ("pfnGetVFPropertiesExp", c_void_p), ## _zesVFManagementGetVFPropertiesExp_t ("pfnGetVFMemoryUtilizationExp", c_void_p), ## _zesVFManagementGetVFMemoryUtilizationExp_t - ("pfnGetVFEngineUtilizationExp", c_void_p) ## _zesVFManagementGetVFEngineUtilizationExp_t + ("pfnGetVFEngineUtilizationExp", c_void_p), ## _zesVFManagementGetVFEngineUtilizationExp_t + ("pfnSetVFTelemetryModeExp", c_void_p), ## _zesVFManagementSetVFTelemetryModeExp_t + ("pfnSetVFTelemetrySamplingIntervalExp", c_void_p) ## _zesVFManagementSetVFTelemetrySamplingIntervalExp_t ] ############################################################################### @@ -3815,6 +3937,7 @@ class _zes_dditable_t(Structure): ("Ras", _zes_ras_dditable_t), ("RasExp", _zes_ras_exp_dditable_t), ("Diagnostics", _zes_diagnostics_dditable_t), + ("VFManagement", _zes_vf_management_dditable_t), ("VFManagementExp", _zes_vf_management_exp_dditable_t) ] @@ -3895,8 +4018,9 @@ def __init__(self, version : ze_api_version_t): self.__dditable.DeviceExp = _DeviceExp # attach function interface to function address - self.zesDeviceGetSubDevicePropertiesExp = _zesDeviceGetSubDevicePropertiesExp_t(self.__dditable.DeviceExp.pfnGetSubDevicePropertiesExp) self.zesDeviceEnumEnabledVFExp = _zesDeviceEnumEnabledVFExp_t(self.__dditable.DeviceExp.pfnEnumEnabledVFExp) + self.zesDeviceGetSubDevicePropertiesExp = _zesDeviceGetSubDevicePropertiesExp_t(self.__dditable.DeviceExp.pfnGetSubDevicePropertiesExp) + self.zesDeviceEnumActiveVFExp = _zesDeviceEnumActiveVFExp_t(self.__dditable.DeviceExp.pfnEnumActiveVFExp) # call driver to get function pointers _Driver = _zes_driver_dditable_t() @@ -4177,6 +4301,17 @@ def __init__(self, version : ze_api_version_t): self.zesDiagnosticsGetTests = _zesDiagnosticsGetTests_t(self.__dditable.Diagnostics.pfnGetTests) self.zesDiagnosticsRunTests = _zesDiagnosticsRunTests_t(self.__dditable.Diagnostics.pfnRunTests) + # call driver to get function pointers + _VFManagement = _zes_vf_management_dditable_t() + r = ze_result_v(self.__dll.zesGetVFManagementProcAddrTable(version, byref(_VFManagement))) + if r != ze_result_v.SUCCESS: + raise Exception(r) + self.__dditable.VFManagement = _VFManagement + + # attach function interface to function address + self.zesVFManagementGetVFMemoryUtilizationExp2 = _zesVFManagementGetVFMemoryUtilizationExp2_t(self.__dditable.VFManagement.pfnGetVFMemoryUtilizationExp2) + self.zesVFManagementGetVFEngineUtilizationExp2 = _zesVFManagementGetVFEngineUtilizationExp2_t(self.__dditable.VFManagement.pfnGetVFEngineUtilizationExp2) + # call driver to get function pointers _VFManagementExp = _zes_vf_management_exp_dditable_t() r = ze_result_v(self.__dll.zesGetVFManagementExpProcAddrTable(version, byref(_VFManagementExp))) @@ -4186,7 +4321,10 @@ def __init__(self, version : ze_api_version_t): # attach function interface to function address self.zesVFManagementGetVFCapabilitiesExp = _zesVFManagementGetVFCapabilitiesExp_t(self.__dditable.VFManagementExp.pfnGetVFCapabilitiesExp) + self.zesVFManagementGetVFPropertiesExp = _zesVFManagementGetVFPropertiesExp_t(self.__dditable.VFManagementExp.pfnGetVFPropertiesExp) self.zesVFManagementGetVFMemoryUtilizationExp = _zesVFManagementGetVFMemoryUtilizationExp_t(self.__dditable.VFManagementExp.pfnGetVFMemoryUtilizationExp) self.zesVFManagementGetVFEngineUtilizationExp = _zesVFManagementGetVFEngineUtilizationExp_t(self.__dditable.VFManagementExp.pfnGetVFEngineUtilizationExp) + self.zesVFManagementSetVFTelemetryModeExp = _zesVFManagementSetVFTelemetryModeExp_t(self.__dditable.VFManagementExp.pfnSetVFTelemetryModeExp) + self.zesVFManagementSetVFTelemetrySamplingIntervalExp = _zesVFManagementSetVFTelemetrySamplingIntervalExp_t(self.__dditable.VFManagementExp.pfnSetVFTelemetrySamplingIntervalExp) # success! diff --git a/include/zes_api.h b/include/zes_api.h index 2aa99085..ace96e5e 100644 --- a/include/zes_api.h +++ b/include/zes_api.h @@ -5,7 +5,7 @@ * SPDX-License-Identifier: MIT * * @file zes_api.h - * @version v1.10-r1.10.0 + * @version v1.11-r1.9.55 * */ #ifndef _ZES_API_H @@ -155,9 +155,12 @@ typedef enum _zes_structure_type_t ZES_STRUCTURE_TYPE_MEM_BANDWIDTH_COUNTER_BITS_EXP_PROPERTIES = 0x00020002, ///< ::zes_mem_bandwidth_counter_bits_exp_properties_t ZES_STRUCTURE_TYPE_MEMORY_PAGE_OFFLINE_STATE_EXP = 0x00020003, ///< ::zes_mem_page_offline_state_exp_t ZES_STRUCTURE_TYPE_SUBDEVICE_EXP_PROPERTIES = 0x00020004, ///< ::zes_subdevice_exp_properties_t - ZES_STRUCTURE_TYPE_VF_EXP_CAPABILITIES = 0x00020005, ///< ::zes_vf_exp_capabilities_t + ZES_STRUCTURE_TYPE_VF_EXP_PROPERTIES = 0x00020005, ///< ::zes_vf_exp_properties_t ZES_STRUCTURE_TYPE_VF_UTIL_MEM_EXP = 0x00020006, ///< ::zes_vf_util_mem_exp_t ZES_STRUCTURE_TYPE_VF_UTIL_ENGINE_EXP = 0x00020007, ///< ::zes_vf_util_engine_exp_t + ZES_STRUCTURE_TYPE_VF_EXP_CAPABILITIES = 0x00020008, ///< ::zes_vf_exp_capabilities_t + ZES_STRUCTURE_TYPE_VF_UTIL_MEM_EXP2 = 0x00020009, ///< ::zes_vf_util_mem_exp2_t + ZES_STRUCTURE_TYPE_VF_UTIL_ENGINE_EXP2 = 0x00020010, ///< ::zes_vf_util_engine_exp2_t ZES_STRUCTURE_TYPE_FORCE_UINT32 = 0x7fffffff } zes_structure_type_t; @@ -537,8 +540,8 @@ typedef struct _zes_power_domain_exp_properties_t zes_power_domain_exp_propertie typedef struct _zes_subdevice_exp_properties_t zes_subdevice_exp_properties_t; /////////////////////////////////////////////////////////////////////////////// -/// @brief Forward-declare zes_vf_exp_capabilities_t -typedef struct _zes_vf_exp_capabilities_t zes_vf_exp_capabilities_t; +/// @brief Forward-declare zes_vf_exp_properties_t +typedef struct _zes_vf_exp_properties_t zes_vf_exp_properties_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Forward-declare zes_vf_util_mem_exp_t @@ -548,6 +551,18 @@ typedef struct _zes_vf_util_mem_exp_t zes_vf_util_mem_exp_t; /// @brief Forward-declare zes_vf_util_engine_exp_t typedef struct _zes_vf_util_engine_exp_t zes_vf_util_engine_exp_t; +/////////////////////////////////////////////////////////////////////////////// +/// @brief Forward-declare zes_vf_exp_capabilities_t +typedef struct _zes_vf_exp_capabilities_t zes_vf_exp_capabilities_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Forward-declare zes_vf_util_mem_exp2_t +typedef struct _zes_vf_util_mem_exp2_t zes_vf_util_mem_exp2_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Forward-declare zes_vf_util_engine_exp2_t +typedef struct _zes_vf_util_engine_exp2_t zes_vf_util_engine_exp2_t; + #if !defined(__GNUC__) #pragma endregion @@ -7054,12 +7069,79 @@ zesDriverGetDeviceByUuidExp( typedef enum _zes_vf_management_exp_version_t { ZES_VF_MANAGEMENT_EXP_VERSION_1_0 = ZE_MAKE_VERSION( 1, 0 ), ///< version 1.0 (deprecated) - ZES_VF_MANAGEMENT_EXP_VERSION_1_1 = ZE_MAKE_VERSION( 1, 1 ), ///< version 1.1 - ZES_VF_MANAGEMENT_EXP_VERSION_CURRENT = ZE_MAKE_VERSION( 1, 1 ), ///< latest known version + ZES_VF_MANAGEMENT_EXP_VERSION_1_1 = ZE_MAKE_VERSION( 1, 1 ), ///< version 1.1 (deprecated) + ZES_VF_MANAGEMENT_EXP_VERSION_1_2 = ZE_MAKE_VERSION( 1, 2 ), ///< version 1.2 + ZES_VF_MANAGEMENT_EXP_VERSION_CURRENT = ZE_MAKE_VERSION( 1, 2 ), ///< latest known version ZES_VF_MANAGEMENT_EXP_VERSION_FORCE_UINT32 = 0x7fffffff } zes_vf_management_exp_version_t; +/////////////////////////////////////////////////////////////////////////////// +/// @brief Virtual function memory types (deprecated) +typedef uint32_t zes_vf_info_mem_type_exp_flags_t; +typedef enum _zes_vf_info_mem_type_exp_flag_t +{ + ZES_VF_INFO_MEM_TYPE_EXP_FLAG_MEM_TYPE_SYSTEM = ZE_BIT(0), ///< System memory + ZES_VF_INFO_MEM_TYPE_EXP_FLAG_MEM_TYPE_DEVICE = ZE_BIT(1), ///< Device local memory + ZES_VF_INFO_MEM_TYPE_EXP_FLAG_FORCE_UINT32 = 0x7fffffff + +} zes_vf_info_mem_type_exp_flag_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Virtual function utilization flag bit fields (deprecated) +typedef uint32_t zes_vf_info_util_exp_flags_t; +typedef enum _zes_vf_info_util_exp_flag_t +{ + ZES_VF_INFO_UTIL_EXP_FLAG_INFO_NONE = ZE_BIT(0), ///< No info associated with virtual function + ZES_VF_INFO_UTIL_EXP_FLAG_INFO_MEM_CPU = ZE_BIT(1), ///< System memory utilization associated with virtual function + ZES_VF_INFO_UTIL_EXP_FLAG_INFO_MEM_GPU = ZE_BIT(2), ///< Device memory utilization associated with virtual function + ZES_VF_INFO_UTIL_EXP_FLAG_INFO_ENGINE = ZE_BIT(3), ///< Engine utilization associated with virtual function + ZES_VF_INFO_UTIL_EXP_FLAG_FORCE_UINT32 = 0x7fffffff + +} zes_vf_info_util_exp_flag_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Virtual function management properties (deprecated) +typedef struct _zes_vf_exp_properties_t +{ + zes_structure_type_t stype; ///< [in] type of this structure + void* pNext; ///< [in,out][optional] must be null or a pointer to an extension-specific + ///< structure (i.e. contains stype and pNext). + zes_pci_address_t address; ///< [out] Virtual function BDF address + zes_uuid_t uuid; ///< [out] universal unique identifier of the device + zes_vf_info_util_exp_flags_t flags; ///< [out] utilization flags available. May be 0 or a valid combination of + ///< ::zes_vf_info_util_exp_flag_t. + +} zes_vf_exp_properties_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Provides memory utilization values for a virtual function (deprecated) +typedef struct _zes_vf_util_mem_exp_t +{ + zes_structure_type_t stype; ///< [in] type of this structure + const void* pNext; ///< [in][optional] must be null or a pointer to an extension-specific + ///< structure (i.e. contains stype and pNext). + zes_vf_info_mem_type_exp_flags_t memTypeFlags; ///< [out] Memory type flags. + uint64_t free; ///< [out] Free memory size in bytes. + uint64_t size; ///< [out] Total allocatable memory in bytes. + uint64_t timestamp; ///< [out] Wall clock time from VF when value was sampled. + +} zes_vf_util_mem_exp_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Provides engine utilization values for a virtual function (deprecated) +typedef struct _zes_vf_util_engine_exp_t +{ + zes_structure_type_t stype; ///< [in] type of this structure + const void* pNext; ///< [in][optional] must be null or a pointer to an extension-specific + ///< structure (i.e. contains stype and pNext). + zes_engine_group_t type; ///< [out] The engine group. + uint64_t activeCounterValue; ///< [out] Represents active counter. + uint64_t samplingCounterValue; ///< [out] Represents counter value when activeCounterValue was sampled. + uint64_t timestamp; ///< [out] Wall clock time when the activeCounterValue was sampled. + +} zes_vf_util_engine_exp_t; + /////////////////////////////////////////////////////////////////////////////// /// @brief Virtual function management capabilities typedef struct _zes_vf_exp_capabilities_t @@ -7075,7 +7157,7 @@ typedef struct _zes_vf_exp_capabilities_t /////////////////////////////////////////////////////////////////////////////// /// @brief Provides memory utilization values for a virtual function -typedef struct _zes_vf_util_mem_exp_t +typedef struct _zes_vf_util_mem_exp2_t { zes_structure_type_t stype; ///< [in] type of this structure const void* pNext; ///< [in][optional] must be null or a pointer to an extension-specific @@ -7083,7 +7165,7 @@ typedef struct _zes_vf_util_mem_exp_t zes_mem_loc_t vfMemLocation; ///< [out] Location of this memory (system, device) uint64_t vfMemUtilized; ///< [out] Free memory size in bytes. -} zes_vf_util_mem_exp_t; +} zes_vf_util_mem_exp2_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Provides engine utilization values for a virtual function @@ -7093,7 +7175,7 @@ typedef struct _zes_vf_util_mem_exp_t /// using the equation: %util = (s2.activeCounterValue - /// s1.activeCounterValue) / (s2.samplingCounterValue - /// s1.samplingCounterValue) -typedef struct _zes_vf_util_engine_exp_t +typedef struct _zes_vf_util_engine_exp2_t { zes_structure_type_t stype; ///< [in] type of this structure const void* pNext; ///< [in][optional] must be null or a pointer to an extension-specific @@ -7103,7 +7185,196 @@ typedef struct _zes_vf_util_engine_exp_t uint64_t samplingCounterValue; ///< [out] Represents counter value when activeCounterValue was sampled. ///< Refer to the formulae above for calculating the utilization percent -} zes_vf_util_engine_exp_t; +} zes_vf_util_engine_exp2_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Get handle of virtual function modules +/// +/// @details +/// - [DEPRECATED] No longer supported. Use ::zesDeviceEnumEnabledVFExp. +/// - The application may call this function from simultaneous threads. +/// - The implementation of this function should be lock-free. +/// +/// @returns +/// - ::ZE_RESULT_SUCCESS +/// - ::ZE_RESULT_ERROR_UNINITIALIZED +/// - ::ZE_RESULT_ERROR_DEVICE_LOST +/// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY +/// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY +/// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `nullptr == hDevice` +/// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER +/// + `nullptr == pCount` +ZE_APIEXPORT ze_result_t ZE_APICALL +zesDeviceEnumActiveVFExp( + zes_device_handle_t hDevice, ///< [in] Sysman handle of the device. + uint32_t* pCount, ///< [in,out] pointer to the number of components of this type. + ///< if count is zero, then the driver shall update the value with the + ///< total number of components of this type that are available. + ///< if count is greater than the number of components of this type that + ///< are available, then the driver shall update the value with the correct + ///< number of components. + zes_vf_handle_t* phVFhandle ///< [in,out][optional][range(0, *pCount)] array of handle of components of + ///< this type. + ///< if count is less than the number of components of this type that are + ///< available, then the driver shall only retrieve that number of + ///< component handles. + ); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Get virtual function management properties +/// +/// @details +/// - [DEPRECATED] No longer supported. Use +/// ::zesVFManagementGetVFCapabilitiesExp. +/// - The application may call this function from simultaneous threads. +/// - The implementation of this function should be lock-free. +/// +/// @returns +/// - ::ZE_RESULT_SUCCESS +/// - ::ZE_RESULT_ERROR_UNINITIALIZED +/// - ::ZE_RESULT_ERROR_DEVICE_LOST +/// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY +/// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY +/// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `nullptr == hVFhandle` +/// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER +/// + `nullptr == pProperties` +ZE_APIEXPORT ze_result_t ZE_APICALL +zesVFManagementGetVFPropertiesExp( + zes_vf_handle_t hVFhandle, ///< [in] Sysman handle for the VF component. + zes_vf_exp_properties_t* pProperties ///< [in,out] Will contain VF properties. + ); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Get memory activity stats for each available memory types associated +/// with Virtual Function (VF) +/// +/// @details +/// - [DEPRECATED] No longer supported. Use +/// ::zesVFManagementGetVFMemoryUtilizationExp2. +/// - The application may call this function from simultaneous threads. +/// - The implementation of this function should be lock-free. +/// +/// @returns +/// - ::ZE_RESULT_SUCCESS +/// - ::ZE_RESULT_ERROR_UNINITIALIZED +/// - ::ZE_RESULT_ERROR_DEVICE_LOST +/// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY +/// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY +/// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `nullptr == hVFhandle` +/// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER +/// + `nullptr == pCount` +ZE_APIEXPORT ze_result_t ZE_APICALL +zesVFManagementGetVFMemoryUtilizationExp( + zes_vf_handle_t hVFhandle, ///< [in] Sysman handle for the component. + uint32_t* pCount, ///< [in,out] Pointer to the number of VF memory stats descriptors. + ///< - if count is zero, the driver shall update the value with the total + ///< number of memory stats available. + ///< - if count is greater than the total number of memory stats + ///< available, the driver shall update the value with the correct number + ///< of memory stats available. + ///< - The count returned is the sum of number of VF instances currently + ///< available and the PF instance. + zes_vf_util_mem_exp_t* pMemUtil ///< [in,out][optional][range(0, *pCount)] array of memory group activity counters. + ///< - if count is less than the total number of memory stats available, + ///< then driver shall only retrieve that number of stats. + ///< - the implementation shall populate the vector pCount-1 number of VF + ///< memory stats. + ); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Get engine activity stats for each available engine group associated +/// with Virtual Function (VF) +/// +/// @details +/// - [DEPRECATED] No longer supported. Use +/// ::zesVFManagementGetVFEngineUtilizationExp2. +/// - The application may call this function from simultaneous threads. +/// - The implementation of this function should be lock-free. +/// +/// @returns +/// - ::ZE_RESULT_SUCCESS +/// - ::ZE_RESULT_ERROR_UNINITIALIZED +/// - ::ZE_RESULT_ERROR_DEVICE_LOST +/// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY +/// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY +/// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `nullptr == hVFhandle` +/// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER +/// + `nullptr == pCount` +ZE_APIEXPORT ze_result_t ZE_APICALL +zesVFManagementGetVFEngineUtilizationExp( + zes_vf_handle_t hVFhandle, ///< [in] Sysman handle for the component. + uint32_t* pCount, ///< [in,out] Pointer to the number of VF engine stats descriptors. + ///< - if count is zero, the driver shall update the value with the total + ///< number of engine stats available. + ///< - if count is greater than the total number of engine stats + ///< available, the driver shall update the value with the correct number + ///< of engine stats available. + ///< - The count returned is the sum of number of VF instances currently + ///< available and the PF instance. + zes_vf_util_engine_exp_t* pEngineUtil ///< [in,out][optional][range(0, *pCount)] array of engine group activity counters. + ///< - if count is less than the total number of engine stats available, + ///< then driver shall only retrieve that number of stats. + ///< - the implementation shall populate the vector pCount-1 number of VF + ///< engine stats. + ); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Configure utilization telemetry enabled or disabled associated with +/// Virtual Function (VF) +/// +/// @details +/// - [DEPRECATED] No longer supported. +/// - The application may call this function from simultaneous threads. +/// - The implementation of this function should be lock-free. +/// +/// @returns +/// - ::ZE_RESULT_SUCCESS +/// - ::ZE_RESULT_ERROR_UNINITIALIZED +/// - ::ZE_RESULT_ERROR_DEVICE_LOST +/// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY +/// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY +/// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `nullptr == hVFhandle` +/// - ::ZE_RESULT_ERROR_INVALID_ENUMERATION +/// + `0xf < flags` +ZE_APIEXPORT ze_result_t ZE_APICALL +zesVFManagementSetVFTelemetryModeExp( + zes_vf_handle_t hVFhandle, ///< [in] Sysman handle for the component. + zes_vf_info_util_exp_flags_t flags, ///< [in] utilization flags to enable or disable. May be 0 or a valid + ///< combination of ::zes_vf_info_util_exp_flag_t. + ze_bool_t enable ///< [in] Enable utilization telemetry. + ); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Set sampling interval to monitor for a particular utilization +/// telemetry associated with Virtual Function (VF) +/// +/// @details +/// - [DEPRECATED] No longer supported. +/// - The application may call this function from simultaneous threads. +/// - The implementation of this function should be lock-free. +/// +/// @returns +/// - ::ZE_RESULT_SUCCESS +/// - ::ZE_RESULT_ERROR_UNINITIALIZED +/// - ::ZE_RESULT_ERROR_DEVICE_LOST +/// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY +/// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY +/// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `nullptr == hVFhandle` +/// - ::ZE_RESULT_ERROR_INVALID_ENUMERATION +/// + `0xf < flag` +ZE_APIEXPORT ze_result_t ZE_APICALL +zesVFManagementSetVFTelemetrySamplingIntervalExp( + zes_vf_handle_t hVFhandle, ///< [in] Sysman handle for the component. + zes_vf_info_util_exp_flags_t flag, ///< [in] utilization flags to set sampling interval. May be 0 or a valid + ///< combination of ::zes_vf_info_util_exp_flag_t. + uint64_t samplingInterval ///< [in] Sampling interval value. + ); /////////////////////////////////////////////////////////////////////////////// /// @brief Get handle of virtual function modules @@ -7181,7 +7452,7 @@ zesVFManagementGetVFCapabilitiesExp( /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pCount` ZE_APIEXPORT ze_result_t ZE_APICALL -zesVFManagementGetVFMemoryUtilizationExp( +zesVFManagementGetVFMemoryUtilizationExp2( zes_vf_handle_t hVFhandle, ///< [in] Sysman handle for the component. uint32_t* pCount, ///< [in,out] Pointer to the number of VF memory stats descriptors. ///< - if count is zero, the driver shall update the value with the total @@ -7189,7 +7460,7 @@ zesVFManagementGetVFMemoryUtilizationExp( ///< - if count is greater than the total number of memory stats ///< available, the driver shall update the value with the correct number ///< of memory stats available. - zes_vf_util_mem_exp_t* pMemUtil ///< [in,out][optional][range(0, *pCount)] array of memory group activity counters. + zes_vf_util_mem_exp2_t* pMemUtil ///< [in,out][optional][range(0, *pCount)] array of memory group activity counters. ///< - if count is less than the total number of memory stats available, ///< then driver shall only retrieve that number of stats. ///< - the implementation shall populate the vector pCount-1 number of VF @@ -7216,7 +7487,7 @@ zesVFManagementGetVFMemoryUtilizationExp( /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pCount` ZE_APIEXPORT ze_result_t ZE_APICALL -zesVFManagementGetVFEngineUtilizationExp( +zesVFManagementGetVFEngineUtilizationExp2( zes_vf_handle_t hVFhandle, ///< [in] Sysman handle for the component. uint32_t* pCount, ///< [in,out] Pointer to the number of VF engine stats descriptors. ///< - if count is zero, the driver shall update the value with the total @@ -7224,7 +7495,7 @@ zesVFManagementGetVFEngineUtilizationExp( ///< - if count is greater than the total number of engine stats ///< available, the driver shall update the value with the correct number ///< of engine stats available. - zes_vf_util_engine_exp_t* pEngineUtil ///< [in,out][optional][range(0, *pCount)] array of engine group activity counters. + zes_vf_util_engine_exp2_t* pEngineUtil ///< [in,out][optional][range(0, *pCount)] array of engine group activity counters. ///< - if count is less than the total number of engine stats available, ///< then driver shall only retrieve that number of stats. ///< - the implementation shall populate the vector pCount-1 number of VF diff --git a/include/zes_ddi.h b/include/zes_ddi.h index f01e1927..7b6ef380 100644 --- a/include/zes_ddi.h +++ b/include/zes_ddi.h @@ -5,7 +5,7 @@ * SPDX-License-Identifier: MIT * * @file zes_ddi.h - * @version v1.10-r1.10.0 + * @version v1.11-r1.9.55 * */ #ifndef _ZES_DDI_H @@ -402,6 +402,14 @@ typedef ze_result_t (ZE_APICALL *zes_pfnGetDeviceProcAddrTable_t)( zes_device_dditable_t* ); +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for zesDeviceEnumEnabledVFExp +typedef ze_result_t (ZE_APICALL *zes_pfnDeviceEnumEnabledVFExp_t)( + zes_device_handle_t, + uint32_t*, + zes_vf_handle_t* + ); + /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zesDeviceGetSubDevicePropertiesExp typedef ze_result_t (ZE_APICALL *zes_pfnDeviceGetSubDevicePropertiesExp_t)( @@ -411,8 +419,8 @@ typedef ze_result_t (ZE_APICALL *zes_pfnDeviceGetSubDevicePropertiesExp_t)( ); /////////////////////////////////////////////////////////////////////////////// -/// @brief Function-pointer for zesDeviceEnumEnabledVFExp -typedef ze_result_t (ZE_APICALL *zes_pfnDeviceEnumEnabledVFExp_t)( +/// @brief Function-pointer for zesDeviceEnumActiveVFExp +typedef ze_result_t (ZE_APICALL *zes_pfnDeviceEnumActiveVFExp_t)( zes_device_handle_t, uint32_t*, zes_vf_handle_t* @@ -422,8 +430,9 @@ typedef ze_result_t (ZE_APICALL *zes_pfnDeviceEnumEnabledVFExp_t)( /// @brief Table of DeviceExp functions pointers typedef struct _zes_device_exp_dditable_t { - zes_pfnDeviceGetSubDevicePropertiesExp_t pfnGetSubDevicePropertiesExp; zes_pfnDeviceEnumEnabledVFExp_t pfnEnumEnabledVFExp; + zes_pfnDeviceGetSubDevicePropertiesExp_t pfnGetSubDevicePropertiesExp; + zes_pfnDeviceEnumActiveVFExp_t pfnEnumActiveVFExp; } zes_device_exp_dditable_t; /////////////////////////////////////////////////////////////////////////////// @@ -1847,6 +1856,52 @@ typedef ze_result_t (ZE_APICALL *zes_pfnGetDiagnosticsProcAddrTable_t)( zes_diagnostics_dditable_t* ); +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for zesVFManagementGetVFMemoryUtilizationExp2 +typedef ze_result_t (ZE_APICALL *zes_pfnVFManagementGetVFMemoryUtilizationExp2_t)( + zes_vf_handle_t, + uint32_t*, + zes_vf_util_mem_exp2_t* + ); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for zesVFManagementGetVFEngineUtilizationExp2 +typedef ze_result_t (ZE_APICALL *zes_pfnVFManagementGetVFEngineUtilizationExp2_t)( + zes_vf_handle_t, + uint32_t*, + zes_vf_util_engine_exp2_t* + ); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Table of VFManagement functions pointers +typedef struct _zes_vf_management_dditable_t +{ + zes_pfnVFManagementGetVFMemoryUtilizationExp2_t pfnGetVFMemoryUtilizationExp2; + zes_pfnVFManagementGetVFEngineUtilizationExp2_t pfnGetVFEngineUtilizationExp2; +} zes_vf_management_dditable_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Exported function for filling application's VFManagement table +/// with current process' addresses +/// +/// @returns +/// - ::ZE_RESULT_SUCCESS +/// - ::ZE_RESULT_ERROR_UNINITIALIZED +/// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER +/// - ::ZE_RESULT_ERROR_UNSUPPORTED_VERSION +ZE_DLLEXPORT ze_result_t ZE_APICALL +zesGetVFManagementProcAddrTable( + ze_api_version_t version, ///< [in] API version requested + zes_vf_management_dditable_t* pDdiTable ///< [in,out] pointer to table of DDI function pointers + ); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for zesGetVFManagementProcAddrTable +typedef ze_result_t (ZE_APICALL *zes_pfnGetVFManagementProcAddrTable_t)( + ze_api_version_t, + zes_vf_management_dditable_t* + ); + /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zesVFManagementGetVFCapabilitiesExp typedef ze_result_t (ZE_APICALL *zes_pfnVFManagementGetVFCapabilitiesExp_t)( @@ -1854,6 +1909,13 @@ typedef ze_result_t (ZE_APICALL *zes_pfnVFManagementGetVFCapabilitiesExp_t)( zes_vf_exp_capabilities_t* ); +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for zesVFManagementGetVFPropertiesExp +typedef ze_result_t (ZE_APICALL *zes_pfnVFManagementGetVFPropertiesExp_t)( + zes_vf_handle_t, + zes_vf_exp_properties_t* + ); + /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zesVFManagementGetVFMemoryUtilizationExp typedef ze_result_t (ZE_APICALL *zes_pfnVFManagementGetVFMemoryUtilizationExp_t)( @@ -1870,13 +1932,32 @@ typedef ze_result_t (ZE_APICALL *zes_pfnVFManagementGetVFEngineUtilizationExp_t) zes_vf_util_engine_exp_t* ); +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for zesVFManagementSetVFTelemetryModeExp +typedef ze_result_t (ZE_APICALL *zes_pfnVFManagementSetVFTelemetryModeExp_t)( + zes_vf_handle_t, + zes_vf_info_util_exp_flags_t, + ze_bool_t + ); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for zesVFManagementSetVFTelemetrySamplingIntervalExp +typedef ze_result_t (ZE_APICALL *zes_pfnVFManagementSetVFTelemetrySamplingIntervalExp_t)( + zes_vf_handle_t, + zes_vf_info_util_exp_flags_t, + uint64_t + ); + /////////////////////////////////////////////////////////////////////////////// /// @brief Table of VFManagementExp functions pointers typedef struct _zes_vf_management_exp_dditable_t { zes_pfnVFManagementGetVFCapabilitiesExp_t pfnGetVFCapabilitiesExp; + zes_pfnVFManagementGetVFPropertiesExp_t pfnGetVFPropertiesExp; zes_pfnVFManagementGetVFMemoryUtilizationExp_t pfnGetVFMemoryUtilizationExp; zes_pfnVFManagementGetVFEngineUtilizationExp_t pfnGetVFEngineUtilizationExp; + zes_pfnVFManagementSetVFTelemetryModeExp_t pfnSetVFTelemetryModeExp; + zes_pfnVFManagementSetVFTelemetrySamplingIntervalExp_t pfnSetVFTelemetrySamplingIntervalExp; } zes_vf_management_exp_dditable_t; /////////////////////////////////////////////////////////////////////////////// @@ -1928,6 +2009,7 @@ typedef struct _zes_dditable_t zes_ras_dditable_t Ras; zes_ras_exp_dditable_t RasExp; zes_diagnostics_dditable_t Diagnostics; + zes_vf_management_dditable_t VFManagement; zes_vf_management_exp_dditable_t VFManagementExp; } zes_dditable_t; diff --git a/include/zet.py b/include/zet.py index cfca32d0..c2f2ab8c 100644 --- a/include/zet.py +++ b/include/zet.py @@ -4,7 +4,7 @@ SPDX-License-Identifier: MIT @file zet.py - @version v1.10-r1.10.0 + @version v1.11-r1.9.55 """ import platform @@ -100,7 +100,9 @@ class zet_structure_type_v(IntEnum): METRIC_PROGRAMMABLE_EXP_PROPERTIES = 0x00010003 ## ::zet_metric_programmable_exp_properties_t METRIC_PROGRAMMABLE_PARAM_INFO_EXP = 0x00010004 ## ::zet_metric_programmable_param_info_exp_t METRIC_PROGRAMMABLE_PARAM_VALUE_INFO_EXP = 0x00010005 ## ::zet_metric_programmable_param_value_info_exp_t - METRIC_TRACER_EXP_DESC = 0x00010006 ## ::zet_metric_tracer_exp_desc_t + METRIC_GROUP_TYPE_EXP = 0x00010006 ## ::zet_metric_group_type_exp_t + EXPORT_DMA_EXP_PROPERTIES = 0x00010007 ## ::zet_export_dma_buf_exp_properties_t + METRIC_TRACER_EXP_DESC = 0x00010008 ## ::zet_metric_tracer_exp_desc_t class zet_structure_type_t(c_int): def __str__(self): @@ -421,6 +423,8 @@ class zet_metric_type_v(IntEnum): EVENT_EXP_TIMESTAMP = 10 ## Metric type: event with only timestamp and value has no meaning EVENT_EXP_START = 11 ## Metric type: the first event of a start/end event pair EVENT_EXP_END = 12 ## Metric type: the second event of a start/end event pair + EXPORT_DMA_BUF = 0x7ffffffd ## Metric which exports linux dma_buf, which could be imported/mapped to + ## the host process EVENT_EXP_MONOTONIC_WRAPS_VALUE = 0x7ffffffe ## Metric type: value of the event is a monotonically increasing value ## that can wrap around @@ -664,6 +668,45 @@ class zet_metric_entry_exp_t(Structure): ("subdeviceId", c_ulong) ## [out] If onSubdevice is true, this gives the ID of the sub-device. ] +############################################################################### +## @brief Metric group type +class zet_metric_group_type_exp_flags_v(IntEnum): + EXPORT_DMA_BUF = ZE_BIT(0) ## Metric group and metrics exports memory using linux dma-buf, which + ## could be imported/mapped to the host process. Properties of the + ## dma_buf could be queried using ::zet_export_dma_buf_exp_properties_t. + USER_CREATED = ZE_BIT(1) ## Metric group created using ::zetMetricGroupCreateExp + OTHER = ZE_BIT(2) ## Metric group which has a collection of metrics + +class zet_metric_group_type_exp_flags_t(c_int): + def __str__(self): + return hex(self.value) + + +############################################################################### +## @brief Query the metric group type using `pNext` of +## ::zet_metric_group_properties_t +class zet_metric_group_type_exp_t(Structure): + _fields_ = [ + ("stype", zet_structure_type_t), ## [in] type of this structure + ("pNext", c_void_p), ## [in,out][optional] must be null or a pointer to an extension-specific + ## structure (i.e. contains stype and pNext). + ("type", zet_metric_group_type_exp_flags_t) ## [out] metric group type. + ## returns a combination of ::zet_metric_group_type_exp_flags_t. + ] + +############################################################################### +## @brief Exported dma_buf properties queried using `pNext` of +## ::zet_metric_group_properties_t or ::zet_metric_properties_t +class zet_export_dma_buf_exp_properties_t(Structure): + _fields_ = [ + ("stype", zet_structure_type_t), ## [in] type of this structure + ("pNext", c_void_p), ## [in,out][optional] must be null or a pointer to an extension-specific + ## structure (i.e. contains stype and pNext). + ("fd", c_int), ## [out] the file descriptor handle that could be used to import the + ## memory by the host process. + ("size", c_size_t) ## [out] size in bytes of the dma_buf + ] + ############################################################################### ## @brief Calculating Multiple Metrics Experimental Extension Name ZET_MULTI_METRICS_EXP_NAME = "ZET_experimental_calculate_multiple_metrics" @@ -1177,21 +1220,29 @@ class _zet_kernel_dditable_t(Structure): else: _zetMetricGetProperties_t = CFUNCTYPE( ze_result_t, zet_metric_handle_t, POINTER(zet_metric_properties_t) ) +############################################################################### +## @brief Function-pointer for zetMetricCreateFromProgrammableExp2 +if __use_win_types: + _zetMetricCreateFromProgrammableExp2_t = WINFUNCTYPE( ze_result_t, zet_metric_programmable_exp_handle_t, c_ulong, POINTER(zet_metric_programmable_param_value_exp_t), c_char_p, c_char_p, POINTER(c_ulong), POINTER(zet_metric_handle_t) ) +else: + _zetMetricCreateFromProgrammableExp2_t = CFUNCTYPE( ze_result_t, zet_metric_programmable_exp_handle_t, c_ulong, POINTER(zet_metric_programmable_param_value_exp_t), c_char_p, c_char_p, POINTER(c_ulong), POINTER(zet_metric_handle_t) ) + ############################################################################### ## @brief Table of Metric functions pointers class _zet_metric_dditable_t(Structure): _fields_ = [ ("pfnGet", c_void_p), ## _zetMetricGet_t - ("pfnGetProperties", c_void_p) ## _zetMetricGetProperties_t + ("pfnGetProperties", c_void_p), ## _zetMetricGetProperties_t + ("pfnCreateFromProgrammableExp2", c_void_p) ## _zetMetricCreateFromProgrammableExp2_t ] ############################################################################### ## @brief Function-pointer for zetMetricCreateFromProgrammableExp if __use_win_types: - _zetMetricCreateFromProgrammableExp_t = WINFUNCTYPE( ze_result_t, zet_metric_programmable_exp_handle_t, c_ulong, POINTER(zet_metric_programmable_param_value_exp_t), c_char_p, c_char_p, POINTER(c_ulong), POINTER(zet_metric_handle_t) ) + _zetMetricCreateFromProgrammableExp_t = WINFUNCTYPE( ze_result_t, zet_metric_programmable_exp_handle_t, POINTER(zet_metric_programmable_param_value_exp_t), c_ulong, c_char_p, c_char_p, POINTER(c_ulong), POINTER(zet_metric_handle_t) ) else: - _zetMetricCreateFromProgrammableExp_t = CFUNCTYPE( ze_result_t, zet_metric_programmable_exp_handle_t, c_ulong, POINTER(zet_metric_programmable_param_value_exp_t), c_char_p, c_char_p, POINTER(c_ulong), POINTER(zet_metric_handle_t) ) + _zetMetricCreateFromProgrammableExp_t = CFUNCTYPE( ze_result_t, zet_metric_programmable_exp_handle_t, POINTER(zet_metric_programmable_param_value_exp_t), c_ulong, c_char_p, c_char_p, POINTER(c_ulong), POINTER(zet_metric_handle_t) ) ############################################################################### ## @brief Function-pointer for zetMetricDestroyExp @@ -1240,6 +1291,13 @@ class _zet_metric_group_dditable_t(Structure): ("pfnCalculateMetricValues", c_void_p) ## _zetMetricGroupCalculateMetricValues_t ] +############################################################################### +## @brief Function-pointer for zetMetricGroupCreateExp +if __use_win_types: + _zetMetricGroupCreateExp_t = WINFUNCTYPE( ze_result_t, zet_device_handle_t, c_char_p, c_char_p, zet_metric_group_sampling_type_flags_t, POINTER(zet_metric_group_handle_t) ) +else: + _zetMetricGroupCreateExp_t = CFUNCTYPE( ze_result_t, zet_device_handle_t, c_char_p, c_char_p, zet_metric_group_sampling_type_flags_t, POINTER(zet_metric_group_handle_t) ) + ############################################################################### ## @brief Function-pointer for zetMetricGroupCalculateMultipleMetricValuesExp if __use_win_types: @@ -1301,6 +1359,7 @@ class _zet_metric_group_dditable_t(Structure): ## @brief Table of MetricGroupExp functions pointers class _zet_metric_group_exp_dditable_t(Structure): _fields_ = [ + ("pfnCreateExp", c_void_p), ## _zetMetricGroupCreateExp_t ("pfnCalculateMultipleMetricValuesExp", c_void_p), ## _zetMetricGroupCalculateMultipleMetricValuesExp_t ("pfnGetGlobalTimestampsExp", c_void_p), ## _zetMetricGroupGetGlobalTimestampsExp_t ("pfnGetExportDataExp", c_void_p), ## _zetMetricGroupGetExportDataExp_t @@ -1704,6 +1763,7 @@ def __init__(self, version : ze_api_version_t): # attach function interface to function address self.zetMetricGet = _zetMetricGet_t(self.__dditable.Metric.pfnGet) self.zetMetricGetProperties = _zetMetricGetProperties_t(self.__dditable.Metric.pfnGetProperties) + self.zetMetricCreateFromProgrammableExp2 = _zetMetricCreateFromProgrammableExp2_t(self.__dditable.Metric.pfnCreateFromProgrammableExp2) # call driver to get function pointers _MetricExp = _zet_metric_exp_dditable_t() @@ -1736,6 +1796,7 @@ def __init__(self, version : ze_api_version_t): self.__dditable.MetricGroupExp = _MetricGroupExp # attach function interface to function address + self.zetMetricGroupCreateExp = _zetMetricGroupCreateExp_t(self.__dditable.MetricGroupExp.pfnCreateExp) self.zetMetricGroupCalculateMultipleMetricValuesExp = _zetMetricGroupCalculateMultipleMetricValuesExp_t(self.__dditable.MetricGroupExp.pfnCalculateMultipleMetricValuesExp) self.zetMetricGroupGetGlobalTimestampsExp = _zetMetricGroupGetGlobalTimestampsExp_t(self.__dditable.MetricGroupExp.pfnGetGlobalTimestampsExp) self.zetMetricGroupGetExportDataExp = _zetMetricGroupGetExportDataExp_t(self.__dditable.MetricGroupExp.pfnGetExportDataExp) diff --git a/include/zet_api.h b/include/zet_api.h index 9b2b3c95..b5b57e7f 100644 --- a/include/zet_api.h +++ b/include/zet_api.h @@ -5,7 +5,7 @@ * SPDX-License-Identifier: MIT * * @file zet_api.h - * @version v1.10-r1.10.0 + * @version v1.11-r1.9.55 * */ #ifndef _ZET_API_H @@ -99,7 +99,9 @@ typedef enum _zet_structure_type_t ZET_STRUCTURE_TYPE_METRIC_PROGRAMMABLE_EXP_PROPERTIES = 0x00010003, ///< ::zet_metric_programmable_exp_properties_t ZET_STRUCTURE_TYPE_METRIC_PROGRAMMABLE_PARAM_INFO_EXP = 0x00010004, ///< ::zet_metric_programmable_param_info_exp_t ZET_STRUCTURE_TYPE_METRIC_PROGRAMMABLE_PARAM_VALUE_INFO_EXP = 0x00010005, ///< ::zet_metric_programmable_param_value_info_exp_t - ZET_STRUCTURE_TYPE_METRIC_TRACER_EXP_DESC = 0x00010006, ///< ::zet_metric_tracer_exp_desc_t + ZET_STRUCTURE_TYPE_METRIC_GROUP_TYPE_EXP = 0x00010006, ///< ::zet_metric_group_type_exp_t + ZET_STRUCTURE_TYPE_EXPORT_DMA_EXP_PROPERTIES = 0x00010007, ///< ::zet_export_dma_buf_exp_properties_t + ZET_STRUCTURE_TYPE_METRIC_TRACER_EXP_DESC = 0x00010008, ///< ::zet_metric_tracer_exp_desc_t ZET_STRUCTURE_TYPE_FORCE_UINT32 = 0x7fffffff } zet_structure_type_t; @@ -259,6 +261,14 @@ typedef struct _zet_metric_tracer_exp_desc_t zet_metric_tracer_exp_desc_t; /// @brief Forward-declare zet_metric_entry_exp_t typedef struct _zet_metric_entry_exp_t zet_metric_entry_exp_t; +/////////////////////////////////////////////////////////////////////////////// +/// @brief Forward-declare zet_metric_group_type_exp_t +typedef struct _zet_metric_group_type_exp_t zet_metric_group_type_exp_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Forward-declare zet_export_dma_buf_exp_properties_t +typedef struct _zet_export_dma_buf_exp_properties_t zet_export_dma_buf_exp_properties_t; + /////////////////////////////////////////////////////////////////////////////// /// @brief Forward-declare zet_metric_global_timestamps_resolution_exp_t typedef struct _zet_metric_global_timestamps_resolution_exp_t zet_metric_global_timestamps_resolution_exp_t; @@ -1008,6 +1018,8 @@ typedef enum _zet_metric_type_t ZET_METRIC_TYPE_EVENT_EXP_TIMESTAMP = 10, ///< Metric type: event with only timestamp and value has no meaning ZET_METRIC_TYPE_EVENT_EXP_START = 11, ///< Metric type: the first event of a start/end event pair ZET_METRIC_TYPE_EVENT_EXP_END = 12, ///< Metric type: the second event of a start/end event pair + ZET_METRIC_TYPE_EXPORT_DMA_BUF = 0x7ffffffd, ///< Metric which exports linux dma_buf, which could be imported/mapped to + ///< the host process ZET_METRIC_TYPE_EVENT_EXP_MONOTONIC_WRAPS_VALUE = 0x7ffffffe, ///< Metric type: value of the event is a monotonically increasing value ///< that can wrap around ZET_METRIC_TYPE_FORCE_UINT32 = 0x7fffffff @@ -2264,6 +2276,54 @@ zetMetricTracerDecodeExp( ///< decoded metric entries ); +#if !defined(__GNUC__) +#pragma endregion +#endif +// Intel 'oneAPI' Level-Zero Tool Experimental Extension for Metrics/Metric Groups which export Memory +#if !defined(__GNUC__) +#pragma region metricExportMemory +#endif +/////////////////////////////////////////////////////////////////////////////// +/// @brief Metric group type +typedef uint32_t zet_metric_group_type_exp_flags_t; +typedef enum _zet_metric_group_type_exp_flag_t +{ + ZET_METRIC_GROUP_TYPE_EXP_FLAG_EXPORT_DMA_BUF = ZE_BIT(0), ///< Metric group and metrics exports memory using linux dma-buf, which + ///< could be imported/mapped to the host process. Properties of the + ///< dma_buf could be queried using ::zet_export_dma_buf_exp_properties_t. + ZET_METRIC_GROUP_TYPE_EXP_FLAG_USER_CREATED = ZE_BIT(1), ///< Metric group created using ::zetMetricGroupCreateExp + ZET_METRIC_GROUP_TYPE_EXP_FLAG_OTHER = ZE_BIT(2), ///< Metric group which has a collection of metrics + ZET_METRIC_GROUP_TYPE_EXP_FLAG_FORCE_UINT32 = 0x7fffffff + +} zet_metric_group_type_exp_flag_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Query the metric group type using `pNext` of +/// ::zet_metric_group_properties_t +typedef struct _zet_metric_group_type_exp_t +{ + zet_structure_type_t stype; ///< [in] type of this structure + void* pNext; ///< [in,out][optional] must be null or a pointer to an extension-specific + ///< structure (i.e. contains stype and pNext). + zet_metric_group_type_exp_flags_t type; ///< [out] metric group type. + ///< returns a combination of ::zet_metric_group_type_exp_flags_t. + +} zet_metric_group_type_exp_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Exported dma_buf properties queried using `pNext` of +/// ::zet_metric_group_properties_t or ::zet_metric_properties_t +typedef struct _zet_export_dma_buf_exp_properties_t +{ + zet_structure_type_t stype; ///< [in] type of this structure + void* pNext; ///< [in,out][optional] must be null or a pointer to an extension-specific + ///< structure (i.e. contains stype and pNext). + int fd; ///< [out] the file descriptor handle that could be used to import the + ///< memory by the host process. + size_t size; ///< [out] size in bytes of the dma_buf + +} zet_export_dma_buf_exp_properties_t; + #if !defined(__GNUC__) #pragma endregion #endif @@ -2893,7 +2953,7 @@ zetMetricProgrammableGetParamValueInfoExp( /// + `nullptr == pDescription` /// + `nullptr == pMetricHandleCount` ZE_APIEXPORT ze_result_t ZE_APICALL -zetMetricCreateFromProgrammableExp( +zetMetricCreateFromProgrammableExp2( zet_metric_programmable_exp_handle_t hMetricProgrammable, ///< [in] handle of the metric programmable uint32_t parameterCount, ///< [in] Count of parameters to set. zet_metric_programmable_param_value_exp_t* pParameterValues, ///< [in] list of parameter values to be set. @@ -2913,12 +2973,54 @@ zetMetricCreateFromProgrammableExp( ///< shall only retrieve that number of metric handles. ); +/////////////////////////////////////////////////////////////////////////////// +/// @brief Create metric handles by applying parameter values on the metric +/// programmable handle. +/// +/// @details +/// - This API is deprecated. Please use +/// ::zetMetricCreateFromProgrammableExp2() +/// +/// @returns +/// - ::ZE_RESULT_SUCCESS +/// - ::ZE_RESULT_ERROR_UNINITIALIZED +/// - ::ZE_RESULT_ERROR_DEVICE_LOST +/// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY +/// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY +/// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `nullptr == hMetricProgrammable` +/// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER +/// + `nullptr == pParameterValues` +/// + `nullptr == pName` +/// + `nullptr == pDescription` +/// + `nullptr == pMetricHandleCount` +ZE_APIEXPORT ze_result_t ZE_APICALL +zetMetricCreateFromProgrammableExp( + zet_metric_programmable_exp_handle_t hMetricProgrammable, ///< [in] handle of the metric programmable + zet_metric_programmable_param_value_exp_t* pParameterValues, ///< [in] list of parameter values to be set. + uint32_t parameterCount, ///< [in] Count of parameters to set. + const char* pName, ///< [in] pointer to metric name to be used. Must point to a + ///< null-terminated character array no longer than ::ZET_MAX_METRIC_NAME. + const char* pDescription, ///< [in] pointer to metric description to be used. Must point to a + ///< null-terminated character array no longer than + ///< ::ZET_MAX_METRIC_DESCRIPTION. + uint32_t* pMetricHandleCount, ///< [in,out] Pointer to the number of metric handles. + ///< if count is zero, then the driver shall update the value with the + ///< number of metric handles available for this programmable. + ///< if count is greater than the number of metric handles available, then + ///< the driver shall update the value with the correct number of metric + ///< handles available. + zet_metric_handle_t* phMetricHandles ///< [in,out][optional][range(0,*pMetricHandleCount)] array of handle of metrics. + ///< if count is less than the number of metrics available, then driver + ///< shall only retrieve that number of metric handles. + ); + /////////////////////////////////////////////////////////////////////////////// /// @brief Create multiple metric group handles from metric handles. /// /// @details /// - Creates multiple metric groups from metrics which were created using -/// ::zetMetricCreateFromProgrammableExp(). +/// ::zetMetricCreateFromProgrammableExp2(). /// - Metrics whose Hardware resources do not overlap are added to same /// metric group. /// - The metric groups created using this API are managed by the @@ -2960,6 +3062,39 @@ zetDeviceCreateMetricGroupsFromMetricsExp( ///< Created Metric group handles. ); +/////////////////////////////////////////////////////////////////////////////// +/// @brief Create metric group handle. +/// +/// @details +/// - This API is deprecated. Please use +/// ::zetCreateMetricGroupsFromMetricsExp() +/// +/// @returns +/// - ::ZE_RESULT_SUCCESS +/// - ::ZE_RESULT_ERROR_UNINITIALIZED +/// - ::ZE_RESULT_ERROR_DEVICE_LOST +/// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY +/// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY +/// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `nullptr == hDevice` +/// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER +/// + `nullptr == pName` +/// + `nullptr == pDescription` +/// + `nullptr == phMetricGroup` +/// - ::ZE_RESULT_ERROR_INVALID_ENUMERATION +/// + `0x7 < samplingType` +ZE_APIEXPORT ze_result_t ZE_APICALL +zetMetricGroupCreateExp( + zet_device_handle_t hDevice, ///< [in] handle of the device + const char* pName, ///< [in] pointer to metric group name. Must point to a null-terminated + ///< character array no longer than ::ZET_MAX_METRIC_GROUP_NAME. + const char* pDescription, ///< [in] pointer to metric group description. Must point to a + ///< null-terminated character array no longer than + ///< ::ZET_MAX_METRIC_GROUP_DESCRIPTION. + zet_metric_group_sampling_type_flags_t samplingType, ///< [in] Sampling type for the metric group. + zet_metric_group_handle_t* phMetricGroup ///< [in,out] Created Metric group handle + ); + /////////////////////////////////////////////////////////////////////////////// /// @brief Add a metric handle to the metric group handle created using /// ::zetMetricGroupCreateExp. @@ -3067,11 +3202,11 @@ zetMetricGroupCloseExp( /// @brief Destroy a metric group created using ::zetMetricGroupCreateExp. /// /// @details -/// - Metric handles created using ::zetMetricCreateFromProgrammableExp and +/// - Metric handles created using ::zetMetricCreateFromProgrammableExp2 and /// are part of the metricGroup are not destroyed. /// - It is necessary to call ::zetMetricDestroyExp for each of the metric -/// handles (created from ::zetMetricCreateFromProgrammableExp) to destroy -/// them. +/// handles (created from ::zetMetricCreateFromProgrammableExp2) to +/// destroy them. /// /// @returns /// - ::ZE_RESULT_SUCCESS @@ -3091,7 +3226,7 @@ zetMetricGroupDestroyExp( ); /////////////////////////////////////////////////////////////////////////////// -/// @brief Destroy a metric created using ::zetMetricCreateFromProgrammableExp. +/// @brief Destroy a metric created using ::zetMetricCreateFromProgrammableExp2. /// /// @details /// - If a metric is added to a metric group, the metric has to be removed diff --git a/include/zet_ddi.h b/include/zet_ddi.h index a5a78697..eed4e951 100644 --- a/include/zet_ddi.h +++ b/include/zet_ddi.h @@ -5,7 +5,7 @@ * SPDX-License-Identifier: MIT * * @file zet_ddi.h - * @version v1.10-r1.10.0 + * @version v1.11-r1.9.55 * */ #ifndef _ZET_DDI_H @@ -501,12 +501,25 @@ typedef ze_result_t (ZE_APICALL *zet_pfnMetricGetProperties_t)( zet_metric_properties_t* ); +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for zetMetricCreateFromProgrammableExp2 +typedef ze_result_t (ZE_APICALL *zet_pfnMetricCreateFromProgrammableExp2_t)( + zet_metric_programmable_exp_handle_t, + uint32_t, + zet_metric_programmable_param_value_exp_t*, + const char*, + const char*, + uint32_t*, + zet_metric_handle_t* + ); + /////////////////////////////////////////////////////////////////////////////// /// @brief Table of Metric functions pointers typedef struct _zet_metric_dditable_t { zet_pfnMetricGet_t pfnGet; zet_pfnMetricGetProperties_t pfnGetProperties; + zet_pfnMetricCreateFromProgrammableExp2_t pfnCreateFromProgrammableExp2; } zet_metric_dditable_t; /////////////////////////////////////////////////////////////////////////////// @@ -535,8 +548,8 @@ typedef ze_result_t (ZE_APICALL *zet_pfnGetMetricProcAddrTable_t)( /// @brief Function-pointer for zetMetricCreateFromProgrammableExp typedef ze_result_t (ZE_APICALL *zet_pfnMetricCreateFromProgrammableExp_t)( zet_metric_programmable_exp_handle_t, - uint32_t, zet_metric_programmable_param_value_exp_t*, + uint32_t, const char*, const char*, uint32_t*, @@ -636,6 +649,16 @@ typedef ze_result_t (ZE_APICALL *zet_pfnGetMetricGroupProcAddrTable_t)( zet_metric_group_dditable_t* ); +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for zetMetricGroupCreateExp +typedef ze_result_t (ZE_APICALL *zet_pfnMetricGroupCreateExp_t)( + zet_device_handle_t, + const char*, + const char*, + zet_metric_group_sampling_type_flags_t, + zet_metric_group_handle_t* + ); + /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zetMetricGroupCalculateMultipleMetricValuesExp typedef ze_result_t (ZE_APICALL *zet_pfnMetricGroupCalculateMultipleMetricValuesExp_t)( @@ -714,6 +737,7 @@ typedef ze_result_t (ZE_APICALL *zet_pfnMetricGroupDestroyExp_t)( /// @brief Table of MetricGroupExp functions pointers typedef struct _zet_metric_group_exp_dditable_t { + zet_pfnMetricGroupCreateExp_t pfnCreateExp; zet_pfnMetricGroupCalculateMultipleMetricValuesExp_t pfnCalculateMultipleMetricValuesExp; zet_pfnMetricGroupGetGlobalTimestampsExp_t pfnGetGlobalTimestampsExp; zet_pfnMetricGroupGetExportDataExp_t pfnGetExportDataExp; diff --git a/source/drivers/null/ze_nullddi.cpp b/source/drivers/null/ze_nullddi.cpp index 6e219367..8541b077 100644 --- a/source/drivers/null/ze_nullddi.cpp +++ b/source/drivers/null/ze_nullddi.cpp @@ -701,9 +701,9 @@ namespace driver zeDeviceGetGlobalTimestamps( ze_device_handle_t hDevice, ///< [in] handle of the device uint64_t* hostTimestamp, ///< [out] value of the Host's global timestamp that correlates with the - ///< Device's global timestamp value + ///< Device's global timestamp value. uint64_t* deviceTimestamp ///< [out] value of the Device's global timestamp that correlates with the - ///< Host's global timestamp value + ///< Host's global timestamp value. ) { ze_result_t result = ZE_RESULT_SUCCESS; @@ -3783,7 +3783,8 @@ namespace driver __zedlllocal ze_result_t ZE_APICALL zePhysicalMemCreate( ze_context_handle_t hContext, ///< [in] handle of the context object - ze_device_handle_t hDevice, ///< [in] handle of the device object + ze_device_handle_t hDevice, ///< [in] handle of the device object, can be `nullptr` if creating + ///< physical host memory. ze_physical_mem_desc_t* desc, ///< [in] pointer to physical memory descriptor. ze_physical_mem_handle_t* phPhysicalMemory ///< [out] pointer to handle of physical memory object created ) diff --git a/source/drivers/null/zes_nullddi.cpp b/source/drivers/null/zes_nullddi.cpp index 3717dd73..d1a27db1 100644 --- a/source/drivers/null/zes_nullddi.cpp +++ b/source/drivers/null/zes_nullddi.cpp @@ -3779,9 +3779,9 @@ namespace driver } /////////////////////////////////////////////////////////////////////////////// - /// @brief Intercept function for zesDeviceEnumEnabledVFExp + /// @brief Intercept function for zesDeviceEnumActiveVFExp __zedlllocal ze_result_t ZE_APICALL - zesDeviceEnumEnabledVFExp( + zesDeviceEnumActiveVFExp( zes_device_handle_t hDevice, ///< [in] Sysman handle of the device. uint32_t* pCount, ///< [in,out] pointer to the number of components of this type. ///< if count is zero, then the driver shall update the value with the @@ -3799,10 +3799,10 @@ namespace driver ze_result_t result = ZE_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path - auto pfnEnumEnabledVFExp = context.zesDdiTable.DeviceExp.pfnEnumEnabledVFExp; - if( nullptr != pfnEnumEnabledVFExp ) + auto pfnEnumActiveVFExp = context.zesDdiTable.DeviceExp.pfnEnumActiveVFExp; + if( nullptr != pfnEnumActiveVFExp ) { - result = pfnEnumEnabledVFExp( hDevice, pCount, phVFhandle ); + result = pfnEnumActiveVFExp( hDevice, pCount, phVFhandle ); } else { @@ -3816,20 +3816,20 @@ namespace driver } /////////////////////////////////////////////////////////////////////////////// - /// @brief Intercept function for zesVFManagementGetVFCapabilitiesExp + /// @brief Intercept function for zesVFManagementGetVFPropertiesExp __zedlllocal ze_result_t ZE_APICALL - zesVFManagementGetVFCapabilitiesExp( + zesVFManagementGetVFPropertiesExp( zes_vf_handle_t hVFhandle, ///< [in] Sysman handle for the VF component. - zes_vf_exp_capabilities_t* pCapability ///< [in,out] Will contain VF capability. + zes_vf_exp_properties_t* pProperties ///< [in,out] Will contain VF properties. ) { ze_result_t result = ZE_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path - auto pfnGetVFCapabilitiesExp = context.zesDdiTable.VFManagementExp.pfnGetVFCapabilitiesExp; - if( nullptr != pfnGetVFCapabilitiesExp ) + auto pfnGetVFPropertiesExp = context.zesDdiTable.VFManagementExp.pfnGetVFPropertiesExp; + if( nullptr != pfnGetVFPropertiesExp ) { - result = pfnGetVFCapabilitiesExp( hVFhandle, pCapability ); + result = pfnGetVFPropertiesExp( hVFhandle, pProperties ); } else { @@ -3850,6 +3850,8 @@ namespace driver ///< - if count is greater than the total number of memory stats ///< available, the driver shall update the value with the correct number ///< of memory stats available. + ///< - The count returned is the sum of number of VF instances currently + ///< available and the PF instance. zes_vf_util_mem_exp_t* pMemUtil ///< [in,out][optional][range(0, *pCount)] array of memory group activity counters. ///< - if count is less than the total number of memory stats available, ///< then driver shall only retrieve that number of stats. @@ -3884,6 +3886,8 @@ namespace driver ///< - if count is greater than the total number of engine stats ///< available, the driver shall update the value with the correct number ///< of engine stats available. + ///< - The count returned is the sum of number of VF instances currently + ///< available and the PF instance. zes_vf_util_engine_exp_t* pEngineUtil ///< [in,out][optional][range(0, *pCount)] array of engine group activity counters. ///< - if count is less than the total number of engine stats available, ///< then driver shall only retrieve that number of stats. @@ -3907,6 +3911,187 @@ namespace driver return result; } + /////////////////////////////////////////////////////////////////////////////// + /// @brief Intercept function for zesVFManagementSetVFTelemetryModeExp + __zedlllocal ze_result_t ZE_APICALL + zesVFManagementSetVFTelemetryModeExp( + zes_vf_handle_t hVFhandle, ///< [in] Sysman handle for the component. + zes_vf_info_util_exp_flags_t flags, ///< [in] utilization flags to enable or disable. May be 0 or a valid + ///< combination of ::zes_vf_info_util_exp_flag_t. + ze_bool_t enable ///< [in] Enable utilization telemetry. + ) + { + ze_result_t result = ZE_RESULT_SUCCESS; + + // if the driver has created a custom function, then call it instead of using the generic path + auto pfnSetVFTelemetryModeExp = context.zesDdiTable.VFManagementExp.pfnSetVFTelemetryModeExp; + if( nullptr != pfnSetVFTelemetryModeExp ) + { + result = pfnSetVFTelemetryModeExp( hVFhandle, flags, enable ); + } + else + { + // generic implementation + } + + return result; + } + + /////////////////////////////////////////////////////////////////////////////// + /// @brief Intercept function for zesVFManagementSetVFTelemetrySamplingIntervalExp + __zedlllocal ze_result_t ZE_APICALL + zesVFManagementSetVFTelemetrySamplingIntervalExp( + zes_vf_handle_t hVFhandle, ///< [in] Sysman handle for the component. + zes_vf_info_util_exp_flags_t flag, ///< [in] utilization flags to set sampling interval. May be 0 or a valid + ///< combination of ::zes_vf_info_util_exp_flag_t. + uint64_t samplingInterval ///< [in] Sampling interval value. + ) + { + ze_result_t result = ZE_RESULT_SUCCESS; + + // if the driver has created a custom function, then call it instead of using the generic path + auto pfnSetVFTelemetrySamplingIntervalExp = context.zesDdiTable.VFManagementExp.pfnSetVFTelemetrySamplingIntervalExp; + if( nullptr != pfnSetVFTelemetrySamplingIntervalExp ) + { + result = pfnSetVFTelemetrySamplingIntervalExp( hVFhandle, flag, samplingInterval ); + } + else + { + // generic implementation + } + + return result; + } + + /////////////////////////////////////////////////////////////////////////////// + /// @brief Intercept function for zesDeviceEnumEnabledVFExp + __zedlllocal ze_result_t ZE_APICALL + zesDeviceEnumEnabledVFExp( + zes_device_handle_t hDevice, ///< [in] Sysman handle of the device. + uint32_t* pCount, ///< [in,out] pointer to the number of components of this type. + ///< if count is zero, then the driver shall update the value with the + ///< total number of components of this type that are available. + ///< if count is greater than the number of components of this type that + ///< are available, then the driver shall update the value with the correct + ///< number of components. + zes_vf_handle_t* phVFhandle ///< [in,out][optional][range(0, *pCount)] array of handle of components of + ///< this type. + ///< if count is less than the number of components of this type that are + ///< available, then the driver shall only retrieve that number of + ///< component handles. + ) + { + ze_result_t result = ZE_RESULT_SUCCESS; + + // if the driver has created a custom function, then call it instead of using the generic path + auto pfnEnumEnabledVFExp = context.zesDdiTable.DeviceExp.pfnEnumEnabledVFExp; + if( nullptr != pfnEnumEnabledVFExp ) + { + result = pfnEnumEnabledVFExp( hDevice, pCount, phVFhandle ); + } + else + { + // generic implementation + for( size_t i = 0; ( nullptr != phVFhandle ) && ( i < *pCount ); ++i ) + phVFhandle[ i ] = reinterpret_cast( context.get() ); + + } + + return result; + } + + /////////////////////////////////////////////////////////////////////////////// + /// @brief Intercept function for zesVFManagementGetVFCapabilitiesExp + __zedlllocal ze_result_t ZE_APICALL + zesVFManagementGetVFCapabilitiesExp( + zes_vf_handle_t hVFhandle, ///< [in] Sysman handle for the VF component. + zes_vf_exp_capabilities_t* pCapability ///< [in,out] Will contain VF capability. + ) + { + ze_result_t result = ZE_RESULT_SUCCESS; + + // if the driver has created a custom function, then call it instead of using the generic path + auto pfnGetVFCapabilitiesExp = context.zesDdiTable.VFManagementExp.pfnGetVFCapabilitiesExp; + if( nullptr != pfnGetVFCapabilitiesExp ) + { + result = pfnGetVFCapabilitiesExp( hVFhandle, pCapability ); + } + else + { + // generic implementation + } + + return result; + } + + /////////////////////////////////////////////////////////////////////////////// + /// @brief Intercept function for zesVFManagementGetVFMemoryUtilizationExp2 + __zedlllocal ze_result_t ZE_APICALL + zesVFManagementGetVFMemoryUtilizationExp2( + zes_vf_handle_t hVFhandle, ///< [in] Sysman handle for the component. + uint32_t* pCount, ///< [in,out] Pointer to the number of VF memory stats descriptors. + ///< - if count is zero, the driver shall update the value with the total + ///< number of memory stats available. + ///< - if count is greater than the total number of memory stats + ///< available, the driver shall update the value with the correct number + ///< of memory stats available. + zes_vf_util_mem_exp2_t* pMemUtil ///< [in,out][optional][range(0, *pCount)] array of memory group activity counters. + ///< - if count is less than the total number of memory stats available, + ///< then driver shall only retrieve that number of stats. + ///< - the implementation shall populate the vector pCount-1 number of VF + ///< memory stats. + ) + { + ze_result_t result = ZE_RESULT_SUCCESS; + + // if the driver has created a custom function, then call it instead of using the generic path + auto pfnGetVFMemoryUtilizationExp2 = context.zesDdiTable.VFManagement.pfnGetVFMemoryUtilizationExp2; + if( nullptr != pfnGetVFMemoryUtilizationExp2 ) + { + result = pfnGetVFMemoryUtilizationExp2( hVFhandle, pCount, pMemUtil ); + } + else + { + // generic implementation + } + + return result; + } + + /////////////////////////////////////////////////////////////////////////////// + /// @brief Intercept function for zesVFManagementGetVFEngineUtilizationExp2 + __zedlllocal ze_result_t ZE_APICALL + zesVFManagementGetVFEngineUtilizationExp2( + zes_vf_handle_t hVFhandle, ///< [in] Sysman handle for the component. + uint32_t* pCount, ///< [in,out] Pointer to the number of VF engine stats descriptors. + ///< - if count is zero, the driver shall update the value with the total + ///< number of engine stats available. + ///< - if count is greater than the total number of engine stats + ///< available, the driver shall update the value with the correct number + ///< of engine stats available. + zes_vf_util_engine_exp2_t* pEngineUtil ///< [in,out][optional][range(0, *pCount)] array of engine group activity counters. + ///< - if count is less than the total number of engine stats available, + ///< then driver shall only retrieve that number of stats. + ///< - the implementation shall populate the vector pCount-1 number of VF + ///< engine stats. + ) + { + ze_result_t result = ZE_RESULT_SUCCESS; + + // if the driver has created a custom function, then call it instead of using the generic path + auto pfnGetVFEngineUtilizationExp2 = context.zesDdiTable.VFManagement.pfnGetVFEngineUtilizationExp2; + if( nullptr != pfnGetVFEngineUtilizationExp2 ) + { + result = pfnGetVFEngineUtilizationExp2( hVFhandle, pCount, pEngineUtil ); + } + else + { + // generic implementation + } + + return result; + } + } // namespace driver #if defined(__cplusplus) @@ -4061,9 +4246,11 @@ zesGetDeviceExpProcAddrTable( ze_result_t result = ZE_RESULT_SUCCESS; + pDdiTable->pfnEnumEnabledVFExp = driver::zesDeviceEnumEnabledVFExp; + pDdiTable->pfnGetSubDevicePropertiesExp = driver::zesDeviceGetSubDevicePropertiesExp; - pDdiTable->pfnEnumEnabledVFExp = driver::zesDeviceEnumEnabledVFExp; + pDdiTable->pfnEnumActiveVFExp = driver::zesDeviceEnumActiveVFExp; return result; } @@ -4766,6 +4953,35 @@ zesGetTemperatureProcAddrTable( return result; } +/////////////////////////////////////////////////////////////////////////////// +/// @brief Exported function for filling application's VFManagement table +/// with current process' addresses +/// +/// @returns +/// - ::ZE_RESULT_SUCCESS +/// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER +/// - ::ZE_RESULT_ERROR_UNSUPPORTED_VERSION +ZE_DLLEXPORT ze_result_t ZE_APICALL +zesGetVFManagementProcAddrTable( + ze_api_version_t version, ///< [in] API version requested + zes_vf_management_dditable_t* pDdiTable ///< [in,out] pointer to table of DDI function pointers + ) +{ + if( nullptr == pDdiTable ) + return ZE_RESULT_ERROR_INVALID_NULL_POINTER; + + if( driver::context.version < version ) + return ZE_RESULT_ERROR_UNSUPPORTED_VERSION; + + ze_result_t result = ZE_RESULT_SUCCESS; + + pDdiTable->pfnGetVFMemoryUtilizationExp2 = driver::zesVFManagementGetVFMemoryUtilizationExp2; + + pDdiTable->pfnGetVFEngineUtilizationExp2 = driver::zesVFManagementGetVFEngineUtilizationExp2; + + return result; +} + /////////////////////////////////////////////////////////////////////////////// /// @brief Exported function for filling application's VFManagementExp table /// with current process' addresses @@ -4790,10 +5006,16 @@ zesGetVFManagementExpProcAddrTable( pDdiTable->pfnGetVFCapabilitiesExp = driver::zesVFManagementGetVFCapabilitiesExp; + pDdiTable->pfnGetVFPropertiesExp = driver::zesVFManagementGetVFPropertiesExp; + pDdiTable->pfnGetVFMemoryUtilizationExp = driver::zesVFManagementGetVFMemoryUtilizationExp; pDdiTable->pfnGetVFEngineUtilizationExp = driver::zesVFManagementGetVFEngineUtilizationExp; + pDdiTable->pfnSetVFTelemetryModeExp = driver::zesVFManagementSetVFTelemetryModeExp; + + pDdiTable->pfnSetVFTelemetrySamplingIntervalExp = driver::zesVFManagementSetVFTelemetrySamplingIntervalExp; + return result; } diff --git a/source/drivers/null/zet_nullddi.cpp b/source/drivers/null/zet_nullddi.cpp index b85ecab9..f0769b41 100644 --- a/source/drivers/null/zet_nullddi.cpp +++ b/source/drivers/null/zet_nullddi.cpp @@ -1671,13 +1671,55 @@ namespace driver return result; } + /////////////////////////////////////////////////////////////////////////////// + /// @brief Intercept function for zetMetricCreateFromProgrammableExp2 + __zedlllocal ze_result_t ZE_APICALL + zetMetricCreateFromProgrammableExp2( + zet_metric_programmable_exp_handle_t hMetricProgrammable, ///< [in] handle of the metric programmable + uint32_t parameterCount, ///< [in] Count of parameters to set. + zet_metric_programmable_param_value_exp_t* pParameterValues,///< [in] list of parameter values to be set. + const char* pName, ///< [in] pointer to metric name to be used. Must point to a + ///< null-terminated character array no longer than ::ZET_MAX_METRIC_NAME. + const char* pDescription, ///< [in] pointer to metric description to be used. Must point to a + ///< null-terminated character array no longer than + ///< ::ZET_MAX_METRIC_DESCRIPTION. + uint32_t* pMetricHandleCount, ///< [in,out] Pointer to the number of metric handles. + ///< if count is zero, then the driver shall update the value with the + ///< number of metric handles available for this programmable. + ///< if count is greater than the number of metric handles available, then + ///< the driver shall update the value with the correct number of metric + ///< handles available. + zet_metric_handle_t* phMetricHandles ///< [in,out][optional][range(0,*pMetricHandleCount)] array of handle of metrics. + ///< if count is less than the number of metrics available, then driver + ///< shall only retrieve that number of metric handles. + ) + { + ze_result_t result = ZE_RESULT_SUCCESS; + + // if the driver has created a custom function, then call it instead of using the generic path + auto pfnCreateFromProgrammableExp2 = context.zetDdiTable.Metric.pfnCreateFromProgrammableExp2; + if( nullptr != pfnCreateFromProgrammableExp2 ) + { + result = pfnCreateFromProgrammableExp2( hMetricProgrammable, parameterCount, pParameterValues, pName, pDescription, pMetricHandleCount, phMetricHandles ); + } + else + { + // generic implementation + for( size_t i = 0; ( nullptr != phMetricHandles ) && ( i < *pMetricHandleCount ); ++i ) + phMetricHandles[ i ] = reinterpret_cast( context.get() ); + + } + + return result; + } + /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zetMetricCreateFromProgrammableExp __zedlllocal ze_result_t ZE_APICALL zetMetricCreateFromProgrammableExp( zet_metric_programmable_exp_handle_t hMetricProgrammable, ///< [in] handle of the metric programmable - uint32_t parameterCount, ///< [in] Count of parameters to set. zet_metric_programmable_param_value_exp_t* pParameterValues,///< [in] list of parameter values to be set. + uint32_t parameterCount, ///< [in] Count of parameters to set. const char* pName, ///< [in] pointer to metric name to be used. Must point to a ///< null-terminated character array no longer than ::ZET_MAX_METRIC_NAME. const char* pDescription, ///< [in] pointer to metric description to be used. Must point to a @@ -1700,7 +1742,7 @@ namespace driver auto pfnCreateFromProgrammableExp = context.zetDdiTable.MetricExp.pfnCreateFromProgrammableExp; if( nullptr != pfnCreateFromProgrammableExp ) { - result = pfnCreateFromProgrammableExp( hMetricProgrammable, parameterCount, pParameterValues, pName, pDescription, pMetricHandleCount, phMetricHandles ); + result = pfnCreateFromProgrammableExp( hMetricProgrammable, pParameterValues, parameterCount, pName, pDescription, pMetricHandleCount, phMetricHandles ); } else { @@ -1758,6 +1800,38 @@ namespace driver return result; } + /////////////////////////////////////////////////////////////////////////////// + /// @brief Intercept function for zetMetricGroupCreateExp + __zedlllocal ze_result_t ZE_APICALL + zetMetricGroupCreateExp( + zet_device_handle_t hDevice, ///< [in] handle of the device + const char* pName, ///< [in] pointer to metric group name. Must point to a null-terminated + ///< character array no longer than ::ZET_MAX_METRIC_GROUP_NAME. + const char* pDescription, ///< [in] pointer to metric group description. Must point to a + ///< null-terminated character array no longer than + ///< ::ZET_MAX_METRIC_GROUP_DESCRIPTION. + zet_metric_group_sampling_type_flags_t samplingType,///< [in] Sampling type for the metric group. + zet_metric_group_handle_t* phMetricGroup ///< [in,out] Created Metric group handle + ) + { + ze_result_t result = ZE_RESULT_SUCCESS; + + // if the driver has created a custom function, then call it instead of using the generic path + auto pfnCreateExp = context.zetDdiTable.MetricGroupExp.pfnCreateExp; + if( nullptr != pfnCreateExp ) + { + result = pfnCreateExp( hDevice, pName, pDescription, samplingType, phMetricGroup ); + } + else + { + // generic implementation + *phMetricGroup = reinterpret_cast( context.get() ); + + } + + return result; + } + /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zetMetricGroupAddMetricExp __zedlllocal ze_result_t ZE_APICALL @@ -2234,6 +2308,8 @@ zetGetMetricProcAddrTable( pDdiTable->pfnGetProperties = driver::zetMetricGetProperties; + pDdiTable->pfnCreateFromProgrammableExp2 = driver::zetMetricCreateFromProgrammableExp2; + return result; } @@ -2319,6 +2395,8 @@ zetGetMetricGroupExpProcAddrTable( ze_result_t result = ZE_RESULT_SUCCESS; + pDdiTable->pfnCreateExp = driver::zetMetricGroupCreateExp; + pDdiTable->pfnCalculateMultipleMetricValuesExp = driver::zetMetricGroupCalculateMultipleMetricValuesExp; pDdiTable->pfnGetGlobalTimestampsExp = driver::zetMetricGroupGetGlobalTimestampsExp; diff --git a/source/layers/tracing/ze_trcddi.cpp b/source/layers/tracing/ze_trcddi.cpp index f03b28f4..d721d32e 100644 --- a/source/layers/tracing/ze_trcddi.cpp +++ b/source/layers/tracing/ze_trcddi.cpp @@ -942,9 +942,9 @@ namespace tracing_layer zeDeviceGetGlobalTimestamps( ze_device_handle_t hDevice, ///< [in] handle of the device uint64_t* hostTimestamp, ///< [out] value of the Host's global timestamp that correlates with the - ///< Device's global timestamp value + ///< Device's global timestamp value. uint64_t* deviceTimestamp ///< [out] value of the Device's global timestamp that correlates with the - ///< Host's global timestamp value + ///< Host's global timestamp value. ) { auto pfnGetGlobalTimestamps = context.zeDdiTable.Device.pfnGetGlobalTimestamps; @@ -5539,7 +5539,8 @@ namespace tracing_layer __zedlllocal ze_result_t ZE_APICALL zePhysicalMemCreate( ze_context_handle_t hContext, ///< [in] handle of the context object - ze_device_handle_t hDevice, ///< [in] handle of the device object + ze_device_handle_t hDevice, ///< [in] handle of the device object, can be `nullptr` if creating + ///< physical host memory. ze_physical_mem_desc_t* desc, ///< [in] pointer to physical memory descriptor. ze_physical_mem_handle_t* phPhysicalMemory ///< [out] pointer to handle of physical memory object created ) diff --git a/source/layers/validation/checkers/parameter_validation/ze_parameter_validation.cpp b/source/layers/validation/checkers/parameter_validation/ze_parameter_validation.cpp index 14b1fb1c..a1e0003f 100644 --- a/source/layers/validation/checkers/parameter_validation/ze_parameter_validation.cpp +++ b/source/layers/validation/checkers/parameter_validation/ze_parameter_validation.cpp @@ -495,9 +495,9 @@ namespace validation_layer ZEParameterValidation::zeDeviceGetGlobalTimestampsPrologue( ze_device_handle_t hDevice, ///< [in] handle of the device uint64_t* hostTimestamp, ///< [out] value of the Host's global timestamp that correlates with the - ///< Device's global timestamp value + ///< Device's global timestamp value. uint64_t* deviceTimestamp ///< [out] value of the Device's global timestamp that correlates with the - ///< Host's global timestamp value + ///< Host's global timestamp value. ) { if( nullptr == hDevice ) @@ -2879,7 +2879,8 @@ namespace validation_layer ze_result_t ZEParameterValidation::zePhysicalMemCreatePrologue( ze_context_handle_t hContext, ///< [in] handle of the context object - ze_device_handle_t hDevice, ///< [in] handle of the device object + ze_device_handle_t hDevice, ///< [in] handle of the device object, can be `nullptr` if creating + ///< physical host memory. ze_physical_mem_desc_t* desc, ///< [in] pointer to physical memory descriptor. ze_physical_mem_handle_t* phPhysicalMemory ///< [out] pointer to handle of physical memory object created ) @@ -2896,7 +2897,7 @@ namespace validation_layer if( nullptr == phPhysicalMemory ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; - if( 0x1 < desc->flags ) + if( 0x3 < desc->flags ) return ZE_RESULT_ERROR_INVALID_ENUMERATION; if( 0 == desc->size ) diff --git a/source/layers/validation/checkers/parameter_validation/zes_parameter_validation.cpp b/source/layers/validation/checkers/parameter_validation/zes_parameter_validation.cpp index 2a870ac4..4f90e12c 100644 --- a/source/layers/validation/checkers/parameter_validation/zes_parameter_validation.cpp +++ b/source/layers/validation/checkers/parameter_validation/zes_parameter_validation.cpp @@ -2646,6 +2646,140 @@ namespace validation_layer } + ze_result_t + ZESParameterValidation::zesDeviceEnumActiveVFExpPrologue( + zes_device_handle_t hDevice, ///< [in] Sysman handle of the device. + uint32_t* pCount, ///< [in,out] pointer to the number of components of this type. + ///< if count is zero, then the driver shall update the value with the + ///< total number of components of this type that are available. + ///< if count is greater than the number of components of this type that + ///< are available, then the driver shall update the value with the correct + ///< number of components. + zes_vf_handle_t* phVFhandle ///< [in,out][optional][range(0, *pCount)] array of handle of components of + ///< this type. + ///< if count is less than the number of components of this type that are + ///< available, then the driver shall only retrieve that number of + ///< component handles. + ) + { + if( nullptr == hDevice ) + return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; + + if( nullptr == pCount ) + return ZE_RESULT_ERROR_INVALID_NULL_POINTER; + + return ZE_RESULT_SUCCESS; + } + + + ze_result_t + ZESParameterValidation::zesVFManagementGetVFPropertiesExpPrologue( + zes_vf_handle_t hVFhandle, ///< [in] Sysman handle for the VF component. + zes_vf_exp_properties_t* pProperties ///< [in,out] Will contain VF properties. + ) + { + if( nullptr == hVFhandle ) + return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; + + if( nullptr == pProperties ) + return ZE_RESULT_ERROR_INVALID_NULL_POINTER; + + return ParameterValidation::validateExtensions(pProperties); + } + + + ze_result_t + ZESParameterValidation::zesVFManagementGetVFMemoryUtilizationExpPrologue( + zes_vf_handle_t hVFhandle, ///< [in] Sysman handle for the component. + uint32_t* pCount, ///< [in,out] Pointer to the number of VF memory stats descriptors. + ///< - if count is zero, the driver shall update the value with the total + ///< number of memory stats available. + ///< - if count is greater than the total number of memory stats + ///< available, the driver shall update the value with the correct number + ///< of memory stats available. + ///< - The count returned is the sum of number of VF instances currently + ///< available and the PF instance. + zes_vf_util_mem_exp_t* pMemUtil ///< [in,out][optional][range(0, *pCount)] array of memory group activity counters. + ///< - if count is less than the total number of memory stats available, + ///< then driver shall only retrieve that number of stats. + ///< - the implementation shall populate the vector pCount-1 number of VF + ///< memory stats. + ) + { + if( nullptr == hVFhandle ) + return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; + + if( nullptr == pCount ) + return ZE_RESULT_ERROR_INVALID_NULL_POINTER; + + return ZE_RESULT_SUCCESS; + } + + + ze_result_t + ZESParameterValidation::zesVFManagementGetVFEngineUtilizationExpPrologue( + zes_vf_handle_t hVFhandle, ///< [in] Sysman handle for the component. + uint32_t* pCount, ///< [in,out] Pointer to the number of VF engine stats descriptors. + ///< - if count is zero, the driver shall update the value with the total + ///< number of engine stats available. + ///< - if count is greater than the total number of engine stats + ///< available, the driver shall update the value with the correct number + ///< of engine stats available. + ///< - The count returned is the sum of number of VF instances currently + ///< available and the PF instance. + zes_vf_util_engine_exp_t* pEngineUtil ///< [in,out][optional][range(0, *pCount)] array of engine group activity counters. + ///< - if count is less than the total number of engine stats available, + ///< then driver shall only retrieve that number of stats. + ///< - the implementation shall populate the vector pCount-1 number of VF + ///< engine stats. + ) + { + if( nullptr == hVFhandle ) + return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; + + if( nullptr == pCount ) + return ZE_RESULT_ERROR_INVALID_NULL_POINTER; + + return ZE_RESULT_SUCCESS; + } + + + ze_result_t + ZESParameterValidation::zesVFManagementSetVFTelemetryModeExpPrologue( + zes_vf_handle_t hVFhandle, ///< [in] Sysman handle for the component. + zes_vf_info_util_exp_flags_t flags, ///< [in] utilization flags to enable or disable. May be 0 or a valid + ///< combination of ::zes_vf_info_util_exp_flag_t. + ze_bool_t enable ///< [in] Enable utilization telemetry. + ) + { + if( nullptr == hVFhandle ) + return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; + + if( 0xf < flags ) + return ZE_RESULT_ERROR_INVALID_ENUMERATION; + + return ZE_RESULT_SUCCESS; + } + + + ze_result_t + ZESParameterValidation::zesVFManagementSetVFTelemetrySamplingIntervalExpPrologue( + zes_vf_handle_t hVFhandle, ///< [in] Sysman handle for the component. + zes_vf_info_util_exp_flags_t flag, ///< [in] utilization flags to set sampling interval. May be 0 or a valid + ///< combination of ::zes_vf_info_util_exp_flag_t. + uint64_t samplingInterval ///< [in] Sampling interval value. + ) + { + if( nullptr == hVFhandle ) + return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; + + if( 0xf < flag ) + return ZE_RESULT_ERROR_INVALID_ENUMERATION; + + return ZE_RESULT_SUCCESS; + } + + ze_result_t ZESParameterValidation::zesDeviceEnumEnabledVFExpPrologue( zes_device_handle_t hDevice, ///< [in] Sysman handle of the device. @@ -2689,7 +2823,7 @@ namespace validation_layer ze_result_t - ZESParameterValidation::zesVFManagementGetVFMemoryUtilizationExpPrologue( + ZESParameterValidation::zesVFManagementGetVFMemoryUtilizationExp2Prologue( zes_vf_handle_t hVFhandle, ///< [in] Sysman handle for the component. uint32_t* pCount, ///< [in,out] Pointer to the number of VF memory stats descriptors. ///< - if count is zero, the driver shall update the value with the total @@ -2697,7 +2831,7 @@ namespace validation_layer ///< - if count is greater than the total number of memory stats ///< available, the driver shall update the value with the correct number ///< of memory stats available. - zes_vf_util_mem_exp_t* pMemUtil ///< [in,out][optional][range(0, *pCount)] array of memory group activity counters. + zes_vf_util_mem_exp2_t* pMemUtil ///< [in,out][optional][range(0, *pCount)] array of memory group activity counters. ///< - if count is less than the total number of memory stats available, ///< then driver shall only retrieve that number of stats. ///< - the implementation shall populate the vector pCount-1 number of VF @@ -2715,7 +2849,7 @@ namespace validation_layer ze_result_t - ZESParameterValidation::zesVFManagementGetVFEngineUtilizationExpPrologue( + ZESParameterValidation::zesVFManagementGetVFEngineUtilizationExp2Prologue( zes_vf_handle_t hVFhandle, ///< [in] Sysman handle for the component. uint32_t* pCount, ///< [in,out] Pointer to the number of VF engine stats descriptors. ///< - if count is zero, the driver shall update the value with the total @@ -2723,7 +2857,7 @@ namespace validation_layer ///< - if count is greater than the total number of engine stats ///< available, the driver shall update the value with the correct number ///< of engine stats available. - zes_vf_util_engine_exp_t* pEngineUtil ///< [in,out][optional][range(0, *pCount)] array of engine group activity counters. + zes_vf_util_engine_exp2_t* pEngineUtil ///< [in,out][optional][range(0, *pCount)] array of engine group activity counters. ///< - if count is less than the total number of engine stats available, ///< then driver shall only retrieve that number of stats. ///< - the implementation shall populate the vector pCount-1 number of VF diff --git a/source/layers/validation/checkers/parameter_validation/zes_parameter_validation.h b/source/layers/validation/checkers/parameter_validation/zes_parameter_validation.h index 8eb666ff..88f72bbe 100644 --- a/source/layers/validation/checkers/parameter_validation/zes_parameter_validation.h +++ b/source/layers/validation/checkers/parameter_validation/zes_parameter_validation.h @@ -158,9 +158,15 @@ namespace validation_layer ze_result_t zesFirmwareSetSecurityVersionExpPrologue( zes_firmware_handle_t hFirmware ) override; ze_result_t zesDeviceGetSubDevicePropertiesExpPrologue( zes_device_handle_t hDevice, uint32_t* pCount, zes_subdevice_exp_properties_t* pSubdeviceProps ) override; ze_result_t zesDriverGetDeviceByUuidExpPrologue( zes_driver_handle_t hDriver, zes_uuid_t uuid, zes_device_handle_t* phDevice, ze_bool_t* onSubdevice, uint32_t* subdeviceId ) override; - ze_result_t zesDeviceEnumEnabledVFExpPrologue( zes_device_handle_t hDevice, uint32_t* pCount, zes_vf_handle_t* phVFhandle ) override; - ze_result_t zesVFManagementGetVFCapabilitiesExpPrologue( zes_vf_handle_t hVFhandle, zes_vf_exp_capabilities_t* pCapability ) override; + ze_result_t zesDeviceEnumActiveVFExpPrologue( zes_device_handle_t hDevice, uint32_t* pCount, zes_vf_handle_t* phVFhandle ) override; + ze_result_t zesVFManagementGetVFPropertiesExpPrologue( zes_vf_handle_t hVFhandle, zes_vf_exp_properties_t* pProperties ) override; ze_result_t zesVFManagementGetVFMemoryUtilizationExpPrologue( zes_vf_handle_t hVFhandle, uint32_t* pCount, zes_vf_util_mem_exp_t* pMemUtil ) override; ze_result_t zesVFManagementGetVFEngineUtilizationExpPrologue( zes_vf_handle_t hVFhandle, uint32_t* pCount, zes_vf_util_engine_exp_t* pEngineUtil ) override; + ze_result_t zesVFManagementSetVFTelemetryModeExpPrologue( zes_vf_handle_t hVFhandle, zes_vf_info_util_exp_flags_t flags, ze_bool_t enable ) override; + ze_result_t zesVFManagementSetVFTelemetrySamplingIntervalExpPrologue( zes_vf_handle_t hVFhandle, zes_vf_info_util_exp_flags_t flag, uint64_t samplingInterval ) override; + ze_result_t zesDeviceEnumEnabledVFExpPrologue( zes_device_handle_t hDevice, uint32_t* pCount, zes_vf_handle_t* phVFhandle ) override; + ze_result_t zesVFManagementGetVFCapabilitiesExpPrologue( zes_vf_handle_t hVFhandle, zes_vf_exp_capabilities_t* pCapability ) override; + ze_result_t zesVFManagementGetVFMemoryUtilizationExp2Prologue( zes_vf_handle_t hVFhandle, uint32_t* pCount, zes_vf_util_mem_exp2_t* pMemUtil ) override; + ze_result_t zesVFManagementGetVFEngineUtilizationExp2Prologue( zes_vf_handle_t hVFhandle, uint32_t* pCount, zes_vf_util_engine_exp2_t* pEngineUtil ) override; }; } \ No newline at end of file diff --git a/source/layers/validation/checkers/parameter_validation/zet_parameter_validation.cpp b/source/layers/validation/checkers/parameter_validation/zet_parameter_validation.cpp index 17ddfbcb..eb0d0fa1 100644 --- a/source/layers/validation/checkers/parameter_validation/zet_parameter_validation.cpp +++ b/source/layers/validation/checkers/parameter_validation/zet_parameter_validation.cpp @@ -1251,7 +1251,7 @@ namespace validation_layer ze_result_t - ZETParameterValidation::zetMetricCreateFromProgrammableExpPrologue( + ZETParameterValidation::zetMetricCreateFromProgrammableExp2Prologue( zet_metric_programmable_exp_handle_t hMetricProgrammable, ///< [in] handle of the metric programmable uint32_t parameterCount, ///< [in] Count of parameters to set. zet_metric_programmable_param_value_exp_t* pParameterValues,///< [in] list of parameter values to be set. @@ -1290,6 +1290,46 @@ namespace validation_layer } + ze_result_t + ZETParameterValidation::zetMetricCreateFromProgrammableExpPrologue( + zet_metric_programmable_exp_handle_t hMetricProgrammable, ///< [in] handle of the metric programmable + zet_metric_programmable_param_value_exp_t* pParameterValues,///< [in] list of parameter values to be set. + uint32_t parameterCount, ///< [in] Count of parameters to set. + const char* pName, ///< [in] pointer to metric name to be used. Must point to a + ///< null-terminated character array no longer than ::ZET_MAX_METRIC_NAME. + const char* pDescription, ///< [in] pointer to metric description to be used. Must point to a + ///< null-terminated character array no longer than + ///< ::ZET_MAX_METRIC_DESCRIPTION. + uint32_t* pMetricHandleCount, ///< [in,out] Pointer to the number of metric handles. + ///< if count is zero, then the driver shall update the value with the + ///< number of metric handles available for this programmable. + ///< if count is greater than the number of metric handles available, then + ///< the driver shall update the value with the correct number of metric + ///< handles available. + zet_metric_handle_t* phMetricHandles ///< [in,out][optional][range(0,*pMetricHandleCount)] array of handle of metrics. + ///< if count is less than the number of metrics available, then driver + ///< shall only retrieve that number of metric handles. + ) + { + if( nullptr == hMetricProgrammable ) + return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; + + if( nullptr == pParameterValues ) + return ZE_RESULT_ERROR_INVALID_NULL_POINTER; + + if( nullptr == pName ) + return ZE_RESULT_ERROR_INVALID_NULL_POINTER; + + if( nullptr == pDescription ) + return ZE_RESULT_ERROR_INVALID_NULL_POINTER; + + if( nullptr == pMetricHandleCount ) + return ZE_RESULT_ERROR_INVALID_NULL_POINTER; + + return ZE_RESULT_SUCCESS; + } + + ze_result_t ZETParameterValidation::zetDeviceCreateMetricGroupsFromMetricsExpPrologue( zet_device_handle_t hDevice, ///< [in] handle of the device. @@ -1324,6 +1364,37 @@ namespace validation_layer } + ze_result_t + ZETParameterValidation::zetMetricGroupCreateExpPrologue( + zet_device_handle_t hDevice, ///< [in] handle of the device + const char* pName, ///< [in] pointer to metric group name. Must point to a null-terminated + ///< character array no longer than ::ZET_MAX_METRIC_GROUP_NAME. + const char* pDescription, ///< [in] pointer to metric group description. Must point to a + ///< null-terminated character array no longer than + ///< ::ZET_MAX_METRIC_GROUP_DESCRIPTION. + zet_metric_group_sampling_type_flags_t samplingType,///< [in] Sampling type for the metric group. + zet_metric_group_handle_t* phMetricGroup ///< [in,out] Created Metric group handle + ) + { + if( nullptr == hDevice ) + return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; + + if( nullptr == pName ) + return ZE_RESULT_ERROR_INVALID_NULL_POINTER; + + if( nullptr == pDescription ) + return ZE_RESULT_ERROR_INVALID_NULL_POINTER; + + if( nullptr == phMetricGroup ) + return ZE_RESULT_ERROR_INVALID_NULL_POINTER; + + if( 0x7 < samplingType ) + return ZE_RESULT_ERROR_INVALID_ENUMERATION; + + return ZE_RESULT_SUCCESS; + } + + ze_result_t ZETParameterValidation::zetMetricGroupAddMetricExpPrologue( zet_metric_group_handle_t hMetricGroup, ///< [in] Handle of the metric group diff --git a/source/layers/validation/checkers/parameter_validation/zet_parameter_validation.h b/source/layers/validation/checkers/parameter_validation/zet_parameter_validation.h index 08cd0ea6..4a2d24bc 100644 --- a/source/layers/validation/checkers/parameter_validation/zet_parameter_validation.h +++ b/source/layers/validation/checkers/parameter_validation/zet_parameter_validation.h @@ -77,8 +77,10 @@ namespace validation_layer ze_result_t zetMetricProgrammableGetPropertiesExpPrologue( zet_metric_programmable_exp_handle_t hMetricProgrammable, zet_metric_programmable_exp_properties_t* pProperties ) override; ze_result_t zetMetricProgrammableGetParamInfoExpPrologue( zet_metric_programmable_exp_handle_t hMetricProgrammable, uint32_t* pParameterCount, zet_metric_programmable_param_info_exp_t* pParameterInfo ) override; ze_result_t zetMetricProgrammableGetParamValueInfoExpPrologue( zet_metric_programmable_exp_handle_t hMetricProgrammable, uint32_t parameterOrdinal, uint32_t* pValueInfoCount, zet_metric_programmable_param_value_info_exp_t* pValueInfo ) override; - ze_result_t zetMetricCreateFromProgrammableExpPrologue( zet_metric_programmable_exp_handle_t hMetricProgrammable, uint32_t parameterCount, zet_metric_programmable_param_value_exp_t* pParameterValues, const char* pName, const char* pDescription, uint32_t* pMetricHandleCount, zet_metric_handle_t* phMetricHandles ) override; + ze_result_t zetMetricCreateFromProgrammableExp2Prologue( zet_metric_programmable_exp_handle_t hMetricProgrammable, uint32_t parameterCount, zet_metric_programmable_param_value_exp_t* pParameterValues, const char* pName, const char* pDescription, uint32_t* pMetricHandleCount, zet_metric_handle_t* phMetricHandles ) override; + ze_result_t zetMetricCreateFromProgrammableExpPrologue( zet_metric_programmable_exp_handle_t hMetricProgrammable, zet_metric_programmable_param_value_exp_t* pParameterValues, uint32_t parameterCount, const char* pName, const char* pDescription, uint32_t* pMetricHandleCount, zet_metric_handle_t* phMetricHandles ) override; ze_result_t zetDeviceCreateMetricGroupsFromMetricsExpPrologue( zet_device_handle_t hDevice, uint32_t metricCount, zet_metric_handle_t * phMetrics, const char * pMetricGroupNamePrefix, const char * pDescription, uint32_t * pMetricGroupCount, zet_metric_group_handle_t* phMetricGroup ) override; + ze_result_t zetMetricGroupCreateExpPrologue( zet_device_handle_t hDevice, const char* pName, const char* pDescription, zet_metric_group_sampling_type_flags_t samplingType, zet_metric_group_handle_t* phMetricGroup ) override; ze_result_t zetMetricGroupAddMetricExpPrologue( zet_metric_group_handle_t hMetricGroup, zet_metric_handle_t hMetric, size_t * pErrorStringSize, char* pErrorString ) override; ze_result_t zetMetricGroupRemoveMetricExpPrologue( zet_metric_group_handle_t hMetricGroup, zet_metric_handle_t hMetric ) override; ze_result_t zetMetricGroupCloseExpPrologue( zet_metric_group_handle_t hMetricGroup ) override; diff --git a/source/layers/validation/common/zes_entry_points.h b/source/layers/validation/common/zes_entry_points.h index e0a73b03..44815635 100644 --- a/source/layers/validation/common/zes_entry_points.h +++ b/source/layers/validation/common/zes_entry_points.h @@ -293,14 +293,26 @@ class ZESValidationEntryPoints { virtual ze_result_t zesDeviceGetSubDevicePropertiesExpEpilogue( zes_device_handle_t hDevice, uint32_t* pCount, zes_subdevice_exp_properties_t* pSubdeviceProps ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zesDriverGetDeviceByUuidExpPrologue( zes_driver_handle_t hDriver, zes_uuid_t uuid, zes_device_handle_t* phDevice, ze_bool_t* onSubdevice, uint32_t* subdeviceId ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zesDriverGetDeviceByUuidExpEpilogue( zes_driver_handle_t hDriver, zes_uuid_t uuid, zes_device_handle_t* phDevice, ze_bool_t* onSubdevice, uint32_t* subdeviceId ) {return ZE_RESULT_SUCCESS;} - virtual ze_result_t zesDeviceEnumEnabledVFExpPrologue( zes_device_handle_t hDevice, uint32_t* pCount, zes_vf_handle_t* phVFhandle ) {return ZE_RESULT_SUCCESS;} - virtual ze_result_t zesDeviceEnumEnabledVFExpEpilogue( zes_device_handle_t hDevice, uint32_t* pCount, zes_vf_handle_t* phVFhandle ) {return ZE_RESULT_SUCCESS;} - virtual ze_result_t zesVFManagementGetVFCapabilitiesExpPrologue( zes_vf_handle_t hVFhandle, zes_vf_exp_capabilities_t* pCapability ) {return ZE_RESULT_SUCCESS;} - virtual ze_result_t zesVFManagementGetVFCapabilitiesExpEpilogue( zes_vf_handle_t hVFhandle, zes_vf_exp_capabilities_t* pCapability ) {return ZE_RESULT_SUCCESS;} + virtual ze_result_t zesDeviceEnumActiveVFExpPrologue( zes_device_handle_t hDevice, uint32_t* pCount, zes_vf_handle_t* phVFhandle ) {return ZE_RESULT_SUCCESS;} + virtual ze_result_t zesDeviceEnumActiveVFExpEpilogue( zes_device_handle_t hDevice, uint32_t* pCount, zes_vf_handle_t* phVFhandle ) {return ZE_RESULT_SUCCESS;} + virtual ze_result_t zesVFManagementGetVFPropertiesExpPrologue( zes_vf_handle_t hVFhandle, zes_vf_exp_properties_t* pProperties ) {return ZE_RESULT_SUCCESS;} + virtual ze_result_t zesVFManagementGetVFPropertiesExpEpilogue( zes_vf_handle_t hVFhandle, zes_vf_exp_properties_t* pProperties ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zesVFManagementGetVFMemoryUtilizationExpPrologue( zes_vf_handle_t hVFhandle, uint32_t* pCount, zes_vf_util_mem_exp_t* pMemUtil ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zesVFManagementGetVFMemoryUtilizationExpEpilogue( zes_vf_handle_t hVFhandle, uint32_t* pCount, zes_vf_util_mem_exp_t* pMemUtil ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zesVFManagementGetVFEngineUtilizationExpPrologue( zes_vf_handle_t hVFhandle, uint32_t* pCount, zes_vf_util_engine_exp_t* pEngineUtil ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zesVFManagementGetVFEngineUtilizationExpEpilogue( zes_vf_handle_t hVFhandle, uint32_t* pCount, zes_vf_util_engine_exp_t* pEngineUtil ) {return ZE_RESULT_SUCCESS;} + virtual ze_result_t zesVFManagementSetVFTelemetryModeExpPrologue( zes_vf_handle_t hVFhandle, zes_vf_info_util_exp_flags_t flags, ze_bool_t enable ) {return ZE_RESULT_SUCCESS;} + virtual ze_result_t zesVFManagementSetVFTelemetryModeExpEpilogue( zes_vf_handle_t hVFhandle, zes_vf_info_util_exp_flags_t flags, ze_bool_t enable ) {return ZE_RESULT_SUCCESS;} + virtual ze_result_t zesVFManagementSetVFTelemetrySamplingIntervalExpPrologue( zes_vf_handle_t hVFhandle, zes_vf_info_util_exp_flags_t flag, uint64_t samplingInterval ) {return ZE_RESULT_SUCCESS;} + virtual ze_result_t zesVFManagementSetVFTelemetrySamplingIntervalExpEpilogue( zes_vf_handle_t hVFhandle, zes_vf_info_util_exp_flags_t flag, uint64_t samplingInterval ) {return ZE_RESULT_SUCCESS;} + virtual ze_result_t zesDeviceEnumEnabledVFExpPrologue( zes_device_handle_t hDevice, uint32_t* pCount, zes_vf_handle_t* phVFhandle ) {return ZE_RESULT_SUCCESS;} + virtual ze_result_t zesDeviceEnumEnabledVFExpEpilogue( zes_device_handle_t hDevice, uint32_t* pCount, zes_vf_handle_t* phVFhandle ) {return ZE_RESULT_SUCCESS;} + virtual ze_result_t zesVFManagementGetVFCapabilitiesExpPrologue( zes_vf_handle_t hVFhandle, zes_vf_exp_capabilities_t* pCapability ) {return ZE_RESULT_SUCCESS;} + virtual ze_result_t zesVFManagementGetVFCapabilitiesExpEpilogue( zes_vf_handle_t hVFhandle, zes_vf_exp_capabilities_t* pCapability ) {return ZE_RESULT_SUCCESS;} + virtual ze_result_t zesVFManagementGetVFMemoryUtilizationExp2Prologue( zes_vf_handle_t hVFhandle, uint32_t* pCount, zes_vf_util_mem_exp2_t* pMemUtil ) {return ZE_RESULT_SUCCESS;} + virtual ze_result_t zesVFManagementGetVFMemoryUtilizationExp2Epilogue( zes_vf_handle_t hVFhandle, uint32_t* pCount, zes_vf_util_mem_exp2_t* pMemUtil ) {return ZE_RESULT_SUCCESS;} + virtual ze_result_t zesVFManagementGetVFEngineUtilizationExp2Prologue( zes_vf_handle_t hVFhandle, uint32_t* pCount, zes_vf_util_engine_exp2_t* pEngineUtil ) {return ZE_RESULT_SUCCESS;} + virtual ze_result_t zesVFManagementGetVFEngineUtilizationExp2Epilogue( zes_vf_handle_t hVFhandle, uint32_t* pCount, zes_vf_util_engine_exp2_t* pEngineUtil ) {return ZE_RESULT_SUCCESS;} virtual ~ZESValidationEntryPoints() {} }; } \ No newline at end of file diff --git a/source/layers/validation/common/zet_entry_points.h b/source/layers/validation/common/zet_entry_points.h index 30f51ee5..ec5d5a40 100644 --- a/source/layers/validation/common/zet_entry_points.h +++ b/source/layers/validation/common/zet_entry_points.h @@ -131,10 +131,14 @@ class ZETValidationEntryPoints { virtual ze_result_t zetMetricProgrammableGetParamInfoExpEpilogue( zet_metric_programmable_exp_handle_t hMetricProgrammable, uint32_t* pParameterCount, zet_metric_programmable_param_info_exp_t* pParameterInfo ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zetMetricProgrammableGetParamValueInfoExpPrologue( zet_metric_programmable_exp_handle_t hMetricProgrammable, uint32_t parameterOrdinal, uint32_t* pValueInfoCount, zet_metric_programmable_param_value_info_exp_t* pValueInfo ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zetMetricProgrammableGetParamValueInfoExpEpilogue( zet_metric_programmable_exp_handle_t hMetricProgrammable, uint32_t parameterOrdinal, uint32_t* pValueInfoCount, zet_metric_programmable_param_value_info_exp_t* pValueInfo ) {return ZE_RESULT_SUCCESS;} - virtual ze_result_t zetMetricCreateFromProgrammableExpPrologue( zet_metric_programmable_exp_handle_t hMetricProgrammable, uint32_t parameterCount, zet_metric_programmable_param_value_exp_t* pParameterValues, const char* pName, const char* pDescription, uint32_t* pMetricHandleCount, zet_metric_handle_t* phMetricHandles ) {return ZE_RESULT_SUCCESS;} - virtual ze_result_t zetMetricCreateFromProgrammableExpEpilogue( zet_metric_programmable_exp_handle_t hMetricProgrammable, uint32_t parameterCount, zet_metric_programmable_param_value_exp_t* pParameterValues, const char* pName, const char* pDescription, uint32_t* pMetricHandleCount, zet_metric_handle_t* phMetricHandles ) {return ZE_RESULT_SUCCESS;} + virtual ze_result_t zetMetricCreateFromProgrammableExp2Prologue( zet_metric_programmable_exp_handle_t hMetricProgrammable, uint32_t parameterCount, zet_metric_programmable_param_value_exp_t* pParameterValues, const char* pName, const char* pDescription, uint32_t* pMetricHandleCount, zet_metric_handle_t* phMetricHandles ) {return ZE_RESULT_SUCCESS;} + virtual ze_result_t zetMetricCreateFromProgrammableExp2Epilogue( zet_metric_programmable_exp_handle_t hMetricProgrammable, uint32_t parameterCount, zet_metric_programmable_param_value_exp_t* pParameterValues, const char* pName, const char* pDescription, uint32_t* pMetricHandleCount, zet_metric_handle_t* phMetricHandles ) {return ZE_RESULT_SUCCESS;} + virtual ze_result_t zetMetricCreateFromProgrammableExpPrologue( zet_metric_programmable_exp_handle_t hMetricProgrammable, zet_metric_programmable_param_value_exp_t* pParameterValues, uint32_t parameterCount, const char* pName, const char* pDescription, uint32_t* pMetricHandleCount, zet_metric_handle_t* phMetricHandles ) {return ZE_RESULT_SUCCESS;} + virtual ze_result_t zetMetricCreateFromProgrammableExpEpilogue( zet_metric_programmable_exp_handle_t hMetricProgrammable, zet_metric_programmable_param_value_exp_t* pParameterValues, uint32_t parameterCount, const char* pName, const char* pDescription, uint32_t* pMetricHandleCount, zet_metric_handle_t* phMetricHandles ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zetDeviceCreateMetricGroupsFromMetricsExpPrologue( zet_device_handle_t hDevice, uint32_t metricCount, zet_metric_handle_t * phMetrics, const char * pMetricGroupNamePrefix, const char * pDescription, uint32_t * pMetricGroupCount, zet_metric_group_handle_t* phMetricGroup ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zetDeviceCreateMetricGroupsFromMetricsExpEpilogue( zet_device_handle_t hDevice, uint32_t metricCount, zet_metric_handle_t * phMetrics, const char * pMetricGroupNamePrefix, const char * pDescription, uint32_t * pMetricGroupCount, zet_metric_group_handle_t* phMetricGroup ) {return ZE_RESULT_SUCCESS;} + virtual ze_result_t zetMetricGroupCreateExpPrologue( zet_device_handle_t hDevice, const char* pName, const char* pDescription, zet_metric_group_sampling_type_flags_t samplingType, zet_metric_group_handle_t* phMetricGroup ) {return ZE_RESULT_SUCCESS;} + virtual ze_result_t zetMetricGroupCreateExpEpilogue( zet_device_handle_t hDevice, const char* pName, const char* pDescription, zet_metric_group_sampling_type_flags_t samplingType, zet_metric_group_handle_t* phMetricGroup ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zetMetricGroupAddMetricExpPrologue( zet_metric_group_handle_t hMetricGroup, zet_metric_handle_t hMetric, size_t * pErrorStringSize, char* pErrorString ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zetMetricGroupAddMetricExpEpilogue( zet_metric_group_handle_t hMetricGroup, zet_metric_handle_t hMetric, size_t * pErrorStringSize, char* pErrorString ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zetMetricGroupRemoveMetricExpPrologue( zet_metric_group_handle_t hMetricGroup, zet_metric_handle_t hMetric ) {return ZE_RESULT_SUCCESS;} diff --git a/source/layers/validation/handle_lifetime_tracking/ze_handle_lifetime.cpp b/source/layers/validation/handle_lifetime_tracking/ze_handle_lifetime.cpp index 02257335..5e2bd8e6 100644 --- a/source/layers/validation/handle_lifetime_tracking/ze_handle_lifetime.cpp +++ b/source/layers/validation/handle_lifetime_tracking/ze_handle_lifetime.cpp @@ -329,9 +329,9 @@ namespace validation_layer ZEHandleLifetimeValidation::zeDeviceGetGlobalTimestampsPrologue( ze_device_handle_t hDevice, ///< [in] handle of the device uint64_t* hostTimestamp, ///< [out] value of the Host's global timestamp that correlates with the - ///< Device's global timestamp value + ///< Device's global timestamp value. uint64_t* deviceTimestamp ///< [out] value of the Device's global timestamp that correlates with the - ///< Host's global timestamp value + ///< Host's global timestamp value. ) { @@ -2374,7 +2374,8 @@ namespace validation_layer ze_result_t ZEHandleLifetimeValidation::zePhysicalMemCreatePrologue( ze_context_handle_t hContext, ///< [in] handle of the context object - ze_device_handle_t hDevice, ///< [in] handle of the device object + ze_device_handle_t hDevice, ///< [in] handle of the device object, can be `nullptr` if creating + ///< physical host memory. ze_physical_mem_desc_t* desc, ///< [in] pointer to physical memory descriptor. ze_physical_mem_handle_t* phPhysicalMemory ///< [out] pointer to handle of physical memory object created ) diff --git a/source/layers/validation/handle_lifetime_tracking/zes_handle_lifetime.cpp b/source/layers/validation/handle_lifetime_tracking/zes_handle_lifetime.cpp index ffb1c304..f3aab2d2 100644 --- a/source/layers/validation/handle_lifetime_tracking/zes_handle_lifetime.cpp +++ b/source/layers/validation/handle_lifetime_tracking/zes_handle_lifetime.cpp @@ -2040,7 +2040,7 @@ namespace validation_layer return ZE_RESULT_SUCCESS; } ze_result_t - ZESHandleLifetimeValidation::zesDeviceEnumEnabledVFExpPrologue( + ZESHandleLifetimeValidation::zesDeviceEnumActiveVFExpPrologue( zes_device_handle_t hDevice, ///< [in] Sysman handle of the device. uint32_t* pCount, ///< [in,out] pointer to the number of components of this type. ///< if count is zero, then the driver shall update the value with the @@ -2062,9 +2062,9 @@ namespace validation_layer return ZE_RESULT_SUCCESS; } ze_result_t - ZESHandleLifetimeValidation::zesVFManagementGetVFCapabilitiesExpPrologue( + ZESHandleLifetimeValidation::zesVFManagementGetVFPropertiesExpPrologue( zes_vf_handle_t hVFhandle, ///< [in] Sysman handle for the VF component. - zes_vf_exp_capabilities_t* pCapability ///< [in,out] Will contain VF capability. + zes_vf_exp_properties_t* pProperties ///< [in,out] Will contain VF properties. ) { @@ -2082,6 +2082,8 @@ namespace validation_layer ///< - if count is greater than the total number of memory stats ///< available, the driver shall update the value with the correct number ///< of memory stats available. + ///< - The count returned is the sum of number of VF instances currently + ///< available and the PF instance. zes_vf_util_mem_exp_t* pMemUtil ///< [in,out][optional][range(0, *pCount)] array of memory group activity counters. ///< - if count is less than the total number of memory stats available, ///< then driver shall only retrieve that number of stats. @@ -2104,6 +2106,8 @@ namespace validation_layer ///< - if count is greater than the total number of engine stats ///< available, the driver shall update the value with the correct number ///< of engine stats available. + ///< - The count returned is the sum of number of VF instances currently + ///< available and the PF instance. zes_vf_util_engine_exp_t* pEngineUtil ///< [in,out][optional][range(0, *pCount)] array of engine group activity counters. ///< - if count is less than the total number of engine stats available, ///< then driver shall only retrieve that number of stats. @@ -2112,6 +2116,112 @@ namespace validation_layer ) { + if ( !context.handleLifetime->isHandleValid( hVFhandle )){ + return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; + } + return ZE_RESULT_SUCCESS; + } + ze_result_t + ZESHandleLifetimeValidation::zesVFManagementSetVFTelemetryModeExpPrologue( + zes_vf_handle_t hVFhandle, ///< [in] Sysman handle for the component. + zes_vf_info_util_exp_flags_t flags, ///< [in] utilization flags to enable or disable. May be 0 or a valid + ///< combination of ::zes_vf_info_util_exp_flag_t. + ze_bool_t enable ///< [in] Enable utilization telemetry. + ) + { + + if ( !context.handleLifetime->isHandleValid( hVFhandle )){ + return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; + } + return ZE_RESULT_SUCCESS; + } + ze_result_t + ZESHandleLifetimeValidation::zesVFManagementSetVFTelemetrySamplingIntervalExpPrologue( + zes_vf_handle_t hVFhandle, ///< [in] Sysman handle for the component. + zes_vf_info_util_exp_flags_t flag, ///< [in] utilization flags to set sampling interval. May be 0 or a valid + ///< combination of ::zes_vf_info_util_exp_flag_t. + uint64_t samplingInterval ///< [in] Sampling interval value. + ) + { + + if ( !context.handleLifetime->isHandleValid( hVFhandle )){ + return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; + } + return ZE_RESULT_SUCCESS; + } + ze_result_t + ZESHandleLifetimeValidation::zesDeviceEnumEnabledVFExpPrologue( + zes_device_handle_t hDevice, ///< [in] Sysman handle of the device. + uint32_t* pCount, ///< [in,out] pointer to the number of components of this type. + ///< if count is zero, then the driver shall update the value with the + ///< total number of components of this type that are available. + ///< if count is greater than the number of components of this type that + ///< are available, then the driver shall update the value with the correct + ///< number of components. + zes_vf_handle_t* phVFhandle ///< [in,out][optional][range(0, *pCount)] array of handle of components of + ///< this type. + ///< if count is less than the number of components of this type that are + ///< available, then the driver shall only retrieve that number of + ///< component handles. + ) + { + + if ( !context.handleLifetime->isHandleValid( hDevice )){ + return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; + } + return ZE_RESULT_SUCCESS; + } + ze_result_t + ZESHandleLifetimeValidation::zesVFManagementGetVFCapabilitiesExpPrologue( + zes_vf_handle_t hVFhandle, ///< [in] Sysman handle for the VF component. + zes_vf_exp_capabilities_t* pCapability ///< [in,out] Will contain VF capability. + ) + { + + if ( !context.handleLifetime->isHandleValid( hVFhandle )){ + return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; + } + return ZE_RESULT_SUCCESS; + } + ze_result_t + ZESHandleLifetimeValidation::zesVFManagementGetVFMemoryUtilizationExp2Prologue( + zes_vf_handle_t hVFhandle, ///< [in] Sysman handle for the component. + uint32_t* pCount, ///< [in,out] Pointer to the number of VF memory stats descriptors. + ///< - if count is zero, the driver shall update the value with the total + ///< number of memory stats available. + ///< - if count is greater than the total number of memory stats + ///< available, the driver shall update the value with the correct number + ///< of memory stats available. + zes_vf_util_mem_exp2_t* pMemUtil ///< [in,out][optional][range(0, *pCount)] array of memory group activity counters. + ///< - if count is less than the total number of memory stats available, + ///< then driver shall only retrieve that number of stats. + ///< - the implementation shall populate the vector pCount-1 number of VF + ///< memory stats. + ) + { + + if ( !context.handleLifetime->isHandleValid( hVFhandle )){ + return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; + } + return ZE_RESULT_SUCCESS; + } + ze_result_t + ZESHandleLifetimeValidation::zesVFManagementGetVFEngineUtilizationExp2Prologue( + zes_vf_handle_t hVFhandle, ///< [in] Sysman handle for the component. + uint32_t* pCount, ///< [in,out] Pointer to the number of VF engine stats descriptors. + ///< - if count is zero, the driver shall update the value with the total + ///< number of engine stats available. + ///< - if count is greater than the total number of engine stats + ///< available, the driver shall update the value with the correct number + ///< of engine stats available. + zes_vf_util_engine_exp2_t* pEngineUtil ///< [in,out][optional][range(0, *pCount)] array of engine group activity counters. + ///< - if count is less than the total number of engine stats available, + ///< then driver shall only retrieve that number of stats. + ///< - the implementation shall populate the vector pCount-1 number of VF + ///< engine stats. + ) + { + if ( !context.handleLifetime->isHandleValid( hVFhandle )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } diff --git a/source/layers/validation/handle_lifetime_tracking/zes_handle_lifetime.h b/source/layers/validation/handle_lifetime_tracking/zes_handle_lifetime.h index d6384299..2d27779c 100644 --- a/source/layers/validation/handle_lifetime_tracking/zes_handle_lifetime.h +++ b/source/layers/validation/handle_lifetime_tracking/zes_handle_lifetime.h @@ -155,10 +155,16 @@ namespace validation_layer ze_result_t zesFirmwareSetSecurityVersionExpPrologue( zes_firmware_handle_t hFirmware ) override; ze_result_t zesDeviceGetSubDevicePropertiesExpPrologue( zes_device_handle_t hDevice, uint32_t* pCount, zes_subdevice_exp_properties_t* pSubdeviceProps ) override; ze_result_t zesDriverGetDeviceByUuidExpPrologue( zes_driver_handle_t hDriver, zes_uuid_t uuid, zes_device_handle_t* phDevice, ze_bool_t* onSubdevice, uint32_t* subdeviceId ) override; - ze_result_t zesDeviceEnumEnabledVFExpPrologue( zes_device_handle_t hDevice, uint32_t* pCount, zes_vf_handle_t* phVFhandle ) override; - ze_result_t zesVFManagementGetVFCapabilitiesExpPrologue( zes_vf_handle_t hVFhandle, zes_vf_exp_capabilities_t* pCapability ) override; + ze_result_t zesDeviceEnumActiveVFExpPrologue( zes_device_handle_t hDevice, uint32_t* pCount, zes_vf_handle_t* phVFhandle ) override; + ze_result_t zesVFManagementGetVFPropertiesExpPrologue( zes_vf_handle_t hVFhandle, zes_vf_exp_properties_t* pProperties ) override; ze_result_t zesVFManagementGetVFMemoryUtilizationExpPrologue( zes_vf_handle_t hVFhandle, uint32_t* pCount, zes_vf_util_mem_exp_t* pMemUtil ) override; ze_result_t zesVFManagementGetVFEngineUtilizationExpPrologue( zes_vf_handle_t hVFhandle, uint32_t* pCount, zes_vf_util_engine_exp_t* pEngineUtil ) override; + ze_result_t zesVFManagementSetVFTelemetryModeExpPrologue( zes_vf_handle_t hVFhandle, zes_vf_info_util_exp_flags_t flags, ze_bool_t enable ) override; + ze_result_t zesVFManagementSetVFTelemetrySamplingIntervalExpPrologue( zes_vf_handle_t hVFhandle, zes_vf_info_util_exp_flags_t flag, uint64_t samplingInterval ) override; + ze_result_t zesDeviceEnumEnabledVFExpPrologue( zes_device_handle_t hDevice, uint32_t* pCount, zes_vf_handle_t* phVFhandle ) override; + ze_result_t zesVFManagementGetVFCapabilitiesExpPrologue( zes_vf_handle_t hVFhandle, zes_vf_exp_capabilities_t* pCapability ) override; + ze_result_t zesVFManagementGetVFMemoryUtilizationExp2Prologue( zes_vf_handle_t hVFhandle, uint32_t* pCount, zes_vf_util_mem_exp2_t* pMemUtil ) override; + ze_result_t zesVFManagementGetVFEngineUtilizationExp2Prologue( zes_vf_handle_t hVFhandle, uint32_t* pCount, zes_vf_util_engine_exp2_t* pEngineUtil ) override; }; } diff --git a/source/layers/validation/handle_lifetime_tracking/zet_handle_lifetime.cpp b/source/layers/validation/handle_lifetime_tracking/zet_handle_lifetime.cpp index b16f68b8..82e5f877 100644 --- a/source/layers/validation/handle_lifetime_tracking/zet_handle_lifetime.cpp +++ b/source/layers/validation/handle_lifetime_tracking/zet_handle_lifetime.cpp @@ -1040,7 +1040,7 @@ namespace validation_layer return ZE_RESULT_SUCCESS; } ze_result_t - ZETHandleLifetimeValidation::zetMetricCreateFromProgrammableExpPrologue( + ZETHandleLifetimeValidation::zetMetricCreateFromProgrammableExp2Prologue( zet_metric_programmable_exp_handle_t hMetricProgrammable, ///< [in] handle of the metric programmable uint32_t parameterCount, ///< [in] Count of parameters to set. zet_metric_programmable_param_value_exp_t* pParameterValues,///< [in] list of parameter values to be set. @@ -1067,6 +1067,33 @@ namespace validation_layer return ZE_RESULT_SUCCESS; } ze_result_t + ZETHandleLifetimeValidation::zetMetricCreateFromProgrammableExpPrologue( + zet_metric_programmable_exp_handle_t hMetricProgrammable, ///< [in] handle of the metric programmable + zet_metric_programmable_param_value_exp_t* pParameterValues,///< [in] list of parameter values to be set. + uint32_t parameterCount, ///< [in] Count of parameters to set. + const char* pName, ///< [in] pointer to metric name to be used. Must point to a + ///< null-terminated character array no longer than ::ZET_MAX_METRIC_NAME. + const char* pDescription, ///< [in] pointer to metric description to be used. Must point to a + ///< null-terminated character array no longer than + ///< ::ZET_MAX_METRIC_DESCRIPTION. + uint32_t* pMetricHandleCount, ///< [in,out] Pointer to the number of metric handles. + ///< if count is zero, then the driver shall update the value with the + ///< number of metric handles available for this programmable. + ///< if count is greater than the number of metric handles available, then + ///< the driver shall update the value with the correct number of metric + ///< handles available. + zet_metric_handle_t* phMetricHandles ///< [in,out][optional][range(0,*pMetricHandleCount)] array of handle of metrics. + ///< if count is less than the number of metrics available, then driver + ///< shall only retrieve that number of metric handles. + ) + { + + if ( !context.handleLifetime->isHandleValid( hMetricProgrammable )){ + return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; + } + return ZE_RESULT_SUCCESS; + } + ze_result_t ZETHandleLifetimeValidation::zetDeviceCreateMetricGroupsFromMetricsExpPrologue( zet_device_handle_t hDevice, ///< [in] handle of the device. uint32_t metricCount, ///< [in] number of metric handles. @@ -1097,6 +1124,24 @@ namespace validation_layer return ZE_RESULT_SUCCESS; } ze_result_t + ZETHandleLifetimeValidation::zetMetricGroupCreateExpPrologue( + zet_device_handle_t hDevice, ///< [in] handle of the device + const char* pName, ///< [in] pointer to metric group name. Must point to a null-terminated + ///< character array no longer than ::ZET_MAX_METRIC_GROUP_NAME. + const char* pDescription, ///< [in] pointer to metric group description. Must point to a + ///< null-terminated character array no longer than + ///< ::ZET_MAX_METRIC_GROUP_DESCRIPTION. + zet_metric_group_sampling_type_flags_t samplingType,///< [in] Sampling type for the metric group. + zet_metric_group_handle_t* phMetricGroup ///< [in,out] Created Metric group handle + ) + { + + if ( !context.handleLifetime->isHandleValid( hDevice )){ + return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; + } + return ZE_RESULT_SUCCESS; + } + ze_result_t ZETHandleLifetimeValidation::zetMetricGroupAddMetricExpPrologue( zet_metric_group_handle_t hMetricGroup, ///< [in] Handle of the metric group zet_metric_handle_t hMetric, ///< [in] Metric to be added to the group. diff --git a/source/layers/validation/handle_lifetime_tracking/zet_handle_lifetime.h b/source/layers/validation/handle_lifetime_tracking/zet_handle_lifetime.h index a549c038..bb3b6ea3 100644 --- a/source/layers/validation/handle_lifetime_tracking/zet_handle_lifetime.h +++ b/source/layers/validation/handle_lifetime_tracking/zet_handle_lifetime.h @@ -76,8 +76,10 @@ namespace validation_layer ze_result_t zetMetricProgrammableGetPropertiesExpPrologue( zet_metric_programmable_exp_handle_t hMetricProgrammable, zet_metric_programmable_exp_properties_t* pProperties ) override; ze_result_t zetMetricProgrammableGetParamInfoExpPrologue( zet_metric_programmable_exp_handle_t hMetricProgrammable, uint32_t* pParameterCount, zet_metric_programmable_param_info_exp_t* pParameterInfo ) override; ze_result_t zetMetricProgrammableGetParamValueInfoExpPrologue( zet_metric_programmable_exp_handle_t hMetricProgrammable, uint32_t parameterOrdinal, uint32_t* pValueInfoCount, zet_metric_programmable_param_value_info_exp_t* pValueInfo ) override; - ze_result_t zetMetricCreateFromProgrammableExpPrologue( zet_metric_programmable_exp_handle_t hMetricProgrammable, uint32_t parameterCount, zet_metric_programmable_param_value_exp_t* pParameterValues, const char* pName, const char* pDescription, uint32_t* pMetricHandleCount, zet_metric_handle_t* phMetricHandles ) override; + ze_result_t zetMetricCreateFromProgrammableExp2Prologue( zet_metric_programmable_exp_handle_t hMetricProgrammable, uint32_t parameterCount, zet_metric_programmable_param_value_exp_t* pParameterValues, const char* pName, const char* pDescription, uint32_t* pMetricHandleCount, zet_metric_handle_t* phMetricHandles ) override; + ze_result_t zetMetricCreateFromProgrammableExpPrologue( zet_metric_programmable_exp_handle_t hMetricProgrammable, zet_metric_programmable_param_value_exp_t* pParameterValues, uint32_t parameterCount, const char* pName, const char* pDescription, uint32_t* pMetricHandleCount, zet_metric_handle_t* phMetricHandles ) override; ze_result_t zetDeviceCreateMetricGroupsFromMetricsExpPrologue( zet_device_handle_t hDevice, uint32_t metricCount, zet_metric_handle_t * phMetrics, const char * pMetricGroupNamePrefix, const char * pDescription, uint32_t * pMetricGroupCount, zet_metric_group_handle_t* phMetricGroup ) override; + ze_result_t zetMetricGroupCreateExpPrologue( zet_device_handle_t hDevice, const char* pName, const char* pDescription, zet_metric_group_sampling_type_flags_t samplingType, zet_metric_group_handle_t* phMetricGroup ) override; ze_result_t zetMetricGroupAddMetricExpPrologue( zet_metric_group_handle_t hMetricGroup, zet_metric_handle_t hMetric, size_t * pErrorStringSize, char* pErrorString ) override; ze_result_t zetMetricGroupRemoveMetricExpPrologue( zet_metric_group_handle_t hMetricGroup, zet_metric_handle_t hMetric ) override; ze_result_t zetMetricGroupCloseExpPrologue( zet_metric_group_handle_t hMetricGroup ) override; diff --git a/source/layers/validation/ze_valddi.cpp b/source/layers/validation/ze_valddi.cpp index 3b840dd9..0505abae 100644 --- a/source/layers/validation/ze_valddi.cpp +++ b/source/layers/validation/ze_valddi.cpp @@ -1076,9 +1076,9 @@ namespace validation_layer zeDeviceGetGlobalTimestamps( ze_device_handle_t hDevice, ///< [in] handle of the device uint64_t* hostTimestamp, ///< [out] value of the Host's global timestamp that correlates with the - ///< Device's global timestamp value + ///< Device's global timestamp value. uint64_t* deviceTimestamp ///< [out] value of the Device's global timestamp that correlates with the - ///< Host's global timestamp value + ///< Host's global timestamp value. ) { auto pfnGetGlobalTimestamps = context.zeDdiTable.Device.pfnGetGlobalTimestamps; @@ -6077,7 +6077,8 @@ namespace validation_layer __zedlllocal ze_result_t ZE_APICALL zePhysicalMemCreate( ze_context_handle_t hContext, ///< [in] handle of the context object - ze_device_handle_t hDevice, ///< [in] handle of the device object + ze_device_handle_t hDevice, ///< [in] handle of the device object, can be `nullptr` if creating + ///< physical host memory. ze_physical_mem_desc_t* desc, ///< [in] pointer to physical memory descriptor. ze_physical_mem_handle_t* phPhysicalMemory ///< [out] pointer to handle of physical memory object created ) diff --git a/source/layers/validation/zes_valddi.cpp b/source/layers/validation/zes_valddi.cpp index 91bfcffa..3a4efb87 100644 --- a/source/layers/validation/zes_valddi.cpp +++ b/source/layers/validation/zes_valddi.cpp @@ -5960,9 +5960,9 @@ namespace validation_layer } /////////////////////////////////////////////////////////////////////////////// - /// @brief Intercept function for zesDeviceEnumEnabledVFExp + /// @brief Intercept function for zesDeviceEnumActiveVFExp __zedlllocal ze_result_t ZE_APICALL - zesDeviceEnumEnabledVFExp( + zesDeviceEnumActiveVFExp( zes_device_handle_t hDevice, ///< [in] Sysman handle of the device. uint32_t* pCount, ///< [in,out] pointer to the number of components of this type. ///< if count is zero, then the driver shall update the value with the @@ -5977,14 +5977,14 @@ namespace validation_layer ///< component handles. ) { - auto pfnEnumEnabledVFExp = context.zesDdiTable.DeviceExp.pfnEnumEnabledVFExp; + auto pfnEnumActiveVFExp = context.zesDdiTable.DeviceExp.pfnEnumActiveVFExp; - if( nullptr == pfnEnumEnabledVFExp ) + if( nullptr == pfnEnumActiveVFExp ) return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; auto numValHandlers = context.validationHandlers.size(); for (size_t i = 0; i < numValHandlers; i++) { - auto result = context.validationHandlers[i]->zesValidation->zesDeviceEnumEnabledVFExpPrologue( hDevice, pCount, phVFhandle ); + auto result = context.validationHandlers[i]->zesValidation->zesDeviceEnumActiveVFExpPrologue( hDevice, pCount, phVFhandle ); if(result!=ZE_RESULT_SUCCESS) return result; } @@ -5995,14 +5995,14 @@ namespace validation_layer if(context.enableHandleLifetime ){ - auto result = context.handleLifetime->zesHandleLifetime.zesDeviceEnumEnabledVFExpPrologue( hDevice, pCount, phVFhandle ); + auto result = context.handleLifetime->zesHandleLifetime.zesDeviceEnumActiveVFExpPrologue( hDevice, pCount, phVFhandle ); if(result!=ZE_RESULT_SUCCESS) return result; } - auto result = pfnEnumEnabledVFExp( hDevice, pCount, phVFhandle ); + auto result = pfnEnumActiveVFExp( hDevice, pCount, phVFhandle ); for (size_t i = 0; i < numValHandlers; i++) { - auto result = context.validationHandlers[i]->zesValidation->zesDeviceEnumEnabledVFExpEpilogue( hDevice, pCount, phVFhandle ); + auto result = context.validationHandlers[i]->zesValidation->zesDeviceEnumActiveVFExpEpilogue( hDevice, pCount, phVFhandle ); if(result!=ZE_RESULT_SUCCESS) return result; } @@ -6010,21 +6010,21 @@ namespace validation_layer } /////////////////////////////////////////////////////////////////////////////// - /// @brief Intercept function for zesVFManagementGetVFCapabilitiesExp + /// @brief Intercept function for zesVFManagementGetVFPropertiesExp __zedlllocal ze_result_t ZE_APICALL - zesVFManagementGetVFCapabilitiesExp( + zesVFManagementGetVFPropertiesExp( zes_vf_handle_t hVFhandle, ///< [in] Sysman handle for the VF component. - zes_vf_exp_capabilities_t* pCapability ///< [in,out] Will contain VF capability. + zes_vf_exp_properties_t* pProperties ///< [in,out] Will contain VF properties. ) { - auto pfnGetVFCapabilitiesExp = context.zesDdiTable.VFManagementExp.pfnGetVFCapabilitiesExp; + auto pfnGetVFPropertiesExp = context.zesDdiTable.VFManagementExp.pfnGetVFPropertiesExp; - if( nullptr == pfnGetVFCapabilitiesExp ) + if( nullptr == pfnGetVFPropertiesExp ) return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; auto numValHandlers = context.validationHandlers.size(); for (size_t i = 0; i < numValHandlers; i++) { - auto result = context.validationHandlers[i]->zesValidation->zesVFManagementGetVFCapabilitiesExpPrologue( hVFhandle, pCapability ); + auto result = context.validationHandlers[i]->zesValidation->zesVFManagementGetVFPropertiesExpPrologue( hVFhandle, pProperties ); if(result!=ZE_RESULT_SUCCESS) return result; } @@ -6035,14 +6035,14 @@ namespace validation_layer if(context.enableHandleLifetime ){ - auto result = context.handleLifetime->zesHandleLifetime.zesVFManagementGetVFCapabilitiesExpPrologue( hVFhandle, pCapability ); + auto result = context.handleLifetime->zesHandleLifetime.zesVFManagementGetVFPropertiesExpPrologue( hVFhandle, pProperties ); if(result!=ZE_RESULT_SUCCESS) return result; } - auto result = pfnGetVFCapabilitiesExp( hVFhandle, pCapability ); + auto result = pfnGetVFPropertiesExp( hVFhandle, pProperties ); for (size_t i = 0; i < numValHandlers; i++) { - auto result = context.validationHandlers[i]->zesValidation->zesVFManagementGetVFCapabilitiesExpEpilogue( hVFhandle, pCapability ); + auto result = context.validationHandlers[i]->zesValidation->zesVFManagementGetVFPropertiesExpEpilogue( hVFhandle, pProperties ); if(result!=ZE_RESULT_SUCCESS) return result; } @@ -6064,6 +6064,8 @@ namespace validation_layer ///< - if count is greater than the total number of memory stats ///< available, the driver shall update the value with the correct number ///< of memory stats available. + ///< - The count returned is the sum of number of VF instances currently + ///< available and the PF instance. zes_vf_util_mem_exp_t* pMemUtil ///< [in,out][optional][range(0, *pCount)] array of memory group activity counters. ///< - if count is less than the total number of memory stats available, ///< then driver shall only retrieve that number of stats. @@ -6118,6 +6120,8 @@ namespace validation_layer ///< - if count is greater than the total number of engine stats ///< available, the driver shall update the value with the correct number ///< of engine stats available. + ///< - The count returned is the sum of number of VF instances currently + ///< available and the PF instance. zes_vf_util_engine_exp_t* pEngineUtil ///< [in,out][optional][range(0, *pCount)] array of engine group activity counters. ///< - if count is less than the total number of engine stats available, ///< then driver shall only retrieve that number of stats. @@ -6161,6 +6165,284 @@ namespace validation_layer return result; } + /////////////////////////////////////////////////////////////////////////////// + /// @brief Intercept function for zesVFManagementSetVFTelemetryModeExp + __zedlllocal ze_result_t ZE_APICALL + zesVFManagementSetVFTelemetryModeExp( + zes_vf_handle_t hVFhandle, ///< [in] Sysman handle for the component. + zes_vf_info_util_exp_flags_t flags, ///< [in] utilization flags to enable or disable. May be 0 or a valid + ///< combination of ::zes_vf_info_util_exp_flag_t. + ze_bool_t enable ///< [in] Enable utilization telemetry. + ) + { + auto pfnSetVFTelemetryModeExp = context.zesDdiTable.VFManagementExp.pfnSetVFTelemetryModeExp; + + if( nullptr == pfnSetVFTelemetryModeExp ) + return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; + + auto numValHandlers = context.validationHandlers.size(); + for (size_t i = 0; i < numValHandlers; i++) { + auto result = context.validationHandlers[i]->zesValidation->zesVFManagementSetVFTelemetryModeExpPrologue( hVFhandle, flags, enable ); + if(result!=ZE_RESULT_SUCCESS) return result; + } + + + if( context.enableThreadingValidation ){ + //Unimplemented + } + + + if(context.enableHandleLifetime ){ + auto result = context.handleLifetime->zesHandleLifetime.zesVFManagementSetVFTelemetryModeExpPrologue( hVFhandle, flags, enable ); + if(result!=ZE_RESULT_SUCCESS) return result; + } + + auto result = pfnSetVFTelemetryModeExp( hVFhandle, flags, enable ); + + for (size_t i = 0; i < numValHandlers; i++) { + auto result = context.validationHandlers[i]->zesValidation->zesVFManagementSetVFTelemetryModeExpEpilogue( hVFhandle, flags, enable ); + if(result!=ZE_RESULT_SUCCESS) return result; + } + + return result; + } + + /////////////////////////////////////////////////////////////////////////////// + /// @brief Intercept function for zesVFManagementSetVFTelemetrySamplingIntervalExp + __zedlllocal ze_result_t ZE_APICALL + zesVFManagementSetVFTelemetrySamplingIntervalExp( + zes_vf_handle_t hVFhandle, ///< [in] Sysman handle for the component. + zes_vf_info_util_exp_flags_t flag, ///< [in] utilization flags to set sampling interval. May be 0 or a valid + ///< combination of ::zes_vf_info_util_exp_flag_t. + uint64_t samplingInterval ///< [in] Sampling interval value. + ) + { + auto pfnSetVFTelemetrySamplingIntervalExp = context.zesDdiTable.VFManagementExp.pfnSetVFTelemetrySamplingIntervalExp; + + if( nullptr == pfnSetVFTelemetrySamplingIntervalExp ) + return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; + + auto numValHandlers = context.validationHandlers.size(); + for (size_t i = 0; i < numValHandlers; i++) { + auto result = context.validationHandlers[i]->zesValidation->zesVFManagementSetVFTelemetrySamplingIntervalExpPrologue( hVFhandle, flag, samplingInterval ); + if(result!=ZE_RESULT_SUCCESS) return result; + } + + + if( context.enableThreadingValidation ){ + //Unimplemented + } + + + if(context.enableHandleLifetime ){ + auto result = context.handleLifetime->zesHandleLifetime.zesVFManagementSetVFTelemetrySamplingIntervalExpPrologue( hVFhandle, flag, samplingInterval ); + if(result!=ZE_RESULT_SUCCESS) return result; + } + + auto result = pfnSetVFTelemetrySamplingIntervalExp( hVFhandle, flag, samplingInterval ); + + for (size_t i = 0; i < numValHandlers; i++) { + auto result = context.validationHandlers[i]->zesValidation->zesVFManagementSetVFTelemetrySamplingIntervalExpEpilogue( hVFhandle, flag, samplingInterval ); + if(result!=ZE_RESULT_SUCCESS) return result; + } + + return result; + } + + /////////////////////////////////////////////////////////////////////////////// + /// @brief Intercept function for zesDeviceEnumEnabledVFExp + __zedlllocal ze_result_t ZE_APICALL + zesDeviceEnumEnabledVFExp( + zes_device_handle_t hDevice, ///< [in] Sysman handle of the device. + uint32_t* pCount, ///< [in,out] pointer to the number of components of this type. + ///< if count is zero, then the driver shall update the value with the + ///< total number of components of this type that are available. + ///< if count is greater than the number of components of this type that + ///< are available, then the driver shall update the value with the correct + ///< number of components. + zes_vf_handle_t* phVFhandle ///< [in,out][optional][range(0, *pCount)] array of handle of components of + ///< this type. + ///< if count is less than the number of components of this type that are + ///< available, then the driver shall only retrieve that number of + ///< component handles. + ) + { + auto pfnEnumEnabledVFExp = context.zesDdiTable.DeviceExp.pfnEnumEnabledVFExp; + + if( nullptr == pfnEnumEnabledVFExp ) + return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; + + auto numValHandlers = context.validationHandlers.size(); + for (size_t i = 0; i < numValHandlers; i++) { + auto result = context.validationHandlers[i]->zesValidation->zesDeviceEnumEnabledVFExpPrologue( hDevice, pCount, phVFhandle ); + if(result!=ZE_RESULT_SUCCESS) return result; + } + + + if( context.enableThreadingValidation ){ + //Unimplemented + } + + + if(context.enableHandleLifetime ){ + auto result = context.handleLifetime->zesHandleLifetime.zesDeviceEnumEnabledVFExpPrologue( hDevice, pCount, phVFhandle ); + if(result!=ZE_RESULT_SUCCESS) return result; + } + + auto result = pfnEnumEnabledVFExp( hDevice, pCount, phVFhandle ); + + for (size_t i = 0; i < numValHandlers; i++) { + auto result = context.validationHandlers[i]->zesValidation->zesDeviceEnumEnabledVFExpEpilogue( hDevice, pCount, phVFhandle ); + if(result!=ZE_RESULT_SUCCESS) return result; + } + + return result; + } + + /////////////////////////////////////////////////////////////////////////////// + /// @brief Intercept function for zesVFManagementGetVFCapabilitiesExp + __zedlllocal ze_result_t ZE_APICALL + zesVFManagementGetVFCapabilitiesExp( + zes_vf_handle_t hVFhandle, ///< [in] Sysman handle for the VF component. + zes_vf_exp_capabilities_t* pCapability ///< [in,out] Will contain VF capability. + ) + { + auto pfnGetVFCapabilitiesExp = context.zesDdiTable.VFManagementExp.pfnGetVFCapabilitiesExp; + + if( nullptr == pfnGetVFCapabilitiesExp ) + return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; + + auto numValHandlers = context.validationHandlers.size(); + for (size_t i = 0; i < numValHandlers; i++) { + auto result = context.validationHandlers[i]->zesValidation->zesVFManagementGetVFCapabilitiesExpPrologue( hVFhandle, pCapability ); + if(result!=ZE_RESULT_SUCCESS) return result; + } + + + if( context.enableThreadingValidation ){ + //Unimplemented + } + + + if(context.enableHandleLifetime ){ + auto result = context.handleLifetime->zesHandleLifetime.zesVFManagementGetVFCapabilitiesExpPrologue( hVFhandle, pCapability ); + if(result!=ZE_RESULT_SUCCESS) return result; + } + + auto result = pfnGetVFCapabilitiesExp( hVFhandle, pCapability ); + + for (size_t i = 0; i < numValHandlers; i++) { + auto result = context.validationHandlers[i]->zesValidation->zesVFManagementGetVFCapabilitiesExpEpilogue( hVFhandle, pCapability ); + if(result!=ZE_RESULT_SUCCESS) return result; + } + + + if( result == ZE_RESULT_SUCCESS && context.enableHandleLifetime ){ + + } + return result; + } + + /////////////////////////////////////////////////////////////////////////////// + /// @brief Intercept function for zesVFManagementGetVFMemoryUtilizationExp2 + __zedlllocal ze_result_t ZE_APICALL + zesVFManagementGetVFMemoryUtilizationExp2( + zes_vf_handle_t hVFhandle, ///< [in] Sysman handle for the component. + uint32_t* pCount, ///< [in,out] Pointer to the number of VF memory stats descriptors. + ///< - if count is zero, the driver shall update the value with the total + ///< number of memory stats available. + ///< - if count is greater than the total number of memory stats + ///< available, the driver shall update the value with the correct number + ///< of memory stats available. + zes_vf_util_mem_exp2_t* pMemUtil ///< [in,out][optional][range(0, *pCount)] array of memory group activity counters. + ///< - if count is less than the total number of memory stats available, + ///< then driver shall only retrieve that number of stats. + ///< - the implementation shall populate the vector pCount-1 number of VF + ///< memory stats. + ) + { + auto pfnGetVFMemoryUtilizationExp2 = context.zesDdiTable.VFManagement.pfnGetVFMemoryUtilizationExp2; + + if( nullptr == pfnGetVFMemoryUtilizationExp2 ) + return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; + + auto numValHandlers = context.validationHandlers.size(); + for (size_t i = 0; i < numValHandlers; i++) { + auto result = context.validationHandlers[i]->zesValidation->zesVFManagementGetVFMemoryUtilizationExp2Prologue( hVFhandle, pCount, pMemUtil ); + if(result!=ZE_RESULT_SUCCESS) return result; + } + + + if( context.enableThreadingValidation ){ + //Unimplemented + } + + + if(context.enableHandleLifetime ){ + auto result = context.handleLifetime->zesHandleLifetime.zesVFManagementGetVFMemoryUtilizationExp2Prologue( hVFhandle, pCount, pMemUtil ); + if(result!=ZE_RESULT_SUCCESS) return result; + } + + auto result = pfnGetVFMemoryUtilizationExp2( hVFhandle, pCount, pMemUtil ); + + for (size_t i = 0; i < numValHandlers; i++) { + auto result = context.validationHandlers[i]->zesValidation->zesVFManagementGetVFMemoryUtilizationExp2Epilogue( hVFhandle, pCount, pMemUtil ); + if(result!=ZE_RESULT_SUCCESS) return result; + } + + return result; + } + + /////////////////////////////////////////////////////////////////////////////// + /// @brief Intercept function for zesVFManagementGetVFEngineUtilizationExp2 + __zedlllocal ze_result_t ZE_APICALL + zesVFManagementGetVFEngineUtilizationExp2( + zes_vf_handle_t hVFhandle, ///< [in] Sysman handle for the component. + uint32_t* pCount, ///< [in,out] Pointer to the number of VF engine stats descriptors. + ///< - if count is zero, the driver shall update the value with the total + ///< number of engine stats available. + ///< - if count is greater than the total number of engine stats + ///< available, the driver shall update the value with the correct number + ///< of engine stats available. + zes_vf_util_engine_exp2_t* pEngineUtil ///< [in,out][optional][range(0, *pCount)] array of engine group activity counters. + ///< - if count is less than the total number of engine stats available, + ///< then driver shall only retrieve that number of stats. + ///< - the implementation shall populate the vector pCount-1 number of VF + ///< engine stats. + ) + { + auto pfnGetVFEngineUtilizationExp2 = context.zesDdiTable.VFManagement.pfnGetVFEngineUtilizationExp2; + + if( nullptr == pfnGetVFEngineUtilizationExp2 ) + return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; + + auto numValHandlers = context.validationHandlers.size(); + for (size_t i = 0; i < numValHandlers; i++) { + auto result = context.validationHandlers[i]->zesValidation->zesVFManagementGetVFEngineUtilizationExp2Prologue( hVFhandle, pCount, pEngineUtil ); + if(result!=ZE_RESULT_SUCCESS) return result; + } + + + if( context.enableThreadingValidation ){ + //Unimplemented + } + + + if(context.enableHandleLifetime ){ + auto result = context.handleLifetime->zesHandleLifetime.zesVFManagementGetVFEngineUtilizationExp2Prologue( hVFhandle, pCount, pEngineUtil ); + if(result!=ZE_RESULT_SUCCESS) return result; + } + + auto result = pfnGetVFEngineUtilizationExp2( hVFhandle, pCount, pEngineUtil ); + + for (size_t i = 0; i < numValHandlers; i++) { + auto result = context.validationHandlers[i]->zesValidation->zesVFManagementGetVFEngineUtilizationExp2Epilogue( hVFhandle, pCount, pEngineUtil ); + if(result!=ZE_RESULT_SUCCESS) return result; + } + + return result; + } + } // namespace validation_layer #if defined(__cplusplus) @@ -6362,11 +6644,14 @@ zesGetDeviceExpProcAddrTable( ze_result_t result = ZE_RESULT_SUCCESS; + dditable.pfnEnumEnabledVFExp = pDdiTable->pfnEnumEnabledVFExp; + pDdiTable->pfnEnumEnabledVFExp = validation_layer::zesDeviceEnumEnabledVFExp; + dditable.pfnGetSubDevicePropertiesExp = pDdiTable->pfnGetSubDevicePropertiesExp; pDdiTable->pfnGetSubDevicePropertiesExp = validation_layer::zesDeviceGetSubDevicePropertiesExp; - dditable.pfnEnumEnabledVFExp = pDdiTable->pfnEnumEnabledVFExp; - pDdiTable->pfnEnumEnabledVFExp = validation_layer::zesDeviceEnumEnabledVFExp; + dditable.pfnEnumActiveVFExp = pDdiTable->pfnEnumActiveVFExp; + pDdiTable->pfnEnumActiveVFExp = validation_layer::zesDeviceEnumActiveVFExp; return result; } @@ -7228,6 +7513,40 @@ zesGetTemperatureProcAddrTable( return result; } +/////////////////////////////////////////////////////////////////////////////// +/// @brief Exported function for filling application's VFManagement table +/// with current process' addresses +/// +/// @returns +/// - ::ZE_RESULT_SUCCESS +/// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER +/// - ::ZE_RESULT_ERROR_UNSUPPORTED_VERSION +ZE_DLLEXPORT ze_result_t ZE_APICALL +zesGetVFManagementProcAddrTable( + ze_api_version_t version, ///< [in] API version requested + zes_vf_management_dditable_t* pDdiTable ///< [in,out] pointer to table of DDI function pointers + ) +{ + auto& dditable = validation_layer::context.zesDdiTable.VFManagement; + + if( nullptr == pDdiTable ) + return ZE_RESULT_ERROR_INVALID_NULL_POINTER; + + if (ZE_MAJOR_VERSION(validation_layer::context.version) != ZE_MAJOR_VERSION(version) || + ZE_MINOR_VERSION(validation_layer::context.version) > ZE_MINOR_VERSION(version)) + return ZE_RESULT_ERROR_UNSUPPORTED_VERSION; + + ze_result_t result = ZE_RESULT_SUCCESS; + + dditable.pfnGetVFMemoryUtilizationExp2 = pDdiTable->pfnGetVFMemoryUtilizationExp2; + pDdiTable->pfnGetVFMemoryUtilizationExp2 = validation_layer::zesVFManagementGetVFMemoryUtilizationExp2; + + dditable.pfnGetVFEngineUtilizationExp2 = pDdiTable->pfnGetVFEngineUtilizationExp2; + pDdiTable->pfnGetVFEngineUtilizationExp2 = validation_layer::zesVFManagementGetVFEngineUtilizationExp2; + + return result; +} + /////////////////////////////////////////////////////////////////////////////// /// @brief Exported function for filling application's VFManagementExp table /// with current process' addresses @@ -7256,12 +7575,21 @@ zesGetVFManagementExpProcAddrTable( dditable.pfnGetVFCapabilitiesExp = pDdiTable->pfnGetVFCapabilitiesExp; pDdiTable->pfnGetVFCapabilitiesExp = validation_layer::zesVFManagementGetVFCapabilitiesExp; + dditable.pfnGetVFPropertiesExp = pDdiTable->pfnGetVFPropertiesExp; + pDdiTable->pfnGetVFPropertiesExp = validation_layer::zesVFManagementGetVFPropertiesExp; + dditable.pfnGetVFMemoryUtilizationExp = pDdiTable->pfnGetVFMemoryUtilizationExp; pDdiTable->pfnGetVFMemoryUtilizationExp = validation_layer::zesVFManagementGetVFMemoryUtilizationExp; dditable.pfnGetVFEngineUtilizationExp = pDdiTable->pfnGetVFEngineUtilizationExp; pDdiTable->pfnGetVFEngineUtilizationExp = validation_layer::zesVFManagementGetVFEngineUtilizationExp; + dditable.pfnSetVFTelemetryModeExp = pDdiTable->pfnSetVFTelemetryModeExp; + pDdiTable->pfnSetVFTelemetryModeExp = validation_layer::zesVFManagementSetVFTelemetryModeExp; + + dditable.pfnSetVFTelemetrySamplingIntervalExp = pDdiTable->pfnSetVFTelemetrySamplingIntervalExp; + pDdiTable->pfnSetVFTelemetrySamplingIntervalExp = validation_layer::zesVFManagementSetVFTelemetrySamplingIntervalExp; + return result; } diff --git a/source/layers/validation/zet_valddi.cpp b/source/layers/validation/zet_valddi.cpp index 39de9820..eb729c58 100644 --- a/source/layers/validation/zet_valddi.cpp +++ b/source/layers/validation/zet_valddi.cpp @@ -2662,13 +2662,78 @@ namespace validation_layer return result; } + /////////////////////////////////////////////////////////////////////////////// + /// @brief Intercept function for zetMetricCreateFromProgrammableExp2 + __zedlllocal ze_result_t ZE_APICALL + zetMetricCreateFromProgrammableExp2( + zet_metric_programmable_exp_handle_t hMetricProgrammable, ///< [in] handle of the metric programmable + uint32_t parameterCount, ///< [in] Count of parameters to set. + zet_metric_programmable_param_value_exp_t* pParameterValues,///< [in] list of parameter values to be set. + const char* pName, ///< [in] pointer to metric name to be used. Must point to a + ///< null-terminated character array no longer than ::ZET_MAX_METRIC_NAME. + const char* pDescription, ///< [in] pointer to metric description to be used. Must point to a + ///< null-terminated character array no longer than + ///< ::ZET_MAX_METRIC_DESCRIPTION. + uint32_t* pMetricHandleCount, ///< [in,out] Pointer to the number of metric handles. + ///< if count is zero, then the driver shall update the value with the + ///< number of metric handles available for this programmable. + ///< if count is greater than the number of metric handles available, then + ///< the driver shall update the value with the correct number of metric + ///< handles available. + zet_metric_handle_t* phMetricHandles ///< [in,out][optional][range(0,*pMetricHandleCount)] array of handle of metrics. + ///< if count is less than the number of metrics available, then driver + ///< shall only retrieve that number of metric handles. + ) + { + auto pfnCreateFromProgrammableExp2 = context.zetDdiTable.Metric.pfnCreateFromProgrammableExp2; + + if( nullptr == pfnCreateFromProgrammableExp2 ) + return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; + + auto numValHandlers = context.validationHandlers.size(); + for (size_t i = 0; i < numValHandlers; i++) { + auto result = context.validationHandlers[i]->zetValidation->zetMetricCreateFromProgrammableExp2Prologue( hMetricProgrammable, parameterCount, pParameterValues, pName, pDescription, pMetricHandleCount, phMetricHandles ); + if(result!=ZE_RESULT_SUCCESS) return result; + } + + + if( context.enableThreadingValidation ){ + //Unimplemented + } + + + if(context.enableHandleLifetime ){ + auto result = context.handleLifetime->zetHandleLifetime.zetMetricCreateFromProgrammableExp2Prologue( hMetricProgrammable, parameterCount, pParameterValues, pName, pDescription, pMetricHandleCount, phMetricHandles ); + if(result!=ZE_RESULT_SUCCESS) return result; + } + + auto result = pfnCreateFromProgrammableExp2( hMetricProgrammable, parameterCount, pParameterValues, pName, pDescription, pMetricHandleCount, phMetricHandles ); + + for (size_t i = 0; i < numValHandlers; i++) { + auto result = context.validationHandlers[i]->zetValidation->zetMetricCreateFromProgrammableExp2Epilogue( hMetricProgrammable, parameterCount, pParameterValues, pName, pDescription, pMetricHandleCount, phMetricHandles ); + if(result!=ZE_RESULT_SUCCESS) return result; + } + + + if( result == ZE_RESULT_SUCCESS && context.enableHandleLifetime ){ + + for (size_t i = 0; ( nullptr != phMetricHandles) && (i < *pMetricHandleCount); ++i){ + if (phMetricHandles[i]){ + context.handleLifetime->addHandle( phMetricHandles[i] ); + context.handleLifetime->addDependent( hMetricProgrammable, phMetricHandles[i] ); + } + } + } + return result; + } + /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zetMetricCreateFromProgrammableExp __zedlllocal ze_result_t ZE_APICALL zetMetricCreateFromProgrammableExp( zet_metric_programmable_exp_handle_t hMetricProgrammable, ///< [in] handle of the metric programmable - uint32_t parameterCount, ///< [in] Count of parameters to set. zet_metric_programmable_param_value_exp_t* pParameterValues,///< [in] list of parameter values to be set. + uint32_t parameterCount, ///< [in] Count of parameters to set. const char* pName, ///< [in] pointer to metric name to be used. Must point to a ///< null-terminated character array no longer than ::ZET_MAX_METRIC_NAME. const char* pDescription, ///< [in] pointer to metric description to be used. Must point to a @@ -2692,7 +2757,7 @@ namespace validation_layer auto numValHandlers = context.validationHandlers.size(); for (size_t i = 0; i < numValHandlers; i++) { - auto result = context.validationHandlers[i]->zetValidation->zetMetricCreateFromProgrammableExpPrologue( hMetricProgrammable, parameterCount, pParameterValues, pName, pDescription, pMetricHandleCount, phMetricHandles ); + auto result = context.validationHandlers[i]->zetValidation->zetMetricCreateFromProgrammableExpPrologue( hMetricProgrammable, pParameterValues, parameterCount, pName, pDescription, pMetricHandleCount, phMetricHandles ); if(result!=ZE_RESULT_SUCCESS) return result; } @@ -2703,14 +2768,14 @@ namespace validation_layer if(context.enableHandleLifetime ){ - auto result = context.handleLifetime->zetHandleLifetime.zetMetricCreateFromProgrammableExpPrologue( hMetricProgrammable, parameterCount, pParameterValues, pName, pDescription, pMetricHandleCount, phMetricHandles ); + auto result = context.handleLifetime->zetHandleLifetime.zetMetricCreateFromProgrammableExpPrologue( hMetricProgrammable, pParameterValues, parameterCount, pName, pDescription, pMetricHandleCount, phMetricHandles ); if(result!=ZE_RESULT_SUCCESS) return result; } - auto result = pfnCreateFromProgrammableExp( hMetricProgrammable, parameterCount, pParameterValues, pName, pDescription, pMetricHandleCount, phMetricHandles ); + auto result = pfnCreateFromProgrammableExp( hMetricProgrammable, pParameterValues, parameterCount, pName, pDescription, pMetricHandleCount, phMetricHandles ); for (size_t i = 0; i < numValHandlers; i++) { - auto result = context.validationHandlers[i]->zetValidation->zetMetricCreateFromProgrammableExpEpilogue( hMetricProgrammable, parameterCount, pParameterValues, pName, pDescription, pMetricHandleCount, phMetricHandles ); + auto result = context.validationHandlers[i]->zetValidation->zetMetricCreateFromProgrammableExpEpilogue( hMetricProgrammable, pParameterValues, parameterCount, pName, pDescription, pMetricHandleCount, phMetricHandles ); if(result!=ZE_RESULT_SUCCESS) return result; } @@ -2795,6 +2860,61 @@ namespace validation_layer return result; } + /////////////////////////////////////////////////////////////////////////////// + /// @brief Intercept function for zetMetricGroupCreateExp + __zedlllocal ze_result_t ZE_APICALL + zetMetricGroupCreateExp( + zet_device_handle_t hDevice, ///< [in] handle of the device + const char* pName, ///< [in] pointer to metric group name. Must point to a null-terminated + ///< character array no longer than ::ZET_MAX_METRIC_GROUP_NAME. + const char* pDescription, ///< [in] pointer to metric group description. Must point to a + ///< null-terminated character array no longer than + ///< ::ZET_MAX_METRIC_GROUP_DESCRIPTION. + zet_metric_group_sampling_type_flags_t samplingType,///< [in] Sampling type for the metric group. + zet_metric_group_handle_t* phMetricGroup ///< [in,out] Created Metric group handle + ) + { + auto pfnCreateExp = context.zetDdiTable.MetricGroupExp.pfnCreateExp; + + if( nullptr == pfnCreateExp ) + return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; + + auto numValHandlers = context.validationHandlers.size(); + for (size_t i = 0; i < numValHandlers; i++) { + auto result = context.validationHandlers[i]->zetValidation->zetMetricGroupCreateExpPrologue( hDevice, pName, pDescription, samplingType, phMetricGroup ); + if(result!=ZE_RESULT_SUCCESS) return result; + } + + + if( context.enableThreadingValidation ){ + //Unimplemented + } + + + if(context.enableHandleLifetime ){ + auto result = context.handleLifetime->zetHandleLifetime.zetMetricGroupCreateExpPrologue( hDevice, pName, pDescription, samplingType, phMetricGroup ); + if(result!=ZE_RESULT_SUCCESS) return result; + } + + auto result = pfnCreateExp( hDevice, pName, pDescription, samplingType, phMetricGroup ); + + for (size_t i = 0; i < numValHandlers; i++) { + auto result = context.validationHandlers[i]->zetValidation->zetMetricGroupCreateExpEpilogue( hDevice, pName, pDescription, samplingType, phMetricGroup ); + if(result!=ZE_RESULT_SUCCESS) return result; + } + + + if( result == ZE_RESULT_SUCCESS && context.enableHandleLifetime ){ + + if (phMetricGroup){ + context.handleLifetime->addHandle( *phMetricGroup ); + context.handleLifetime->addDependent( hDevice, *phMetricGroup ); + + } + } + return result; + } + /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zetMetricGroupAddMetricExp __zedlllocal ze_result_t ZE_APICALL @@ -3421,6 +3541,9 @@ zetGetMetricProcAddrTable( dditable.pfnGetProperties = pDdiTable->pfnGetProperties; pDdiTable->pfnGetProperties = validation_layer::zetMetricGetProperties; + dditable.pfnCreateFromProgrammableExp2 = pDdiTable->pfnCreateFromProgrammableExp2; + pDdiTable->pfnCreateFromProgrammableExp2 = validation_layer::zetMetricCreateFromProgrammableExp2; + return result; } @@ -3520,6 +3643,9 @@ zetGetMetricGroupExpProcAddrTable( ze_result_t result = ZE_RESULT_SUCCESS; + dditable.pfnCreateExp = pDdiTable->pfnCreateExp; + pDdiTable->pfnCreateExp = validation_layer::zetMetricGroupCreateExp; + dditable.pfnCalculateMultipleMetricValuesExp = pDdiTable->pfnCalculateMultipleMetricValuesExp; pDdiTable->pfnCalculateMultipleMetricValuesExp = validation_layer::zetMetricGroupCalculateMultipleMetricValuesExp; diff --git a/source/lib/ze_libapi.cpp b/source/lib/ze_libapi.cpp index c49f0311..ac7fed2b 100644 --- a/source/lib/ze_libapi.cpp +++ b/source/lib/ze_libapi.cpp @@ -1192,13 +1192,15 @@ zeDeviceGetStatus( /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == hostTimestamp` /// + `nullptr == deviceTimestamp` +/// - ::ZE_RESULT_ERROR_UNSUPPORTED_FEATURE +/// + The feature is not supported by the underlying platform. ze_result_t ZE_APICALL zeDeviceGetGlobalTimestamps( ze_device_handle_t hDevice, ///< [in] handle of the device uint64_t* hostTimestamp, ///< [out] value of the Host's global timestamp that correlates with the - ///< Device's global timestamp value + ///< Device's global timestamp value. uint64_t* deviceTimestamp ///< [out] value of the Device's global timestamp that correlates with the - ///< Host's global timestamp value + ///< Host's global timestamp value. ) { if(ze_lib::context->inTeardown) { @@ -6707,7 +6709,9 @@ zeVirtualMemQueryPageSize( /// @details /// - The application must only use the physical memory object on the /// context for which it was created. -/// - The size must be page aligned. See ::zeVirtualMemQueryPageSize. +/// - The size must be page aligned. For host memory, the operating system +/// page size should be used. For device memory, see +/// ::zeVirtualMemQueryPageSize. /// - The application may call this function from simultaneous threads. /// - The implementation of this function must be thread-safe. /// @@ -6724,14 +6728,15 @@ zeVirtualMemQueryPageSize( /// + `nullptr == desc` /// + `nullptr == phPhysicalMemory` /// - ::ZE_RESULT_ERROR_INVALID_ENUMERATION -/// + `0x1 < desc->flags` +/// + `0x3 < desc->flags` /// - ::ZE_RESULT_ERROR_UNSUPPORTED_SIZE /// + `0 == desc->size` /// - ::ZE_RESULT_ERROR_UNSUPPORTED_ALIGNMENT ze_result_t ZE_APICALL zePhysicalMemCreate( ze_context_handle_t hContext, ///< [in] handle of the context object - ze_device_handle_t hDevice, ///< [in] handle of the device object + ze_device_handle_t hDevice, ///< [in] handle of the device object, can be `nullptr` if creating + ///< physical host memory. ze_physical_mem_desc_t* desc, ///< [in] pointer to physical memory descriptor. ze_physical_mem_handle_t* phPhysicalMemory ///< [out] pointer to handle of physical memory object created ) diff --git a/source/lib/zes_libapi.cpp b/source/lib/zes_libapi.cpp index 79ebe667..3f995507 100644 --- a/source/lib/zes_libapi.cpp +++ b/source/lib/zes_libapi.cpp @@ -6113,6 +6113,285 @@ zesDriverGetDeviceByUuidExp( return pfnGetDeviceByUuidExp( hDriver, uuid, phDevice, onSubdevice, subdeviceId ); } +/////////////////////////////////////////////////////////////////////////////// +/// @brief Get handle of virtual function modules +/// +/// @details +/// - [DEPRECATED] No longer supported. Use ::zesDeviceEnumEnabledVFExp. +/// - The application may call this function from simultaneous threads. +/// - The implementation of this function should be lock-free. +/// +/// @returns +/// - ::ZE_RESULT_SUCCESS +/// - ::ZE_RESULT_ERROR_UNINITIALIZED +/// - ::ZE_RESULT_ERROR_DEVICE_LOST +/// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY +/// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY +/// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `nullptr == hDevice` +/// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER +/// + `nullptr == pCount` +ze_result_t ZE_APICALL +zesDeviceEnumActiveVFExp( + zes_device_handle_t hDevice, ///< [in] Sysman handle of the device. + uint32_t* pCount, ///< [in,out] pointer to the number of components of this type. + ///< if count is zero, then the driver shall update the value with the + ///< total number of components of this type that are available. + ///< if count is greater than the number of components of this type that + ///< are available, then the driver shall update the value with the correct + ///< number of components. + zes_vf_handle_t* phVFhandle ///< [in,out][optional][range(0, *pCount)] array of handle of components of + ///< this type. + ///< if count is less than the number of components of this type that are + ///< available, then the driver shall only retrieve that number of + ///< component handles. + ) +{ + if(ze_lib::context->inTeardown) { + return ZE_RESULT_ERROR_UNINITIALIZED; + } + + auto pfnEnumActiveVFExp = ze_lib::context->zesDdiTable.load()->DeviceExp.pfnEnumActiveVFExp; + if( nullptr == pfnEnumActiveVFExp ) { + if(!ze_lib::context->isInitialized) + return ZE_RESULT_ERROR_UNINITIALIZED; + else + return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; + } + + return pfnEnumActiveVFExp( hDevice, pCount, phVFhandle ); +} + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Get virtual function management properties +/// +/// @details +/// - [DEPRECATED] No longer supported. Use +/// ::zesVFManagementGetVFCapabilitiesExp. +/// - The application may call this function from simultaneous threads. +/// - The implementation of this function should be lock-free. +/// +/// @returns +/// - ::ZE_RESULT_SUCCESS +/// - ::ZE_RESULT_ERROR_UNINITIALIZED +/// - ::ZE_RESULT_ERROR_DEVICE_LOST +/// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY +/// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY +/// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `nullptr == hVFhandle` +/// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER +/// + `nullptr == pProperties` +ze_result_t ZE_APICALL +zesVFManagementGetVFPropertiesExp( + zes_vf_handle_t hVFhandle, ///< [in] Sysman handle for the VF component. + zes_vf_exp_properties_t* pProperties ///< [in,out] Will contain VF properties. + ) +{ + if(ze_lib::context->inTeardown) { + return ZE_RESULT_ERROR_UNINITIALIZED; + } + + auto pfnGetVFPropertiesExp = ze_lib::context->zesDdiTable.load()->VFManagementExp.pfnGetVFPropertiesExp; + if( nullptr == pfnGetVFPropertiesExp ) { + if(!ze_lib::context->isInitialized) + return ZE_RESULT_ERROR_UNINITIALIZED; + else + return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; + } + + return pfnGetVFPropertiesExp( hVFhandle, pProperties ); +} + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Get memory activity stats for each available memory types associated +/// with Virtual Function (VF) +/// +/// @details +/// - [DEPRECATED] No longer supported. Use +/// ::zesVFManagementGetVFMemoryUtilizationExp2. +/// - The application may call this function from simultaneous threads. +/// - The implementation of this function should be lock-free. +/// +/// @returns +/// - ::ZE_RESULT_SUCCESS +/// - ::ZE_RESULT_ERROR_UNINITIALIZED +/// - ::ZE_RESULT_ERROR_DEVICE_LOST +/// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY +/// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY +/// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `nullptr == hVFhandle` +/// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER +/// + `nullptr == pCount` +ze_result_t ZE_APICALL +zesVFManagementGetVFMemoryUtilizationExp( + zes_vf_handle_t hVFhandle, ///< [in] Sysman handle for the component. + uint32_t* pCount, ///< [in,out] Pointer to the number of VF memory stats descriptors. + ///< - if count is zero, the driver shall update the value with the total + ///< number of memory stats available. + ///< - if count is greater than the total number of memory stats + ///< available, the driver shall update the value with the correct number + ///< of memory stats available. + ///< - The count returned is the sum of number of VF instances currently + ///< available and the PF instance. + zes_vf_util_mem_exp_t* pMemUtil ///< [in,out][optional][range(0, *pCount)] array of memory group activity counters. + ///< - if count is less than the total number of memory stats available, + ///< then driver shall only retrieve that number of stats. + ///< - the implementation shall populate the vector pCount-1 number of VF + ///< memory stats. + ) +{ + if(ze_lib::context->inTeardown) { + return ZE_RESULT_ERROR_UNINITIALIZED; + } + + auto pfnGetVFMemoryUtilizationExp = ze_lib::context->zesDdiTable.load()->VFManagementExp.pfnGetVFMemoryUtilizationExp; + if( nullptr == pfnGetVFMemoryUtilizationExp ) { + if(!ze_lib::context->isInitialized) + return ZE_RESULT_ERROR_UNINITIALIZED; + else + return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; + } + + return pfnGetVFMemoryUtilizationExp( hVFhandle, pCount, pMemUtil ); +} + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Get engine activity stats for each available engine group associated +/// with Virtual Function (VF) +/// +/// @details +/// - [DEPRECATED] No longer supported. Use +/// ::zesVFManagementGetVFEngineUtilizationExp2. +/// - The application may call this function from simultaneous threads. +/// - The implementation of this function should be lock-free. +/// +/// @returns +/// - ::ZE_RESULT_SUCCESS +/// - ::ZE_RESULT_ERROR_UNINITIALIZED +/// - ::ZE_RESULT_ERROR_DEVICE_LOST +/// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY +/// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY +/// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `nullptr == hVFhandle` +/// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER +/// + `nullptr == pCount` +ze_result_t ZE_APICALL +zesVFManagementGetVFEngineUtilizationExp( + zes_vf_handle_t hVFhandle, ///< [in] Sysman handle for the component. + uint32_t* pCount, ///< [in,out] Pointer to the number of VF engine stats descriptors. + ///< - if count is zero, the driver shall update the value with the total + ///< number of engine stats available. + ///< - if count is greater than the total number of engine stats + ///< available, the driver shall update the value with the correct number + ///< of engine stats available. + ///< - The count returned is the sum of number of VF instances currently + ///< available and the PF instance. + zes_vf_util_engine_exp_t* pEngineUtil ///< [in,out][optional][range(0, *pCount)] array of engine group activity counters. + ///< - if count is less than the total number of engine stats available, + ///< then driver shall only retrieve that number of stats. + ///< - the implementation shall populate the vector pCount-1 number of VF + ///< engine stats. + ) +{ + if(ze_lib::context->inTeardown) { + return ZE_RESULT_ERROR_UNINITIALIZED; + } + + auto pfnGetVFEngineUtilizationExp = ze_lib::context->zesDdiTable.load()->VFManagementExp.pfnGetVFEngineUtilizationExp; + if( nullptr == pfnGetVFEngineUtilizationExp ) { + if(!ze_lib::context->isInitialized) + return ZE_RESULT_ERROR_UNINITIALIZED; + else + return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; + } + + return pfnGetVFEngineUtilizationExp( hVFhandle, pCount, pEngineUtil ); +} + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Configure utilization telemetry enabled or disabled associated with +/// Virtual Function (VF) +/// +/// @details +/// - [DEPRECATED] No longer supported. +/// - The application may call this function from simultaneous threads. +/// - The implementation of this function should be lock-free. +/// +/// @returns +/// - ::ZE_RESULT_SUCCESS +/// - ::ZE_RESULT_ERROR_UNINITIALIZED +/// - ::ZE_RESULT_ERROR_DEVICE_LOST +/// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY +/// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY +/// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `nullptr == hVFhandle` +/// - ::ZE_RESULT_ERROR_INVALID_ENUMERATION +/// + `0xf < flags` +ze_result_t ZE_APICALL +zesVFManagementSetVFTelemetryModeExp( + zes_vf_handle_t hVFhandle, ///< [in] Sysman handle for the component. + zes_vf_info_util_exp_flags_t flags, ///< [in] utilization flags to enable or disable. May be 0 or a valid + ///< combination of ::zes_vf_info_util_exp_flag_t. + ze_bool_t enable ///< [in] Enable utilization telemetry. + ) +{ + if(ze_lib::context->inTeardown) { + return ZE_RESULT_ERROR_UNINITIALIZED; + } + + auto pfnSetVFTelemetryModeExp = ze_lib::context->zesDdiTable.load()->VFManagementExp.pfnSetVFTelemetryModeExp; + if( nullptr == pfnSetVFTelemetryModeExp ) { + if(!ze_lib::context->isInitialized) + return ZE_RESULT_ERROR_UNINITIALIZED; + else + return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; + } + + return pfnSetVFTelemetryModeExp( hVFhandle, flags, enable ); +} + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Set sampling interval to monitor for a particular utilization +/// telemetry associated with Virtual Function (VF) +/// +/// @details +/// - [DEPRECATED] No longer supported. +/// - The application may call this function from simultaneous threads. +/// - The implementation of this function should be lock-free. +/// +/// @returns +/// - ::ZE_RESULT_SUCCESS +/// - ::ZE_RESULT_ERROR_UNINITIALIZED +/// - ::ZE_RESULT_ERROR_DEVICE_LOST +/// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY +/// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY +/// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `nullptr == hVFhandle` +/// - ::ZE_RESULT_ERROR_INVALID_ENUMERATION +/// + `0xf < flag` +ze_result_t ZE_APICALL +zesVFManagementSetVFTelemetrySamplingIntervalExp( + zes_vf_handle_t hVFhandle, ///< [in] Sysman handle for the component. + zes_vf_info_util_exp_flags_t flag, ///< [in] utilization flags to set sampling interval. May be 0 or a valid + ///< combination of ::zes_vf_info_util_exp_flag_t. + uint64_t samplingInterval ///< [in] Sampling interval value. + ) +{ + if(ze_lib::context->inTeardown) { + return ZE_RESULT_ERROR_UNINITIALIZED; + } + + auto pfnSetVFTelemetrySamplingIntervalExp = ze_lib::context->zesDdiTable.load()->VFManagementExp.pfnSetVFTelemetrySamplingIntervalExp; + if( nullptr == pfnSetVFTelemetrySamplingIntervalExp ) { + if(!ze_lib::context->isInitialized) + return ZE_RESULT_ERROR_UNINITIALIZED; + else + return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; + } + + return pfnSetVFTelemetrySamplingIntervalExp( hVFhandle, flag, samplingInterval ); +} + /////////////////////////////////////////////////////////////////////////////// /// @brief Get handle of virtual function modules /// @@ -6219,7 +6498,7 @@ zesVFManagementGetVFCapabilitiesExp( /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pCount` ze_result_t ZE_APICALL -zesVFManagementGetVFMemoryUtilizationExp( +zesVFManagementGetVFMemoryUtilizationExp2( zes_vf_handle_t hVFhandle, ///< [in] Sysman handle for the component. uint32_t* pCount, ///< [in,out] Pointer to the number of VF memory stats descriptors. ///< - if count is zero, the driver shall update the value with the total @@ -6227,7 +6506,7 @@ zesVFManagementGetVFMemoryUtilizationExp( ///< - if count is greater than the total number of memory stats ///< available, the driver shall update the value with the correct number ///< of memory stats available. - zes_vf_util_mem_exp_t* pMemUtil ///< [in,out][optional][range(0, *pCount)] array of memory group activity counters. + zes_vf_util_mem_exp2_t* pMemUtil ///< [in,out][optional][range(0, *pCount)] array of memory group activity counters. ///< - if count is less than the total number of memory stats available, ///< then driver shall only retrieve that number of stats. ///< - the implementation shall populate the vector pCount-1 number of VF @@ -6238,15 +6517,15 @@ zesVFManagementGetVFMemoryUtilizationExp( return ZE_RESULT_ERROR_UNINITIALIZED; } - auto pfnGetVFMemoryUtilizationExp = ze_lib::context->zesDdiTable.load()->VFManagementExp.pfnGetVFMemoryUtilizationExp; - if( nullptr == pfnGetVFMemoryUtilizationExp ) { + auto pfnGetVFMemoryUtilizationExp2 = ze_lib::context->zesDdiTable.load()->VFManagement.pfnGetVFMemoryUtilizationExp2; + if( nullptr == pfnGetVFMemoryUtilizationExp2 ) { if(!ze_lib::context->isInitialized) return ZE_RESULT_ERROR_UNINITIALIZED; else return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } - return pfnGetVFMemoryUtilizationExp( hVFhandle, pCount, pMemUtil ); + return pfnGetVFMemoryUtilizationExp2( hVFhandle, pCount, pMemUtil ); } /////////////////////////////////////////////////////////////////////////////// @@ -6269,7 +6548,7 @@ zesVFManagementGetVFMemoryUtilizationExp( /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pCount` ze_result_t ZE_APICALL -zesVFManagementGetVFEngineUtilizationExp( +zesVFManagementGetVFEngineUtilizationExp2( zes_vf_handle_t hVFhandle, ///< [in] Sysman handle for the component. uint32_t* pCount, ///< [in,out] Pointer to the number of VF engine stats descriptors. ///< - if count is zero, the driver shall update the value with the total @@ -6277,7 +6556,7 @@ zesVFManagementGetVFEngineUtilizationExp( ///< - if count is greater than the total number of engine stats ///< available, the driver shall update the value with the correct number ///< of engine stats available. - zes_vf_util_engine_exp_t* pEngineUtil ///< [in,out][optional][range(0, *pCount)] array of engine group activity counters. + zes_vf_util_engine_exp2_t* pEngineUtil ///< [in,out][optional][range(0, *pCount)] array of engine group activity counters. ///< - if count is less than the total number of engine stats available, ///< then driver shall only retrieve that number of stats. ///< - the implementation shall populate the vector pCount-1 number of VF @@ -6288,15 +6567,15 @@ zesVFManagementGetVFEngineUtilizationExp( return ZE_RESULT_ERROR_UNINITIALIZED; } - auto pfnGetVFEngineUtilizationExp = ze_lib::context->zesDdiTable.load()->VFManagementExp.pfnGetVFEngineUtilizationExp; - if( nullptr == pfnGetVFEngineUtilizationExp ) { + auto pfnGetVFEngineUtilizationExp2 = ze_lib::context->zesDdiTable.load()->VFManagement.pfnGetVFEngineUtilizationExp2; + if( nullptr == pfnGetVFEngineUtilizationExp2 ) { if(!ze_lib::context->isInitialized) return ZE_RESULT_ERROR_UNINITIALIZED; else return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } - return pfnGetVFEngineUtilizationExp( hVFhandle, pCount, pEngineUtil ); + return pfnGetVFEngineUtilizationExp2( hVFhandle, pCount, pEngineUtil ); } } // extern "C" diff --git a/source/lib/zes_libddi.cpp b/source/lib/zes_libddi.cpp index 48bad20a..8e5b961a 100644 --- a/source/lib/zes_libddi.cpp +++ b/source/lib/zes_libddi.cpp @@ -182,6 +182,13 @@ namespace ze_lib result = getTable( ZE_API_VERSION_CURRENT, &initialzesDdiTable.Temperature ); } + if( ZE_RESULT_SUCCESS == result ) + { + auto getTable = reinterpret_cast( + GET_FUNCTION_PTR(loader, "zesGetVFManagementProcAddrTable") ); + result = getTable( ZE_API_VERSION_CURRENT, &initialzesDdiTable.VFManagement ); + } + if( ZE_RESULT_SUCCESS == result ) { auto getTable = reinterpret_cast( @@ -311,6 +318,11 @@ namespace ze_lib result = zesGetTemperatureProcAddrTable( ZE_API_VERSION_CURRENT, &initialzesDdiTable.Temperature ); } + if( ZE_RESULT_SUCCESS == result ) + { + result = zesGetVFManagementProcAddrTable( ZE_API_VERSION_CURRENT, &initialzesDdiTable.VFManagement ); + } + if( ZE_RESULT_SUCCESS == result ) { result = zesGetVFManagementExpProcAddrTable( ZE_API_VERSION_CURRENT, &initialzesDdiTable.VFManagementExp ); diff --git a/source/lib/zet_libapi.cpp b/source/lib/zet_libapi.cpp index 8a3308c8..501d0dfc 100644 --- a/source/lib/zet_libapi.cpp +++ b/source/lib/zet_libapi.cpp @@ -2576,7 +2576,7 @@ zetMetricProgrammableGetParamValueInfoExp( /// + `nullptr == pDescription` /// + `nullptr == pMetricHandleCount` ze_result_t ZE_APICALL -zetMetricCreateFromProgrammableExp( +zetMetricCreateFromProgrammableExp2( zet_metric_programmable_exp_handle_t hMetricProgrammable, ///< [in] handle of the metric programmable uint32_t parameterCount, ///< [in] Count of parameters to set. zet_metric_programmable_param_value_exp_t* pParameterValues,///< [in] list of parameter values to be set. @@ -2600,6 +2600,63 @@ zetMetricCreateFromProgrammableExp( return ZE_RESULT_ERROR_UNINITIALIZED; } + auto pfnCreateFromProgrammableExp2 = ze_lib::context->zetDdiTable.load()->Metric.pfnCreateFromProgrammableExp2; + if( nullptr == pfnCreateFromProgrammableExp2 ) { + if(!ze_lib::context->isInitialized) + return ZE_RESULT_ERROR_UNINITIALIZED; + else + return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; + } + + return pfnCreateFromProgrammableExp2( hMetricProgrammable, parameterCount, pParameterValues, pName, pDescription, pMetricHandleCount, phMetricHandles ); +} + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Create metric handles by applying parameter values on the metric +/// programmable handle. +/// +/// @details +/// - This API is deprecated. Please use +/// ::zetMetricCreateFromProgrammableExp2() +/// +/// @returns +/// - ::ZE_RESULT_SUCCESS +/// - ::ZE_RESULT_ERROR_UNINITIALIZED +/// - ::ZE_RESULT_ERROR_DEVICE_LOST +/// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY +/// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY +/// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `nullptr == hMetricProgrammable` +/// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER +/// + `nullptr == pParameterValues` +/// + `nullptr == pName` +/// + `nullptr == pDescription` +/// + `nullptr == pMetricHandleCount` +ze_result_t ZE_APICALL +zetMetricCreateFromProgrammableExp( + zet_metric_programmable_exp_handle_t hMetricProgrammable, ///< [in] handle of the metric programmable + zet_metric_programmable_param_value_exp_t* pParameterValues,///< [in] list of parameter values to be set. + uint32_t parameterCount, ///< [in] Count of parameters to set. + const char* pName, ///< [in] pointer to metric name to be used. Must point to a + ///< null-terminated character array no longer than ::ZET_MAX_METRIC_NAME. + const char* pDescription, ///< [in] pointer to metric description to be used. Must point to a + ///< null-terminated character array no longer than + ///< ::ZET_MAX_METRIC_DESCRIPTION. + uint32_t* pMetricHandleCount, ///< [in,out] Pointer to the number of metric handles. + ///< if count is zero, then the driver shall update the value with the + ///< number of metric handles available for this programmable. + ///< if count is greater than the number of metric handles available, then + ///< the driver shall update the value with the correct number of metric + ///< handles available. + zet_metric_handle_t* phMetricHandles ///< [in,out][optional][range(0,*pMetricHandleCount)] array of handle of metrics. + ///< if count is less than the number of metrics available, then driver + ///< shall only retrieve that number of metric handles. + ) +{ + if(ze_lib::context->inTeardown) { + return ZE_RESULT_ERROR_UNINITIALIZED; + } + auto pfnCreateFromProgrammableExp = ze_lib::context->zetDdiTable.load()->MetricExp.pfnCreateFromProgrammableExp; if( nullptr == pfnCreateFromProgrammableExp ) { if(!ze_lib::context->isInitialized) @@ -2608,7 +2665,7 @@ zetMetricCreateFromProgrammableExp( return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } - return pfnCreateFromProgrammableExp( hMetricProgrammable, parameterCount, pParameterValues, pName, pDescription, pMetricHandleCount, phMetricHandles ); + return pfnCreateFromProgrammableExp( hMetricProgrammable, pParameterValues, parameterCount, pName, pDescription, pMetricHandleCount, phMetricHandles ); } /////////////////////////////////////////////////////////////////////////////// @@ -2616,7 +2673,7 @@ zetMetricCreateFromProgrammableExp( /// /// @details /// - Creates multiple metric groups from metrics which were created using -/// ::zetMetricCreateFromProgrammableExp(). +/// ::zetMetricCreateFromProgrammableExp2(). /// - Metrics whose Hardware resources do not overlap are added to same /// metric group. /// - The metric groups created using this API are managed by the @@ -2673,6 +2730,54 @@ zetDeviceCreateMetricGroupsFromMetricsExp( return pfnCreateMetricGroupsFromMetricsExp( hDevice, metricCount, phMetrics, pMetricGroupNamePrefix, pDescription, pMetricGroupCount, phMetricGroup ); } +/////////////////////////////////////////////////////////////////////////////// +/// @brief Create metric group handle. +/// +/// @details +/// - This API is deprecated. Please use +/// ::zetCreateMetricGroupsFromMetricsExp() +/// +/// @returns +/// - ::ZE_RESULT_SUCCESS +/// - ::ZE_RESULT_ERROR_UNINITIALIZED +/// - ::ZE_RESULT_ERROR_DEVICE_LOST +/// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY +/// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY +/// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `nullptr == hDevice` +/// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER +/// + `nullptr == pName` +/// + `nullptr == pDescription` +/// + `nullptr == phMetricGroup` +/// - ::ZE_RESULT_ERROR_INVALID_ENUMERATION +/// + `0x7 < samplingType` +ze_result_t ZE_APICALL +zetMetricGroupCreateExp( + zet_device_handle_t hDevice, ///< [in] handle of the device + const char* pName, ///< [in] pointer to metric group name. Must point to a null-terminated + ///< character array no longer than ::ZET_MAX_METRIC_GROUP_NAME. + const char* pDescription, ///< [in] pointer to metric group description. Must point to a + ///< null-terminated character array no longer than + ///< ::ZET_MAX_METRIC_GROUP_DESCRIPTION. + zet_metric_group_sampling_type_flags_t samplingType,///< [in] Sampling type for the metric group. + zet_metric_group_handle_t* phMetricGroup ///< [in,out] Created Metric group handle + ) +{ + if(ze_lib::context->inTeardown) { + return ZE_RESULT_ERROR_UNINITIALIZED; + } + + auto pfnCreateExp = ze_lib::context->zetDdiTable.load()->MetricGroupExp.pfnCreateExp; + if( nullptr == pfnCreateExp ) { + if(!ze_lib::context->isInitialized) + return ZE_RESULT_ERROR_UNINITIALIZED; + else + return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; + } + + return pfnCreateExp( hDevice, pName, pDescription, samplingType, phMetricGroup ); +} + /////////////////////////////////////////////////////////////////////////////// /// @brief Add a metric handle to the metric group handle created using /// ::zetMetricGroupCreateExp. @@ -2825,11 +2930,11 @@ zetMetricGroupCloseExp( /// @brief Destroy a metric group created using ::zetMetricGroupCreateExp. /// /// @details -/// - Metric handles created using ::zetMetricCreateFromProgrammableExp and +/// - Metric handles created using ::zetMetricCreateFromProgrammableExp2 and /// are part of the metricGroup are not destroyed. /// - It is necessary to call ::zetMetricDestroyExp for each of the metric -/// handles (created from ::zetMetricCreateFromProgrammableExp) to destroy -/// them. +/// handles (created from ::zetMetricCreateFromProgrammableExp2) to +/// destroy them. /// /// @returns /// - ::ZE_RESULT_SUCCESS @@ -2864,7 +2969,7 @@ zetMetricGroupDestroyExp( } /////////////////////////////////////////////////////////////////////////////// -/// @brief Destroy a metric created using ::zetMetricCreateFromProgrammableExp. +/// @brief Destroy a metric created using ::zetMetricCreateFromProgrammableExp2. /// /// @details /// - If a metric is added to a metric group, the metric has to be removed diff --git a/source/loader/ze_ldrddi.cpp b/source/loader/ze_ldrddi.cpp index 9ac32587..e2e0b83d 100644 --- a/source/loader/ze_ldrddi.cpp +++ b/source/loader/ze_ldrddi.cpp @@ -134,11 +134,9 @@ namespace loader for( auto& drv : loader::context->zeDrivers ) { if (!drv.dditable.ze.Global.pfnInitDrivers) { - drv.initDriversStatus = ZE_RESULT_ERROR_UNINITIALIZED; + drv.initStatus = ZE_RESULT_ERROR_UNINITIALIZED; continue; } - if(drv.initDriversStatus != ZE_RESULT_SUCCESS) - continue; if( ( 0 < *pCount ) && ( *pCount == total_driver_handle_count)) break; @@ -149,7 +147,7 @@ namespace loader if( ZE_RESULT_SUCCESS != result ) { // If Get Drivers fails with Uninitialized, then update the driver init status to prevent reporting this driver in the next get call. if (ZE_RESULT_ERROR_UNINITIALIZED == result) { - drv.initDriversStatus = result; + drv.initStatus = result; } continue; } @@ -825,9 +823,9 @@ namespace loader zeDeviceGetGlobalTimestamps( ze_device_handle_t hDevice, ///< [in] handle of the device uint64_t* hostTimestamp, ///< [out] value of the Host's global timestamp that correlates with the - ///< Device's global timestamp value + ///< Device's global timestamp value. uint64_t* deviceTimestamp ///< [out] value of the Device's global timestamp that correlates with the - ///< Host's global timestamp value + ///< Host's global timestamp value. ) { ze_result_t result = ZE_RESULT_SUCCESS; @@ -4642,7 +4640,8 @@ namespace loader __zedlllocal ze_result_t ZE_APICALL zePhysicalMemCreate( ze_context_handle_t hContext, ///< [in] handle of the context object - ze_device_handle_t hDevice, ///< [in] handle of the device object + ze_device_handle_t hDevice, ///< [in] handle of the device object, can be `nullptr` if creating + ///< physical host memory. ze_physical_mem_desc_t* desc, ///< [in] pointer to physical memory descriptor. ze_physical_mem_handle_t* phPhysicalMemory ///< [out] pointer to handle of physical memory object created ) diff --git a/source/loader/zes_ldrddi.cpp b/source/loader/zes_ldrddi.cpp index bbc8862f..4ae26bef 100644 --- a/source/loader/zes_ldrddi.cpp +++ b/source/loader/zes_ldrddi.cpp @@ -4192,9 +4192,9 @@ namespace loader } /////////////////////////////////////////////////////////////////////////////// - /// @brief Intercept function for zesDeviceEnumEnabledVFExp + /// @brief Intercept function for zesDeviceEnumActiveVFExp __zedlllocal ze_result_t ZE_APICALL - zesDeviceEnumEnabledVFExp( + zesDeviceEnumActiveVFExp( zes_device_handle_t hDevice, ///< [in] Sysman handle of the device. uint32_t* pCount, ///< [in,out] pointer to the number of components of this type. ///< if count is zero, then the driver shall update the value with the @@ -4213,15 +4213,15 @@ namespace loader // extract driver's function pointer table auto dditable = reinterpret_cast( hDevice )->dditable; - auto pfnEnumEnabledVFExp = dditable->zes.DeviceExp.pfnEnumEnabledVFExp; - if( nullptr == pfnEnumEnabledVFExp ) + auto pfnEnumActiveVFExp = dditable->zes.DeviceExp.pfnEnumActiveVFExp; + if( nullptr == pfnEnumActiveVFExp ) return ZE_RESULT_ERROR_UNINITIALIZED; // convert loader handle to driver handle hDevice = reinterpret_cast( hDevice )->handle; // forward to device-driver - result = pfnEnumEnabledVFExp( hDevice, pCount, phVFhandle ); + result = pfnEnumActiveVFExp( hDevice, pCount, phVFhandle ); if( ZE_RESULT_SUCCESS != result ) return result; @@ -4242,26 +4242,26 @@ namespace loader } /////////////////////////////////////////////////////////////////////////////// - /// @brief Intercept function for zesVFManagementGetVFCapabilitiesExp + /// @brief Intercept function for zesVFManagementGetVFPropertiesExp __zedlllocal ze_result_t ZE_APICALL - zesVFManagementGetVFCapabilitiesExp( + zesVFManagementGetVFPropertiesExp( zes_vf_handle_t hVFhandle, ///< [in] Sysman handle for the VF component. - zes_vf_exp_capabilities_t* pCapability ///< [in,out] Will contain VF capability. + zes_vf_exp_properties_t* pProperties ///< [in,out] Will contain VF properties. ) { ze_result_t result = ZE_RESULT_SUCCESS; // extract driver's function pointer table auto dditable = reinterpret_cast( hVFhandle )->dditable; - auto pfnGetVFCapabilitiesExp = dditable->zes.VFManagementExp.pfnGetVFCapabilitiesExp; - if( nullptr == pfnGetVFCapabilitiesExp ) + auto pfnGetVFPropertiesExp = dditable->zes.VFManagementExp.pfnGetVFPropertiesExp; + if( nullptr == pfnGetVFPropertiesExp ) return ZE_RESULT_ERROR_UNINITIALIZED; // convert loader handle to driver handle hVFhandle = reinterpret_cast( hVFhandle )->handle; // forward to device-driver - result = pfnGetVFCapabilitiesExp( hVFhandle, pCapability ); + result = pfnGetVFPropertiesExp( hVFhandle, pProperties ); return result; } @@ -4277,6 +4277,8 @@ namespace loader ///< - if count is greater than the total number of memory stats ///< available, the driver shall update the value with the correct number ///< of memory stats available. + ///< - The count returned is the sum of number of VF instances currently + ///< available and the PF instance. zes_vf_util_mem_exp_t* pMemUtil ///< [in,out][optional][range(0, *pCount)] array of memory group activity counters. ///< - if count is less than the total number of memory stats available, ///< then driver shall only retrieve that number of stats. @@ -4312,6 +4314,8 @@ namespace loader ///< - if count is greater than the total number of engine stats ///< available, the driver shall update the value with the correct number ///< of engine stats available. + ///< - The count returned is the sum of number of VF instances currently + ///< available and the PF instance. zes_vf_util_engine_exp_t* pEngineUtil ///< [in,out][optional][range(0, *pCount)] array of engine group activity counters. ///< - if count is less than the total number of engine stats available, ///< then driver shall only retrieve that number of stats. @@ -4336,6 +4340,205 @@ namespace loader return result; } + /////////////////////////////////////////////////////////////////////////////// + /// @brief Intercept function for zesVFManagementSetVFTelemetryModeExp + __zedlllocal ze_result_t ZE_APICALL + zesVFManagementSetVFTelemetryModeExp( + zes_vf_handle_t hVFhandle, ///< [in] Sysman handle for the component. + zes_vf_info_util_exp_flags_t flags, ///< [in] utilization flags to enable or disable. May be 0 or a valid + ///< combination of ::zes_vf_info_util_exp_flag_t. + ze_bool_t enable ///< [in] Enable utilization telemetry. + ) + { + ze_result_t result = ZE_RESULT_SUCCESS; + + // extract driver's function pointer table + auto dditable = reinterpret_cast( hVFhandle )->dditable; + auto pfnSetVFTelemetryModeExp = dditable->zes.VFManagementExp.pfnSetVFTelemetryModeExp; + if( nullptr == pfnSetVFTelemetryModeExp ) + return ZE_RESULT_ERROR_UNINITIALIZED; + + // convert loader handle to driver handle + hVFhandle = reinterpret_cast( hVFhandle )->handle; + + // forward to device-driver + result = pfnSetVFTelemetryModeExp( hVFhandle, flags, enable ); + + return result; + } + + /////////////////////////////////////////////////////////////////////////////// + /// @brief Intercept function for zesVFManagementSetVFTelemetrySamplingIntervalExp + __zedlllocal ze_result_t ZE_APICALL + zesVFManagementSetVFTelemetrySamplingIntervalExp( + zes_vf_handle_t hVFhandle, ///< [in] Sysman handle for the component. + zes_vf_info_util_exp_flags_t flag, ///< [in] utilization flags to set sampling interval. May be 0 or a valid + ///< combination of ::zes_vf_info_util_exp_flag_t. + uint64_t samplingInterval ///< [in] Sampling interval value. + ) + { + ze_result_t result = ZE_RESULT_SUCCESS; + + // extract driver's function pointer table + auto dditable = reinterpret_cast( hVFhandle )->dditable; + auto pfnSetVFTelemetrySamplingIntervalExp = dditable->zes.VFManagementExp.pfnSetVFTelemetrySamplingIntervalExp; + if( nullptr == pfnSetVFTelemetrySamplingIntervalExp ) + return ZE_RESULT_ERROR_UNINITIALIZED; + + // convert loader handle to driver handle + hVFhandle = reinterpret_cast( hVFhandle )->handle; + + // forward to device-driver + result = pfnSetVFTelemetrySamplingIntervalExp( hVFhandle, flag, samplingInterval ); + + return result; + } + + /////////////////////////////////////////////////////////////////////////////// + /// @brief Intercept function for zesDeviceEnumEnabledVFExp + __zedlllocal ze_result_t ZE_APICALL + zesDeviceEnumEnabledVFExp( + zes_device_handle_t hDevice, ///< [in] Sysman handle of the device. + uint32_t* pCount, ///< [in,out] pointer to the number of components of this type. + ///< if count is zero, then the driver shall update the value with the + ///< total number of components of this type that are available. + ///< if count is greater than the number of components of this type that + ///< are available, then the driver shall update the value with the correct + ///< number of components. + zes_vf_handle_t* phVFhandle ///< [in,out][optional][range(0, *pCount)] array of handle of components of + ///< this type. + ///< if count is less than the number of components of this type that are + ///< available, then the driver shall only retrieve that number of + ///< component handles. + ) + { + ze_result_t result = ZE_RESULT_SUCCESS; + + // extract driver's function pointer table + auto dditable = reinterpret_cast( hDevice )->dditable; + auto pfnEnumEnabledVFExp = dditable->zes.DeviceExp.pfnEnumEnabledVFExp; + if( nullptr == pfnEnumEnabledVFExp ) + return ZE_RESULT_ERROR_UNINITIALIZED; + + // convert loader handle to driver handle + hDevice = reinterpret_cast( hDevice )->handle; + + // forward to device-driver + result = pfnEnumEnabledVFExp( hDevice, pCount, phVFhandle ); + + if( ZE_RESULT_SUCCESS != result ) + return result; + + try + { + // convert driver handles to loader handles + for( size_t i = 0; ( nullptr != phVFhandle ) && ( i < *pCount ); ++i ) + phVFhandle[ i ] = reinterpret_cast( + context->zes_vf_factory.getInstance( phVFhandle[ i ], dditable ) ); + } + catch( std::bad_alloc& ) + { + result = ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY; + } + + return result; + } + + /////////////////////////////////////////////////////////////////////////////// + /// @brief Intercept function for zesVFManagementGetVFCapabilitiesExp + __zedlllocal ze_result_t ZE_APICALL + zesVFManagementGetVFCapabilitiesExp( + zes_vf_handle_t hVFhandle, ///< [in] Sysman handle for the VF component. + zes_vf_exp_capabilities_t* pCapability ///< [in,out] Will contain VF capability. + ) + { + ze_result_t result = ZE_RESULT_SUCCESS; + + // extract driver's function pointer table + auto dditable = reinterpret_cast( hVFhandle )->dditable; + auto pfnGetVFCapabilitiesExp = dditable->zes.VFManagementExp.pfnGetVFCapabilitiesExp; + if( nullptr == pfnGetVFCapabilitiesExp ) + return ZE_RESULT_ERROR_UNINITIALIZED; + + // convert loader handle to driver handle + hVFhandle = reinterpret_cast( hVFhandle )->handle; + + // forward to device-driver + result = pfnGetVFCapabilitiesExp( hVFhandle, pCapability ); + + return result; + } + + /////////////////////////////////////////////////////////////////////////////// + /// @brief Intercept function for zesVFManagementGetVFMemoryUtilizationExp2 + __zedlllocal ze_result_t ZE_APICALL + zesVFManagementGetVFMemoryUtilizationExp2( + zes_vf_handle_t hVFhandle, ///< [in] Sysman handle for the component. + uint32_t* pCount, ///< [in,out] Pointer to the number of VF memory stats descriptors. + ///< - if count is zero, the driver shall update the value with the total + ///< number of memory stats available. + ///< - if count is greater than the total number of memory stats + ///< available, the driver shall update the value with the correct number + ///< of memory stats available. + zes_vf_util_mem_exp2_t* pMemUtil ///< [in,out][optional][range(0, *pCount)] array of memory group activity counters. + ///< - if count is less than the total number of memory stats available, + ///< then driver shall only retrieve that number of stats. + ///< - the implementation shall populate the vector pCount-1 number of VF + ///< memory stats. + ) + { + ze_result_t result = ZE_RESULT_SUCCESS; + + // extract driver's function pointer table + auto dditable = reinterpret_cast( hVFhandle )->dditable; + auto pfnGetVFMemoryUtilizationExp2 = dditable->zes.VFManagement.pfnGetVFMemoryUtilizationExp2; + if( nullptr == pfnGetVFMemoryUtilizationExp2 ) + return ZE_RESULT_ERROR_UNINITIALIZED; + + // convert loader handle to driver handle + hVFhandle = reinterpret_cast( hVFhandle )->handle; + + // forward to device-driver + result = pfnGetVFMemoryUtilizationExp2( hVFhandle, pCount, pMemUtil ); + + return result; + } + + /////////////////////////////////////////////////////////////////////////////// + /// @brief Intercept function for zesVFManagementGetVFEngineUtilizationExp2 + __zedlllocal ze_result_t ZE_APICALL + zesVFManagementGetVFEngineUtilizationExp2( + zes_vf_handle_t hVFhandle, ///< [in] Sysman handle for the component. + uint32_t* pCount, ///< [in,out] Pointer to the number of VF engine stats descriptors. + ///< - if count is zero, the driver shall update the value with the total + ///< number of engine stats available. + ///< - if count is greater than the total number of engine stats + ///< available, the driver shall update the value with the correct number + ///< of engine stats available. + zes_vf_util_engine_exp2_t* pEngineUtil ///< [in,out][optional][range(0, *pCount)] array of engine group activity counters. + ///< - if count is less than the total number of engine stats available, + ///< then driver shall only retrieve that number of stats. + ///< - the implementation shall populate the vector pCount-1 number of VF + ///< engine stats. + ) + { + ze_result_t result = ZE_RESULT_SUCCESS; + + // extract driver's function pointer table + auto dditable = reinterpret_cast( hVFhandle )->dditable; + auto pfnGetVFEngineUtilizationExp2 = dditable->zes.VFManagement.pfnGetVFEngineUtilizationExp2; + if( nullptr == pfnGetVFEngineUtilizationExp2 ) + return ZE_RESULT_ERROR_UNINITIALIZED; + + // convert loader handle to driver handle + hVFhandle = reinterpret_cast( hVFhandle )->handle; + + // forward to device-driver + result = pfnGetVFEngineUtilizationExp2( hVFhandle, pCount, pEngineUtil ); + + return result; + } + } // namespace loader #if defined(__cplusplus) @@ -4579,8 +4782,9 @@ zesGetDeviceExpProcAddrTable( if( ( loader::context->sysmanInstanceDrivers->size() > 1 ) || loader::context->forceIntercept ) { // return pointers to loader's DDIs - pDdiTable->pfnGetSubDevicePropertiesExp = loader::zesDeviceGetSubDevicePropertiesExp; pDdiTable->pfnEnumEnabledVFExp = loader::zesDeviceEnumEnabledVFExp; + pDdiTable->pfnGetSubDevicePropertiesExp = loader::zesDeviceGetSubDevicePropertiesExp; + pDdiTable->pfnEnumActiveVFExp = loader::zesDeviceEnumActiveVFExp; } else { @@ -6178,6 +6382,83 @@ zesGetTemperatureProcAddrTable( return result; } +/////////////////////////////////////////////////////////////////////////////// +/// @brief Exported function for filling application's VFManagement table +/// with current process' addresses +/// +/// @returns +/// - ::ZE_RESULT_SUCCESS +/// - ::ZE_RESULT_ERROR_UNINITIALIZED +/// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER +/// - ::ZE_RESULT_ERROR_UNSUPPORTED_VERSION +ZE_DLLEXPORT ze_result_t ZE_APICALL +zesGetVFManagementProcAddrTable( + ze_api_version_t version, ///< [in] API version requested + zes_vf_management_dditable_t* pDdiTable ///< [in,out] pointer to table of DDI function pointers + ) +{ + if( loader::context->sysmanInstanceDrivers->size() < 1 ) + + return ZE_RESULT_ERROR_UNINITIALIZED; + + if( nullptr == pDdiTable ) + return ZE_RESULT_ERROR_INVALID_NULL_POINTER; + + if( loader::context->version < version ) + return ZE_RESULT_ERROR_UNSUPPORTED_VERSION; + + ze_result_t result = ZE_RESULT_SUCCESS; + + bool atLeastOneDriverValid = false; + // Load the device-driver DDI tables + for( auto& drv : *loader::context->sysmanInstanceDrivers ) + { + if(drv.initStatus != ZE_RESULT_SUCCESS) + continue; + auto getTable = reinterpret_cast( + GET_FUNCTION_PTR( drv.handle, "zesGetVFManagementProcAddrTable") ); + if(!getTable) + continue; + auto getTableResult = getTable( version, &drv.dditable.zes.VFManagement); + if(getTableResult == ZE_RESULT_SUCCESS) + atLeastOneDriverValid = true; + else + drv.initStatus = getTableResult; + } + + if(!atLeastOneDriverValid) + result = ZE_RESULT_ERROR_UNINITIALIZED; + else + result = ZE_RESULT_SUCCESS; + + if( ZE_RESULT_SUCCESS == result ) + { + if( ( loader::context->sysmanInstanceDrivers->size() > 1 ) || loader::context->forceIntercept ) + { + // return pointers to loader's DDIs + pDdiTable->pfnGetVFMemoryUtilizationExp2 = loader::zesVFManagementGetVFMemoryUtilizationExp2; + pDdiTable->pfnGetVFEngineUtilizationExp2 = loader::zesVFManagementGetVFEngineUtilizationExp2; + } + else + { + // return pointers directly to driver's DDIs + *pDdiTable = loader::context->sysmanInstanceDrivers->front().dditable.zes.VFManagement; + } + } + + // If the validation layer is enabled, then intercept the loader's DDIs + if(( ZE_RESULT_SUCCESS == result ) && ( nullptr != loader::context->validationLayer )) + { + auto getTable = reinterpret_cast( + GET_FUNCTION_PTR(loader::context->validationLayer, "zesGetVFManagementProcAddrTable") ); + if(!getTable) + return ZE_RESULT_ERROR_UNINITIALIZED; + result = getTable( version, pDdiTable ); + } + + return result; +} + /////////////////////////////////////////////////////////////////////////////// /// @brief Exported function for filling application's VFManagementExp table /// with current process' addresses @@ -6224,8 +6505,11 @@ zesGetVFManagementExpProcAddrTable( { // return pointers to loader's DDIs pDdiTable->pfnGetVFCapabilitiesExp = loader::zesVFManagementGetVFCapabilitiesExp; + pDdiTable->pfnGetVFPropertiesExp = loader::zesVFManagementGetVFPropertiesExp; pDdiTable->pfnGetVFMemoryUtilizationExp = loader::zesVFManagementGetVFMemoryUtilizationExp; pDdiTable->pfnGetVFEngineUtilizationExp = loader::zesVFManagementGetVFEngineUtilizationExp; + pDdiTable->pfnSetVFTelemetryModeExp = loader::zesVFManagementSetVFTelemetryModeExp; + pDdiTable->pfnSetVFTelemetrySamplingIntervalExp = loader::zesVFManagementSetVFTelemetrySamplingIntervalExp; } else { diff --git a/source/loader/zet_ldrddi.cpp b/source/loader/zet_ldrddi.cpp index b97d8f51..8f3973a5 100644 --- a/source/loader/zet_ldrddi.cpp +++ b/source/loader/zet_ldrddi.cpp @@ -1944,13 +1944,68 @@ namespace loader return result; } + /////////////////////////////////////////////////////////////////////////////// + /// @brief Intercept function for zetMetricCreateFromProgrammableExp2 + __zedlllocal ze_result_t ZE_APICALL + zetMetricCreateFromProgrammableExp2( + zet_metric_programmable_exp_handle_t hMetricProgrammable, ///< [in] handle of the metric programmable + uint32_t parameterCount, ///< [in] Count of parameters to set. + zet_metric_programmable_param_value_exp_t* pParameterValues,///< [in] list of parameter values to be set. + const char* pName, ///< [in] pointer to metric name to be used. Must point to a + ///< null-terminated character array no longer than ::ZET_MAX_METRIC_NAME. + const char* pDescription, ///< [in] pointer to metric description to be used. Must point to a + ///< null-terminated character array no longer than + ///< ::ZET_MAX_METRIC_DESCRIPTION. + uint32_t* pMetricHandleCount, ///< [in,out] Pointer to the number of metric handles. + ///< if count is zero, then the driver shall update the value with the + ///< number of metric handles available for this programmable. + ///< if count is greater than the number of metric handles available, then + ///< the driver shall update the value with the correct number of metric + ///< handles available. + zet_metric_handle_t* phMetricHandles ///< [in,out][optional][range(0,*pMetricHandleCount)] array of handle of metrics. + ///< if count is less than the number of metrics available, then driver + ///< shall only retrieve that number of metric handles. + ) + { + ze_result_t result = ZE_RESULT_SUCCESS; + + // extract driver's function pointer table + auto dditable = reinterpret_cast( hMetricProgrammable )->dditable; + auto pfnCreateFromProgrammableExp2 = dditable->zet.Metric.pfnCreateFromProgrammableExp2; + if( nullptr == pfnCreateFromProgrammableExp2 ) + return ZE_RESULT_ERROR_UNINITIALIZED; + + // convert loader handle to driver handle + hMetricProgrammable = reinterpret_cast( hMetricProgrammable )->handle; + + // forward to device-driver + result = pfnCreateFromProgrammableExp2( hMetricProgrammable, parameterCount, pParameterValues, pName, pDescription, pMetricHandleCount, phMetricHandles ); + + if( ZE_RESULT_SUCCESS != result ) + return result; + + try + { + // convert driver handles to loader handles + for( size_t i = 0; ( nullptr != phMetricHandles ) && ( i < *pMetricHandleCount ); ++i ) + phMetricHandles[ i ] = reinterpret_cast( + context->zet_metric_factory.getInstance( phMetricHandles[ i ], dditable ) ); + } + catch( std::bad_alloc& ) + { + result = ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY; + } + + return result; + } + /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zetMetricCreateFromProgrammableExp __zedlllocal ze_result_t ZE_APICALL zetMetricCreateFromProgrammableExp( zet_metric_programmable_exp_handle_t hMetricProgrammable, ///< [in] handle of the metric programmable - uint32_t parameterCount, ///< [in] Count of parameters to set. zet_metric_programmable_param_value_exp_t* pParameterValues,///< [in] list of parameter values to be set. + uint32_t parameterCount, ///< [in] Count of parameters to set. const char* pName, ///< [in] pointer to metric name to be used. Must point to a ///< null-terminated character array no longer than ::ZET_MAX_METRIC_NAME. const char* pDescription, ///< [in] pointer to metric description to be used. Must point to a @@ -1979,7 +2034,7 @@ namespace loader hMetricProgrammable = reinterpret_cast( hMetricProgrammable )->handle; // forward to device-driver - result = pfnCreateFromProgrammableExp( hMetricProgrammable, parameterCount, pParameterValues, pName, pDescription, pMetricHandleCount, phMetricHandles ); + result = pfnCreateFromProgrammableExp( hMetricProgrammable, pParameterValues, parameterCount, pName, pDescription, pMetricHandleCount, phMetricHandles ); if( ZE_RESULT_SUCCESS != result ) return result; @@ -2057,6 +2112,51 @@ namespace loader return result; } + /////////////////////////////////////////////////////////////////////////////// + /// @brief Intercept function for zetMetricGroupCreateExp + __zedlllocal ze_result_t ZE_APICALL + zetMetricGroupCreateExp( + zet_device_handle_t hDevice, ///< [in] handle of the device + const char* pName, ///< [in] pointer to metric group name. Must point to a null-terminated + ///< character array no longer than ::ZET_MAX_METRIC_GROUP_NAME. + const char* pDescription, ///< [in] pointer to metric group description. Must point to a + ///< null-terminated character array no longer than + ///< ::ZET_MAX_METRIC_GROUP_DESCRIPTION. + zet_metric_group_sampling_type_flags_t samplingType,///< [in] Sampling type for the metric group. + zet_metric_group_handle_t* phMetricGroup ///< [in,out] Created Metric group handle + ) + { + ze_result_t result = ZE_RESULT_SUCCESS; + + // extract driver's function pointer table + auto dditable = reinterpret_cast( hDevice )->dditable; + auto pfnCreateExp = dditable->zet.MetricGroupExp.pfnCreateExp; + if( nullptr == pfnCreateExp ) + return ZE_RESULT_ERROR_UNINITIALIZED; + + // convert loader handle to driver handle + hDevice = reinterpret_cast( hDevice )->handle; + + // forward to device-driver + result = pfnCreateExp( hDevice, pName, pDescription, samplingType, phMetricGroup ); + + if( ZE_RESULT_SUCCESS != result ) + return result; + + try + { + // convert driver handle to loader handle + *phMetricGroup = reinterpret_cast( + context->zet_metric_group_factory.getInstance( *phMetricGroup, dditable ) ); + } + catch( std::bad_alloc& ) + { + result = ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY; + } + + return result; + } + /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zetMetricGroupAddMetricExp __zedlllocal ze_result_t ZE_APICALL @@ -3003,6 +3103,7 @@ zetGetMetricProcAddrTable( // return pointers to loader's DDIs pDdiTable->pfnGet = loader::zetMetricGet; pDdiTable->pfnGetProperties = loader::zetMetricGetProperties; + pDdiTable->pfnCreateFromProgrammableExp2 = loader::zetMetricCreateFromProgrammableExp2; } else { @@ -3215,6 +3316,7 @@ zetGetMetricGroupExpProcAddrTable( if( ( loader::context->zeDrivers.size() > 1 ) || loader::context->forceIntercept ) { // return pointers to loader's DDIs + pDdiTable->pfnCreateExp = loader::zetMetricGroupCreateExp; pDdiTable->pfnCalculateMultipleMetricValuesExp = loader::zetMetricGroupCalculateMultipleMetricValuesExp; pDdiTable->pfnGetGlobalTimestampsExp = loader::zetMetricGroupGetGlobalTimestampsExp; pDdiTable->pfnGetExportDataExp = loader::zetMetricGroupGetExportDataExp;