From 1b7a26996e4c099cd89b58ec77ec940b283b26bf Mon Sep 17 00:00:00 2001 From: Matias Cabral Date: Fri, 1 Aug 2025 18:57:26 +0000 Subject: [PATCH] refactor: renaming of metrics calcOp related structures Resolves: NEO-15139 Signed-off-by: Matias Cabral --- .../driver_experimental/public/zex_metric.cpp | 74 +-- .../api/tools/zet_metric_api_entrypoints.h | 6 +- .../driver/driver_handle_imp_helper.cpp | 2 +- .../driver/extension_function_address.cpp | 8 +- level_zero/include/level_zero/ze_stypes.h | 7 +- .../include/level_zero/zet_intel_gpu_metric.h | 458 +++++++++--------- level_zero/tools/source/metrics/metric.cpp | 64 +-- level_zero/tools/source/metrics/metric.h | 34 +- .../metrics/metric_device_context_create.cpp | 2 +- .../metrics/metric_ip_sampling_source.cpp | 10 +- .../metrics/metric_ip_sampling_source.h | 4 +- .../metrics/metric_ip_sampling_streamer.cpp | 16 +- .../metrics/metric_ip_sampling_streamer.h | 4 +- .../tools/source/metrics/metric_oa_source.cpp | 4 +- .../tools/source/metrics/metric_oa_source.h | 4 +- .../sources/metrics/mock_metric_source.h | 4 +- .../sources/metrics/test_metric.cpp | 128 ++--- .../test_metric_ip_sampling_enumeration.cpp | 2 +- .../test_metric_ip_sampling_streamer.cpp | 258 +++++----- .../metrics/test_metric_oa_enumeration_1.cpp | 18 +- 20 files changed, 550 insertions(+), 557 deletions(-) diff --git a/level_zero/api/driver_experimental/public/zex_metric.cpp b/level_zero/api/driver_experimental/public/zex_metric.cpp index 02a6bc06e9..68f33eb1bf 100644 --- a/level_zero/api/driver_experimental/public/zex_metric.cpp +++ b/level_zero/api/driver_experimental/public/zex_metric.cpp @@ -78,50 +78,50 @@ ze_result_t ZE_APICALL zetIntelMetricTracerDecodeExp(zet_intel_metric_decoder_ex pSetCount, pMetricEntriesCountPerSet, pMetricEntriesCount, pMetricEntries); } -ze_result_t ZE_APICALL zetIntelMetricCalculateOperationCreateExp(zet_context_handle_t hContext, zet_device_handle_t hDevice, - zet_intel_metric_calculate_exp_desc_t *pCalculateDesc, - zet_intel_metric_calculate_operation_exp_handle_t *phCalculateOperation) { - return L0::metricCalculateOperationCreate(hContext, hDevice, pCalculateDesc, phCalculateOperation); +ze_result_t ZE_APICALL zetIntelMetricCalculationOperationCreateExp(zet_context_handle_t hContext, zet_device_handle_t hDevice, + zet_intel_metric_calculation_exp_desc_t *pCalculationDesc, + zet_intel_metric_calculation_operation_exp_handle_t *phCalculationOperation) { + return L0::metricCalculationOperationCreate(hContext, hDevice, pCalculationDesc, phCalculationOperation); } -ze_result_t ZE_APICALL zetIntelMetricCalculateOperationDestroyExp(zet_intel_metric_calculate_operation_exp_handle_t hCalculateOperation) { - return L0::metricCalculateOperationDestroy(hCalculateOperation); +ze_result_t ZE_APICALL zetIntelMetricCalculationOperationDestroyExp(zet_intel_metric_calculation_operation_exp_handle_t hCalculationOperation) { + return L0::metricCalculationOperationDestroy(hCalculationOperation); } -ze_result_t ZE_APICALL zetIntelMetricCalculateOperationGetReportFormatExp( - zet_intel_metric_calculate_operation_exp_handle_t hCalculateOperation, +ze_result_t ZE_APICALL zetIntelMetricCalculationOperationGetReportFormatExp( + zet_intel_metric_calculation_operation_exp_handle_t hCalculationOperation, uint32_t *pCount, zet_metric_handle_t *phMetrics) { - return L0::metricCalculateGetReportFormat(hCalculateOperation, pCount, phMetrics); + return L0::metricCalculationGetReportFormat(hCalculationOperation, pCount, phMetrics); } -ze_result_t ZE_APICALL zetIntelMetricCalculateOperationGetExcludedMetricsExp( - zet_intel_metric_calculate_operation_exp_handle_t hCalculateOperation, +ze_result_t ZE_APICALL zetIntelMetricCalculationOperationGetExcludedMetricsExp( + zet_intel_metric_calculation_operation_exp_handle_t hCalculationOperation, uint32_t *pCount, zet_metric_handle_t *phMetrics) { - return L0::metricCalculateGetExcludedMetrics(hCalculateOperation, pCount, phMetrics); + return L0::metricCalculationGetExcludedMetrics(hCalculationOperation, pCount, phMetrics); } ze_result_t ZE_APICALL zetIntelMetricCalculateValuesExp(const size_t rawDataSize, size_t *pOffset, const uint8_t *pRawData, - zet_intel_metric_calculate_operation_exp_handle_t hCalculateOperation, + zet_intel_metric_calculation_operation_exp_handle_t hCalculationOperation, uint32_t *pTotalMetricReportsCount, zet_intel_metric_result_exp_t *pMetricResults) { - return L0::metricCalculateValues(rawDataSize, pOffset, pRawData, hCalculateOperation, pTotalMetricReportsCount, pMetricResults); + return L0::metricCalculateValues(rawDataSize, pOffset, pRawData, hCalculationOperation, pTotalMetricReportsCount, pMetricResults); } ze_result_t ZE_APICALL zetIntelMetricCalculateMultipleValuesExp(const size_t rawDataSize, size_t *offset, const uint8_t *pRawData, - zet_intel_metric_calculate_operation_exp_handle_t hCalculateOperation, + zet_intel_metric_calculation_operation_exp_handle_t hCalculationOperation, uint32_t *pSetCount, uint32_t *pMetricsReportCountPerSet, uint32_t *pTotalMetricReportCount, zet_intel_metric_result_exp_t *pMetricResults) { - return metricCalculateMultipleValues(rawDataSize, offset, pRawData, hCalculateOperation, + return metricCalculateMultipleValues(rawDataSize, offset, pRawData, hCalculationOperation, pSetCount, pMetricsReportCountPerSet, pTotalMetricReportCount, pMetricResults); } ze_result_t ZE_APICALL zetIntelMetricDecodeCalculateMultipleValuesExp(zet_intel_metric_decoder_exp_handle_t hMetricDecoder, const size_t rawDataSize, size_t *offset, const uint8_t *pRawData, - zet_intel_metric_calculate_operation_exp_handle_t hCalculateOperation, + zet_intel_metric_calculation_operation_exp_handle_t hCalculationOperation, uint32_t *pSetCount, uint32_t *pMetricReportCountPerSet, uint32_t *pTotalMetricReportCount, zet_intel_metric_result_exp_t *pMetricResults) { - return L0::metricDecodeCalculateMultipleValues(hMetricDecoder, rawDataSize, offset, pRawData, hCalculateOperation, + return L0::metricDecodeCalculateMultipleValues(hMetricDecoder, rawDataSize, offset, pRawData, hCalculationOperation, pSetCount, pMetricReportCountPerSet, pTotalMetricReportCount, pMetricResults); } @@ -219,54 +219,54 @@ ze_result_t ZE_APICALL zetIntelMetricTracerDecodeExp( pMetricEntriesCountPerSet, pMetricEntriesCount, pMetricEntries); } -ze_result_t ZE_APICALL zetIntelMetricCalculateOperationCreateExp( +ze_result_t ZE_APICALL zetIntelMetricCalculationOperationCreateExp( zet_context_handle_t hContext, zet_device_handle_t hDevice, - zet_intel_metric_calculate_exp_desc_t *pCalculateDesc, - zet_intel_metric_calculate_operation_exp_handle_t *phCalculateOperation) { - return L0::zetIntelMetricCalculateOperationCreateExp(hContext, hDevice, pCalculateDesc, phCalculateOperation); + zet_intel_metric_calculation_exp_desc_t *pCalculationDesc, + zet_intel_metric_calculation_operation_exp_handle_t *phCalculationOperation) { + return L0::zetIntelMetricCalculationOperationCreateExp(hContext, hDevice, pCalculationDesc, phCalculationOperation); } -ze_result_t ZE_APICALL zetIntelMetricCalculateOperationDestroyExp( - zet_intel_metric_calculate_operation_exp_handle_t hCalculateOperation) { - return L0::zetIntelMetricCalculateOperationDestroyExp(hCalculateOperation); +ze_result_t ZE_APICALL zetIntelMetricCalculationOperationDestroyExp( + zet_intel_metric_calculation_operation_exp_handle_t hCalculationOperation) { + return L0::zetIntelMetricCalculationOperationDestroyExp(hCalculationOperation); } -ze_result_t ZE_APICALL zetIntelMetricCalculateOperationGetReportFormatExp( - zet_intel_metric_calculate_operation_exp_handle_t hCalculateOperation, +ze_result_t ZE_APICALL zetIntelMetricCalculationOperationGetReportFormatExp( + zet_intel_metric_calculation_operation_exp_handle_t hCalculationOperation, uint32_t *pCount, zet_metric_handle_t *phMetrics) { - return L0::zetIntelMetricCalculateOperationGetReportFormatExp(hCalculateOperation, pCount, phMetrics); + return L0::zetIntelMetricCalculationOperationGetReportFormatExp(hCalculationOperation, pCount, phMetrics); } -ze_result_t ZE_APICALL zetIntelMetricCalculateOperationGetExcludedMetricsExp( - zet_intel_metric_calculate_operation_exp_handle_t hCalculateOperation, +ze_result_t ZE_APICALL zetIntelMetricCalculationOperationGetExcludedMetricsExp( + zet_intel_metric_calculation_operation_exp_handle_t hCalculationOperation, uint32_t *pCount, zet_metric_handle_t *phMetrics) { - return L0::zetIntelMetricCalculateOperationGetExcludedMetricsExp(hCalculateOperation, pCount, phMetrics); + return L0::zetIntelMetricCalculationOperationGetExcludedMetricsExp(hCalculationOperation, pCount, phMetrics); } -ze_result_t ZE_APICALL zetIntelMetricCalculateValuesExp(const size_t rawDataSize, size_t *pOffset, const uint8_t *pRawData, zet_intel_metric_calculate_operation_exp_handle_t hCalculateOperation, +ze_result_t ZE_APICALL zetIntelMetricCalculateValuesExp(const size_t rawDataSize, size_t *pOffset, const uint8_t *pRawData, zet_intel_metric_calculation_operation_exp_handle_t hCalculationOperation, uint32_t *pTotalMetricReportsCount, zet_intel_metric_result_exp_t *pMetricResults) { - return L0::zetIntelMetricCalculateValuesExp(rawDataSize, pOffset, pRawData, hCalculateOperation, + return L0::zetIntelMetricCalculateValuesExp(rawDataSize, pOffset, pRawData, hCalculationOperation, pTotalMetricReportsCount, pMetricResults); } ze_result_t ZE_APICALL zetIntelMetricCalculateMultipleValuesExp(const size_t rawDataSize, size_t *offset, const uint8_t *pRawData, - zet_intel_metric_calculate_operation_exp_handle_t hCalculateOperation, + zet_intel_metric_calculation_operation_exp_handle_t hCalculationOperation, uint32_t *pSetCount, uint32_t *pMetricsReportCountPerSet, uint32_t *pTotalMetricReportCount, zet_intel_metric_result_exp_t *pMetricResults) { - return L0::zetIntelMetricCalculateMultipleValuesExp(rawDataSize, offset, pRawData, hCalculateOperation, pSetCount, + return L0::zetIntelMetricCalculateMultipleValuesExp(rawDataSize, offset, pRawData, hCalculationOperation, pSetCount, pMetricsReportCountPerSet, pTotalMetricReportCount, pMetricResults); } ze_result_t ZE_APICALL zetIntelMetricDecodeCalculateMultipleValuesExp(zet_metric_decoder_exp_handle_t hMetricDecoder, const size_t rawDataSize, - size_t *offset, const uint8_t *pRawData, zet_intel_metric_calculate_operation_exp_handle_t hCalculateOperation, + size_t *offset, const uint8_t *pRawData, zet_intel_metric_calculation_operation_exp_handle_t hCalculationOperation, uint32_t *pSetCount, uint32_t *pMetricReportCountPerSet, uint32_t *pTotalMetricReportCount, zet_intel_metric_result_exp_t *pMetricResults) { return L0::zetIntelMetricDecodeCalculateMultipleValuesExp( - hMetricDecoder, rawDataSize, offset, pRawData, hCalculateOperation, pSetCount, + hMetricDecoder, rawDataSize, offset, pRawData, hCalculationOperation, pSetCount, pMetricReportCountPerSet, pTotalMetricReportCount, pMetricResults); } diff --git a/level_zero/api/tools/zet_metric_api_entrypoints.h b/level_zero/api/tools/zet_metric_api_entrypoints.h index 01272890bc..c2b2ac3c02 100644 --- a/level_zero/api/tools/zet_metric_api_entrypoints.h +++ b/level_zero/api/tools/zet_metric_api_entrypoints.h @@ -163,7 +163,7 @@ zetDriverCalculateMetricExportDataExp( zet_metric_group_calculation_type_t type, size_t exportDataSize, const uint8_t *pExportData, - zet_metric_calculate_exp_desc_t *pCalculateDescriptor, + zet_metric_calculate_exp_desc_t *pCalculationDescriptor, uint32_t *pSetCount, uint32_t *pTotalMetricValueCount, uint32_t *pMetricCounts, @@ -613,12 +613,12 @@ zetDriverCalculateMetricExportDataExp( zet_metric_group_calculation_type_t type, size_t exportDataSize, const uint8_t *pExportData, - zet_metric_calculate_exp_desc_t *pCalculateDescriptor, + zet_metric_calculate_exp_desc_t *pCalculationDescriptor, uint32_t *pSetCount, uint32_t *pTotalMetricValueCount, uint32_t *pMetricCounts, zet_typed_value_t *pMetricValues) { - return L0::zetDriverCalculateMetricExportDataExp(hDriver, type, exportDataSize, pExportData, pCalculateDescriptor, + return L0::zetDriverCalculateMetricExportDataExp(hDriver, type, exportDataSize, pExportData, pCalculationDescriptor, pSetCount, pTotalMetricValueCount, pMetricCounts, pMetricValues); } diff --git a/level_zero/core/source/driver/driver_handle_imp_helper.cpp b/level_zero/core/source/driver/driver_handle_imp_helper.cpp index 45dd18c46d..f47d304442 100644 --- a/level_zero/core/source/driver/driver_handle_imp_helper.cpp +++ b/level_zero/core/source/driver/driver_handle_imp_helper.cpp @@ -62,7 +62,7 @@ const std::vector> DriverHandleImp::extensionsS // Metrics Driver experimental extensions {ZET_INTEL_METRIC_APPEND_MARKER_EXP_NAME, ZET_INTEL_METRIC_APPEND_MARKER_EXP_VERSION_CURRENT}, {ZET_INTEL_METRIC_SOURCE_ID_EXP_NAME, ZET_INTEL_METRIC_SOURCE_ID_EXP_VERSION_CURRENT}, - {ZET_INTEL_METRIC_CALCULATE_EXP_NAME, ZET_INTEL_METRIC_CALCULATE_EXP_VERSION_CURRENT}, + {ZET_INTEL_METRIC_CALCULATION_EXP_NAME, ZET_INTEL_METRIC_CALCULATION_EXP_VERSION_CURRENT}, {ZET_METRICS_RUNTIME_ENABLE_DISABLE_EXP_NAME, ZET_METRICS_RUNTIME_ENABLE_DISABLE_EXP_VERSION_CURRENT}, {ZET_INTEL_METRIC_SCOPES_EXP_NAME, ZET_INTEL_METRIC_SCOPES_EXP_VERSION_CURRENT}, {ZET_INTEL_METRIC_HW_BUFFER_SIZE_EXP_NAME, ZET_INTEL_METRIC_HW_BUFFER_SIZE_EXP_VERSION_CURRENT}, diff --git a/level_zero/core/source/driver/extension_function_address.cpp b/level_zero/core/source/driver/extension_function_address.cpp index 7b8e6a4c29..9b318e63d2 100644 --- a/level_zero/core/source/driver/extension_function_address.cpp +++ b/level_zero/core/source/driver/extension_function_address.cpp @@ -117,10 +117,10 @@ void *ExtensionFunctionAddressHelper::getExtensionFunctionAddress(const std::str RETURN_FUNC_PTR_IF_EXIST(zetIntelMetricDecoderDestroyExp); RETURN_FUNC_PTR_IF_EXIST(zetIntelMetricDecoderGetDecodableMetricsExp); RETURN_FUNC_PTR_IF_EXIST(zetIntelMetricTracerDecodeExp); - RETURN_FUNC_PTR_IF_EXIST(zetIntelMetricCalculateOperationCreateExp); - RETURN_FUNC_PTR_IF_EXIST(zetIntelMetricCalculateOperationDestroyExp); - RETURN_FUNC_PTR_IF_EXIST(zetIntelMetricCalculateOperationGetExcludedMetricsExp); - RETURN_FUNC_PTR_IF_EXIST(zetIntelMetricCalculateOperationGetReportFormatExp); + RETURN_FUNC_PTR_IF_EXIST(zetIntelMetricCalculationOperationCreateExp); + RETURN_FUNC_PTR_IF_EXIST(zetIntelMetricCalculationOperationDestroyExp); + RETURN_FUNC_PTR_IF_EXIST(zetIntelMetricCalculationOperationGetExcludedMetricsExp); + RETURN_FUNC_PTR_IF_EXIST(zetIntelMetricCalculationOperationGetReportFormatExp); RETURN_FUNC_PTR_IF_EXIST(zetIntelMetricDecodeCalculateMultipleValuesExp); RETURN_FUNC_PTR_IF_EXIST(zetIntelMetricCalculateMultipleValuesExp); RETURN_FUNC_PTR_IF_EXIST(zetIntelMetricCalculateValuesExp); diff --git a/level_zero/include/level_zero/ze_stypes.h b/level_zero/include/level_zero/ze_stypes.h index bd09a8497c..734298af8c 100644 --- a/level_zero/include/level_zero/ze_stypes.h +++ b/level_zero/include/level_zero/ze_stypes.h @@ -41,11 +41,12 @@ using zes_structure_type_ext_t = uint32_t; #define ZE_STRUCTURE_TYPE_QUEUE_PRIORITY_DESC static_cast(0x00030028) // Metric structure types -#define ZET_INTEL_STRUCTURE_TYPE_METRIC_GROUP_CALCULATE_EXP_PROPERTIES static_cast(0x00010008) -#define ZET_INTEL_STRUCTURE_TYPE_METRIC_CALCULATE_DESC_EXP static_cast(0x00010009) +#define ZET_STRUCTURE_TYPE_INTEL_METRIC_SCOPE_PROPERTIES_EXP static_cast(0x00010006) +#define ZET_INTEL_STRUCTURE_TYPE_METRIC_HW_BUFFER_SIZE_EXP_DESC static_cast(0x00010007) +#define ZET_INTEL_STRUCTURE_TYPE_METRIC_GROUP_CALCULATION_EXP_PROPERTIES static_cast(0x00010008) +#define ZET_INTEL_STRUCTURE_TYPE_METRIC_CALCULATION_DESC_EXP static_cast(0x00010009) #define ZET_INTEL_STRUCTURE_TYPE_METRIC_SOURCE_ID_EXP static_cast(0x0001000a) #define ZET_INTEL_STRUCTURE_TYPE_METRIC_DECODED_BUFFER_PROPERTIES_EXP static_cast(0x0001000b) -#define ZET_INTEL_STRUCTURE_TYPE_METRIC_HW_BUFFER_SIZE_EXP_DESC static_cast(0x00010007) // Sysman structure types #define ZES_INTEL_PCI_LINK_SPEED_DOWNGRADE_EXP_STATE static_cast(0x00040001) diff --git a/level_zero/include/level_zero/zet_intel_gpu_metric.h b/level_zero/include/level_zero/zet_intel_gpu_metric.h index 0b50ab4ff2..0e4c39f6be 100644 --- a/level_zero/include/level_zero/zet_intel_gpu_metric.h +++ b/level_zero/include/level_zero/zet_intel_gpu_metric.h @@ -189,88 +189,132 @@ ze_result_t ZE_APICALL zetIntelMetricTracerDecodeExp( zet_intel_metric_entry_exp_t *pMetricEntries ///< [in,out][optional][range(0, *pMetricEntriesCount)] buffer containing ///< decoded metric entries ); +#ifndef ZET_INTEL_METRIC_SCOPES_EXP_NAME +/// @brief Extension name to query Intel Metric Scopes operations +#define ZET_INTEL_METRIC_SCOPES_EXP_NAME "ZET_intel_metric_scopes" +#endif // ZET_INTEL_METRIC_SCOPES_EXP_NAME +typedef enum _zet_intel_metric_scopes_exp_version_t { + ZET_INTEL_METRIC_SCOPES_EXP_VERSION_1_0 = ZE_MAKE_VERSION(1, 0), ///< version 1.0 + ZET_INTEL_METRIC_SCOPES_EXP_VERSION_CURRENT = ZET_INTEL_METRIC_SCOPES_EXP_VERSION_1_0, ///< latest known version + ZET_INTEL_METRIC_SCOPES_EXP_VERSION_FORCE_UINT32 = 0x7fffffff +} zet_intel_metric_scopes_exp_version_t; -#ifndef ZET_INTEL_METRIC_CALCULATE_EXP_NAME -/// @brief Extension name to query Intel Metric Calculate operations -#define ZET_INTEL_METRIC_CALCULATE_EXP_NAME "ZET_intel_metric_calculate" -#endif // ZET_INTEL_METRIC_CALCULATE_EXP_NAME +/// @brief Handle of metric scope +struct _zet_intel_metric_scope_exp_handle_t {}; +typedef struct _zet_intel_metric_scope_exp_handle_t *zet_intel_metric_scope_exp_handle_t; + +#define ZET_INTEL_MAX_METRIC_SCOPE_NAME_EXP 64u +#define ZET_INTEL_MAX_METRIC_SCOPE_DESCRIPTION_EXP 128u + +/// @brief Query an metric scope properties +typedef struct _zet_intel_metric_scope_properties_exp_t { + zet_structure_type_ext_t stype; ///< [in] type of this structure + void *pNext; ///< [in][optional] must be null or a pointer to an extension-specific + ///< structure (i.e. contains stype and pNext). + uint16_t iD; ///< [out ]ID will be equal to the index of the metric scope in the + ///> array returned by zetIntelMetricScopesGetExp() + char name[ZET_INTEL_MAX_METRIC_SCOPE_NAME_EXP]; ///< [out] name of the metric scope. + ///< The name is expected to be a human readable string. + ///< The name can be used to identify the metric scope in the UI. + char description[ZET_INTEL_MAX_METRIC_SCOPE_DESCRIPTION_EXP]; ///< [out] description of the metric scope. + ///< The description is expected to be a human readable string. +} zet_intel_metric_scope_properties_exp_t; + +ze_result_t ZE_APICALL zetIntelMetricScopesGetExp( + zet_context_handle_t hContext, ///< [in] handle of the context object + zet_device_handle_t hDevice, ///< [in] handle of the device + uint32_t *pMetricScopesCount, ///< [in,out] pointer to the number of metric scopes available for the device. + ///< If set to zero, then the driver shall update the value with the total + ///< number of metric scopes available for the device. + zet_intel_metric_scope_exp_handle_t *phMetricScopes); ///< [out][optional] [range(0, *pMetricScopesCount)] array of metric scopes handles + ///< available for the device. If pMetricScopesCount is greater than zero but + ///< less than the total number of metric scopes available for the device, + ///< then driver shall only return that number of metric scopes. + +ze_result_t ZE_APICALL zetIntelMetricScopeGetPropertiesExp( + zet_intel_metric_scope_exp_handle_t hMetricScope, ///< [in] handle of the metric scope + zet_intel_metric_scope_properties_exp_t *pMetricScopeProperties); ///< [out] pointer to the metric scope properties structure + +#ifndef ZET_INTEL_METRIC_CALCULATION_EXP_NAME +/// @brief Extension name to query Intel Metric Calculation operations +#define ZET_INTEL_METRIC_CALCULATION_EXP_NAME "ZET_intel_metric_calculation" +#endif // ZET_INTEL_METRIC_CALCULATION_EXP_NAME /////////////////////////////////////////////////////////////////////////////// -/// @brief Metric Calculate extension Version(s) -typedef enum _zet_intel_metric_calculate_exp_version_t { - ZET_INTEL_METRIC_CALCULATE_EXP_VERSION_1_0 = ZE_MAKE_VERSION(1, 0), ///< version 1.0 - ZET_INTEL_METRIC_CALCULATE_EXP_VERSION_2_0 = ZE_MAKE_VERSION(2, 0), - ZET_INTEL_METRIC_CALCULATE_EXP_VERSION_3_0 = ZE_MAKE_VERSION(3, 0), - ZET_INTEL_METRIC_CALCULATE_EXP_VERSION_CURRENT = ZET_INTEL_METRIC_CALCULATE_EXP_VERSION_3_0, ///< latest known version - ZET_INTEL_METRIC_CALCULATE_EXP_VERSION_FORCE_UINT32 = 0x7fffffff -} zet_intel_metric_calculate_exp_version_t; - -#ifndef ZET_STRUCTURE_TYPE_INTEL_METRIC_CALCULATE_PROPERTIES_EXP -#define ZET_STRUCTURE_TYPE_INTEL_METRIC_CALCULATE_PROPERTIES_EXP 0x7fffffff -#endif // ZET_STRUCTURE_TYPE_INTEL_METRIC_CALCULATE_PROPERTIES_EXP +/// @brief Metric Calculation extension Version(s) +typedef enum _zet_intel_metric_calculation_exp_version_t { + ZET_INTEL_METRIC_CALCULATION_EXP_VERSION_1_0 = ZE_MAKE_VERSION(1, 0), ///< version 1.0 + ZET_INTEL_METRIC_CALCULATION_EXP_VERSION_CURRENT = ZET_INTEL_METRIC_CALCULATION_EXP_VERSION_1_0, ///< latest known version + ZET_INTEL_METRIC_CALCULATION_EXP_VERSION_FORCE_UINT32 = 0x7fffffff +} zet_intel_metric_calculation_exp_version_t; /////////////////////////////////////////////////////////////////////////////// -/// @brief Query an metric group calculate properties +/// @brief Query an metric group calculation properties /// This structure can be passed in the 'pNext' of zet_metric_group_properties_t -typedef struct _zet_intel_metric_group_calculate_properties_exp_t { +typedef struct _zet_intel_metric_group_calculation_properties_exp_t { zet_structure_type_ext_t stype; ///< [in] type of this structure void *pNext; ///< [in][optional] must be null or a pointer to an extension-specific ///< structure (i.e. contains stype and pNext). bool isTimeFilterSupported; ///< [out] Flag to indicate if the metric group supports time filtering for ///< metrics calculation. -} zet_intel_metric_group_calculate_properties_exp_t; +} zet_intel_metric_group_calculation_properties_exp_t; /////////////////////////////////////////////////////////////////////////////// -/// @brief Handle of metric calculate operation -struct _zet_intel_metric_calculate_operation_exp_handle_t {}; -typedef struct _zet_intel_metric_calculate_operation_exp_handle_t *zet_intel_metric_calculate_operation_exp_handle_t; +/// @brief Handle of metric calculation operation +struct _zet_intel_metric_calculation_operation_exp_handle_t {}; +typedef struct _zet_intel_metric_calculation_operation_exp_handle_t *zet_intel_metric_calculation_operation_exp_handle_t; -typedef struct _zet_intel_metric_calculate_time_window_exp_t { +typedef struct _zet_intel_metric_calculation_time_window_exp_t { uint64_t windowStart; ///< [in] starting time in nanoseconds of the raw data to where WindowSize ///< is selected. If WindowStart + WindowSize is bigger than the total ///< time of the raw data collected, only a fraction of the window will be used. uint64_t windowSize; ///< [in] size in nanoseconds of the faction of the raw data used for calculation. -} zet_intel_metric_calculate_time_window_exp_t; +} zet_intel_metric_calculation_time_window_exp_t; -typedef struct _zet_intel_metric_calculate_exp_desc_t { - zet_structure_type_ext_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). - uint32_t metricGroupCount; ///< [in] [in] count for metric group handles in metric hMetricGroups array. - ///< If set to 0, then phMetricGroups must be null - zet_metric_group_handle_t *phMetricGroups; ///< [in] [optional][range(0, metricGroupCount)] array of metric group - ///< handles to filter metric groups to be calculated. - uint32_t metricCount; ///< [in] number of metrics handles in the phMetrics array. If set to 0, then - ///< phMetrics must be null. - zet_metric_handle_t *phMetrics; ///< [in][optional] [range(0, metricsCount)] array of metrics handles to filter - ///< metrics to be calculated. phMetrics are additionally calculated even if repeated - ///< in phMetricGroups. - uint32_t timeWindowsCount; ///< [in] number of time windows in pCalculateTimeWindows. Must be 0 if disabled. - ///< If set to 0, then pCalculateTimeWindows must be null - zet_intel_metric_calculate_time_window_exp_t *pCalculateTimeWindows; ///< [in][optional][range(0,timeWindowsCount)] array containing the list of time windows - ///< to filter metrics data - ///< to be used for metrics calculation. Must be null if disabled. - uint64_t timeAggregationWindow; ///< [in] size in nanoseconds used to divide the raw data and calculate a result for - ///< each metric. When enabled, the API will return one report per aggregation - ///< window. Must not be 0. When set to uint64_t_MAX will include all rawdata - ///< in a single window. If the timeAggregationWindow is bigger than the total - ///< time of the raw data collected, will be same as uint64_t_MAX. When - ///< timeAggregationWindow is not a perfect divisor of the total time, - ///< the last window is expected to be smaller. When CalculateTimeWindows - ///< are used, the API will limit the maximum timeAggregationWindow to - ///< the size of each CalculateTimeWindow individually. When timeAggregationWindow - ///< is smaller than a given CalculateTimeWindow, the CalculateTimeWindow will - ///< be divided into timeAggregationWindow sections for aggregation, with the - ///< last fraction being smaller when there is no perfect division. -} zet_intel_metric_calculate_exp_desc_t; -typedef enum _zet_intel_metric_calculate_result_status_exp_t { - ZET_INTEL_METRIC_CALCULATE_EXP_RESULT_VALID = 0, - ZET_INTEL_METRIC_CALCULATE_EXP_RESULT_INVALID, - ZET_INTEL_METRIC_CALCULATE_EXP_RESULT_FORCE_UINT32 = 0x7fffffff -} zet_intel_metric_calculate_result_status_exp_t; +typedef struct _zet_intel_metric_calculation_exp_desc_t { + zet_structure_type_ext_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). + uint32_t metricGroupCount; ///< [in] [in] count for metric group handles in metric hMetricGroups array. + ///< If set to 0, then phMetricGroups must be null + zet_metric_group_handle_t *phMetricGroups; ///< [in] [optional][range(0, metricGroupCount)] array of metric group + ///< handles to filter metric groups to be calculated. + uint32_t metricCount; ///< [in] number of metrics handles in the phMetrics array. If set to 0, then + ///< phMetrics must be null. + zet_metric_handle_t *phMetrics; ///< [in][optional] [range(0, metricsCount)] array of metrics handles to filter + ///< metrics to be calculated. phMetrics are additionally calculated even if repeated + ///< in phMetricGroups. + uint32_t timeWindowsCount; ///< [in] number of time windows in pCalculationTimeWindows. Must be 0 if disabled. + ///< If set to 0, then pCalculationTimeWindows must be null + zet_intel_metric_calculation_time_window_exp_t *pCalculationTimeWindows; ///< [in][optional][range(0,timeWindowsCount)] array containing the list of time windows + ///< to filter metrics data + ///< to be used for metrics calculation. Must be null if disabled. + uint64_t timeAggregationWindow; ///< [in] size in nanoseconds used to divide the raw data and calculate a result for + ///< each metric. When enabled, the API will return one report per aggregation + ///< window. Must not be 0. When set to uint64_t_MAX will include all rawdata + ///< in a single window. If the timeAggregationWindow is bigger than the total + ///< time of the raw data collected, will be same as uint64_t_MAX. When + ///< timeAggregationWindow is not a perfect divisor of the total time, + ///< the last window is expected to be smaller. When CalculationTimeWindows + ///< are used, the API will limit the maximum timeAggregationWindow to + ///< the size of each CalculationTimeWindow individually. When timeAggregationWindow + ///< is smaller than a given CalculationTimeWindow, the CalculationTimeWindow will + ///< be divided into timeAggregationWindow sections for aggregation, with the + ///< last fraction being smaller when there is no perfect division. + uint32_t metricScopesCount; ///< [in] number of metric scopes in metric scopes handles. Must not be 0, otherwise error is returned. + zet_intel_metric_scope_exp_handle_t *phMetricScopes; ///< [in][optional] [range (0, metricScopesCount)] array of metric scopes handles to use for calculation. + ///< Duplicated entries will be removed. Metrics not supporting all metric scopes listed will be excluded + ///< from the calculation operation. If no metric supports all metric scopes included, the calculation + ///< operation creation will fail. +} zet_intel_metric_calculation_exp_desc_t; +typedef enum _zet_intel_metric_calculation_result_status_exp_t { + ZET_INTEL_METRIC_CALCULATION_EXP_RESULT_VALID = 0, + ZET_INTEL_METRIC_CALCULATION_EXP_RESULT_INVALID, + ZET_INTEL_METRIC_CALCULATION_EXP_RESULT_FORCE_UINT32 = 0x7fffffff +} zet_intel_metric_calculation_result_status_exp_t; typedef struct _zet_intel_metric_result_exp_t { - zet_value_t value; ///< [out] metric result calculated metric value - zet_intel_metric_calculate_result_status_exp_t resultStatus; ///< [out] type of the result for the filters applied to the calculation. + zet_value_t value; ///< [out] metric result calculated metric value + zet_intel_metric_calculation_result_status_exp_t resultStatus; ///< [out] type of the result for the filters applied to the calculation. } zet_intel_metric_result_exp_t; typedef struct _zet_intel_metric_decoded_buffer_exp_properties_t { zet_structure_type_ext_t stype; ///< [in] type of this structure @@ -281,139 +325,139 @@ typedef struct _zet_intel_metric_decoded_buffer_exp_properties_t { } zet_intel_metric_decoded_buffer_exp_properties_t; ze_result_t ZE_APICALL -zetIntelMetricCalculateOperationCreateExp( - zet_context_handle_t hContext, ///< [in] handle of the context object - zet_device_handle_t hDevice, ///< [in] handle of the device - zet_intel_metric_calculate_exp_desc_t *pCalculateDesc, ///< [in] pointer to structure with filters and operations to perform - ///< at calculation time. - zet_intel_metric_calculate_operation_exp_handle_t *phCalculateOperation); ///< [out] Calculate operation handle +zetIntelMetricCalculationOperationCreateExp( + zet_context_handle_t hContext, ///< [in] handle of the context object + zet_device_handle_t hDevice, ///< [in] handle of the device + zet_intel_metric_calculation_exp_desc_t *pCalculationDesc, ///< [in] pointer to structure with filters and operations to perform + ///< at calculation time. + zet_intel_metric_calculation_operation_exp_handle_t *phCalculationOperation); ///< [out] Calculation operation handle ze_result_t ZE_APICALL -zetIntelMetricCalculateOperationDestroyExp( - zet_intel_metric_calculate_operation_exp_handle_t hCalculateOperation); ///< [in] Calculate operation handle +zetIntelMetricCalculationOperationDestroyExp( + zet_intel_metric_calculation_operation_exp_handle_t hCalculationOperation); ///< [in] Calculation operation handle -ze_result_t ZE_APICALL zetIntelMetricCalculateOperationGetReportFormatExp( - zet_intel_metric_calculate_operation_exp_handle_t phCalculateOperation, ///< [in] Calculate operation handle - uint32_t *pCount, ///< [in,out] pointer to the number of metrics in the output report from - ///< calculate operations. If set to zero, then the driver shall update - ///< the value with the total number of metrics to be included in the - ///< calculate results report. If count is greater than the total number - ///< of metrics to be included in the calculate results report, then the - ///< driver shall update the value with the actual number. If count is - ///< smaller than the total number of metrics to be included in the - ///< calculate results report, then ZE_RESULT_ERROR_INVALID_ARGUMENT - ///< will be returned since this parameter is not intended for - ///< filtering metrics. - zet_metric_handle_t *phMetrics); ///< [out][optional] [range(0, pMetricsCount)] array of metrics handles - ///< with the order in which results will be found in output report of - ///< calculate operations -ze_result_t ZE_APICALL zetIntelMetricCalculateOperationGetExcludedMetricsExp( - zet_intel_metric_calculate_operation_exp_handle_t phCalculateOperation, ///< [in] Calculate operation handle - uint32_t *pCount, ///< [in,out] pointer to the number of metrics excluded from the output report. - ///< If set to zero, then the driver shall update the value with the total number - ///< of metrics excluded. If count is greater than the total number - ///< of metrics excluded, then the driver shall update the value with the - ///< actual number. If count is smaller than the total number of metrics - ///< excluded then ZE_RESULT_ERROR_INVALID_ARGUMENT will be returned - ///< since this parameter is not intended for filtering metrics. - zet_metric_handle_t *phMetrics); ///< [out][optional] [range(0, pMetricsCount)] array of metrics handles - ///< excluded from the output report of calculate operations +ze_result_t ZE_APICALL zetIntelMetricCalculationOperationGetReportFormatExp( + zet_intel_metric_calculation_operation_exp_handle_t phCalculationOperation, ///< [in] Calculation operation handle + uint32_t *pCount, ///< [in,out] pointer to the number of metrics in the output report from + ///< calculation operations. If set to zero, then the driver shall update + ///< the value with the total number of metrics to be included in the + ///< calculation results report. If count is greater than the total number + ///< of metrics to be included in the calculation results report, then the + ///< driver shall update the value with the actual number. If count is + ///< smaller than the total number of metrics to be included in the + ///< calculation results report, then ZE_RESULT_ERROR_INVALID_ARGUMENT + ///< will be returned since this parameter is not intended for + ///< filtering metrics. + zet_metric_handle_t *phMetrics); ///< [out][optional] [range(0, pMetricsCount)] array of metrics handles + ///< with the order in which results will be found in output report of + ///< calculation operations +ze_result_t ZE_APICALL zetIntelMetricCalculationOperationGetExcludedMetricsExp( + zet_intel_metric_calculation_operation_exp_handle_t phCalculationOperation, ///< [in] Calculation operation handle + uint32_t *pCount, ///< [in,out] pointer to the number of metrics excluded from the output report. + ///< If set to zero, then the driver shall update the value with the total number + ///< of metrics excluded. If count is greater than the total number + ///< of metrics excluded, then the driver shall update the value with the + ///< actual number. If count is smaller than the total number of metrics + ///< excluded then ZE_RESULT_ERROR_INVALID_ARGUMENT will be returned + ///< since this parameter is not intended for filtering metrics. + zet_metric_handle_t *phMetrics); ///< [out][optional] [range(0, pMetricsCount)] array of metrics handles + ///< excluded from the output report of calculation operations ze_result_t ZE_APICALL zetIntelMetricDecodeCalculateMultipleValuesExp( - zet_metric_decoder_exp_handle_t hMetricDecoder, ///< [in] handle of the metric decoder object - const size_t rawDataSize, ///< [in] size in bytes of raw data buffer. - size_t *offset, ///< [in,out] On input, the offset from the beginning of pRawData to decode - ///< and calculate. On output, the number raw bytes processed - const uint8_t *pRawData, ///< [in,out][range(0, *rawDataSize)] buffer containing tracer - ///< data in raw format - zet_intel_metric_calculate_operation_exp_handle_t hCalculateOperation, ///< [in] Calculate operation handle - uint32_t *pSetCount, ///< [in,out] pointer to number of metric sets. if count is zero, then the - ///< driver shall update the value with the total number of metric sets to - ///< be decoded and calculated. If count is greater than the number available - ///< in the raw data buffer, then the driver shall update the value with the - ///< actual number of metric sets to be decoded and calculated. There is a - ///< 1:1 relationship between the number of sets and the number sub-devices - ///< metrics results that can be calculated from the provided data - uint32_t *pMetricReportCountPerSet, ///< [in,out][optional][range(0, *pSetCount)] buffer of metric reports counts - ///< per metric set, one value per set - uint32_t *pTotalMetricReportCount, ///< [in,out] [optional] pointer to the total number of metric reports decoded and - ///< calculated, for all metric sets. If count is zero, then the driver shall update - ///< the value with the total number of metric reports to be decoded and calculated. - ///< If count is greater than zero but less than the total number of reports available - ///< in the raw data, then only that number of reports will be decoded and calculated. - ///< If count is greater than the number of reports available in the raw data buffer, - ///< then the driver shall update the value with the actual number of metric reports - ///< decoded and calculated. If set to null, then driver will only update the value - ///< of pSetCount - zet_intel_metric_result_exp_t *pMetricResults); ///< [in,out][optional][range(0, *pTotalMetricResultsCount)] buffer of decoded and - ///< calculated metrics results. + zet_metric_decoder_exp_handle_t hMetricDecoder, ///< [in] handle of the metric decoder object + const size_t rawDataSize, ///< [in] size in bytes of raw data buffer. + size_t *offset, ///< [in,out] On input, the offset from the beginning of pRawData to decode + ///< and calculate. On output, the number raw bytes processed + const uint8_t *pRawData, ///< [in,out][range(0, *rawDataSize)] buffer containing tracer + ///< data in raw format + zet_intel_metric_calculation_operation_exp_handle_t hCalculationOperation, ///< [in] Calculation operation handle + uint32_t *pSetCount, ///< [in,out] pointer to number of metric sets. if count is zero, then the + ///< driver shall update the value with the total number of metric sets to + ///< be decoded and calculated. If count is greater than the number available + ///< in the raw data buffer, then the driver shall update the value with the + ///< actual number of metric sets to be decoded and calculated. There is a + ///< 1:1 relationship between the number of sets and the number sub-devices + ///< metrics results that can be calculated from the provided data + uint32_t *pMetricReportCountPerSet, ///< [in,out][optional][range(0, *pSetCount)] buffer of metric reports counts + ///< per metric set, one value per set + uint32_t *pTotalMetricReportCount, ///< [in,out] [optional] pointer to the total number of metric reports decoded and + ///< calculated, for all metric sets. If count is zero, then the driver shall update + ///< the value with the total number of metric reports to be decoded and calculated. + ///< If count is greater than zero but less than the total number of reports available + ///< in the raw data, then only that number of reports will be decoded and calculated. + ///< If count is greater than the number of reports available in the raw data buffer, + ///< then the driver shall update the value with the actual number of metric reports + ///< decoded and calculated. If set to null, then driver will only update the value + ///< of pSetCount + zet_intel_metric_result_exp_t *pMetricResults); ///< [in,out][optional][range(0, *pTotalMetricResultsCount)] buffer of decoded and + ///< calculated metrics results. ze_result_t ZE_APICALL zetIntelMetricDecodeToBinaryBufferExp( - zet_metric_decoder_exp_handle_t hMetricDecoder, ///< [in] handle of the metric decoder object - size_t *pRawDataSize, ///< [in,out] size in bytes of raw data buffer. If pDecodedBufferSize is greater - ///< than 0 but smaller than the total number of bytes required for decoding - ///< the entire input raw data, then driver shall update this value with - ///< actual number of raw data bytes processed - const uint8_t *pRawData, ///< [in,out][range(0, *pRawDataSize)] buffer containing tracer - ///< data in raw format - zet_intel_metric_calculate_operation_exp_handle_t phCalculateOperation, ///< [in] Calculate operation handle, to filter metrics to decode - zet_intel_metric_decoded_buffer_exp_properties_t *pProperties, ///< [in] Properties of the decoded buffer. - size_t *pDecodedBufferSize, ///< [in] Pointer to the size of the decoded binary buffer. If set to 0, - ///< [in,out] Then driver shall update this value with total size in bytes required - ///< for the decoded binary buffer. If size is greater than 0 but smaller - ///< than the total number of bytes required for decoding entire input - ///< raw data, then driver shall only decode an approximate to that number - ///< of bytes. If size is greater than the total number of bytes required - ///< for decoding entire input raw data, then the driver shall update the - ///< value with the actual number of bytes decoded. - uint8_t *pDecodedBuffer); ///< [in,out][optional] binary buffer containing decoded raw data. + zet_metric_decoder_exp_handle_t hMetricDecoder, ///< [in] handle of the metric decoder object + size_t *pRawDataSize, ///< [in,out] size in bytes of raw data buffer. If pDecodedBufferSize is greater + ///< than 0 but smaller than the total number of bytes required for decoding + ///< the entire input raw data, then driver shall update this value with + ///< actual number of raw data bytes processed + const uint8_t *pRawData, ///< [in,out][range(0, *pRawDataSize)] buffer containing tracer + ///< data in raw format + zet_intel_metric_calculation_operation_exp_handle_t phCalculationOperation, ///< [in] Calculation operation handle, to filter metrics to decode + zet_intel_metric_decoded_buffer_exp_properties_t *pProperties, ///< [in] Properties of the decoded buffer. + size_t *pDecodedBufferSize, ///< [in] Pointer to the size of the decoded binary buffer. If set to 0, + ///< [in,out] Then driver shall update this value with total size in bytes required + ///< for the decoded binary buffer. If size is greater than 0 but smaller + ///< than the total number of bytes required for decoding entire input + ///< raw data, then driver shall only decode an approximate to that number + ///< of bytes. If size is greater than the total number of bytes required + ///< for decoding entire input raw data, then the driver shall update the + ///< value with the actual number of bytes decoded. + uint8_t *pDecodedBuffer); ///< [in,out][optional] binary buffer containing decoded raw data. ze_result_t ZE_APICALL zetIntelMetricCalculateMultipleValuesExp( - const size_t rawDataSize, ///< [in] size in bytes of raw data buffer. - size_t *offset, ///< [in,out] On input, the offset from the beginning of pRawData calculate. On output, - ///< the number raw bytes processed - const uint8_t *pRawData, ///< [in,out][range(0, *rawDataSize)] buffer containing tracer - ///< data in raw format - zet_intel_metric_calculate_operation_exp_handle_t hCalculateOperation, ///< [in] Calculate operation handle - uint32_t *pSetCount, ///< [in,out] pointer to number of metric sets. if count is zero, then the - ///< driver shall update the value with the total number of metric sets to - ///< be calculated. If count is greater than the number available in the raw - ///< data buffer, then the driver shall update the value with the actual number - ///< of metric sets to be calculated. There is a 1:1 relationship between the - ///< number of sets and the number sub-devices metrics results that can be - ///< calculated from the provided data. - uint32_t *pMetricReportCountPerSet, ///< [in,out][optional][range(0, *pSetCount)] buffer of metric reports counts - ///< per metric set, one value per set - uint32_t *pTotalMetricReportCount, ///< [in,out] [optional] pointer to the total number of metric reports calculated, - ///< for all metric sets. If count is zero, then the driver shall update the value - ///< with the total number of metric reports to be calculated. If count is greater - ///< than zero but less than the total number of reports available in the raw data, - ///< then only that number of reports will be calculated. If count is greater than - ///< the number of reports available in the raw data buffer, then the driver shall - ///< update the value with the actual number of metric reports calculated. If set - ///< to null, then driver will only update the value of pSetCount - zet_intel_metric_result_exp_t *pMetricResults); ///< [in,out][optional][range(0, *pTotalMetricResultsCount)] buffer of calculated - ///< metrics results. + const size_t rawDataSize, ///< [in] size in bytes of raw data buffer. + size_t *offset, ///< [in,out] On input, the offset from the beginning of pRawData. On output, + ///< the number raw bytes processed + const uint8_t *pRawData, ///< [in,out][range(0, *rawDataSize)] buffer containing tracer + ///< data in raw format + zet_intel_metric_calculation_operation_exp_handle_t hCalculationOperation, ///< [in] Calculation operation handle + uint32_t *pSetCount, ///< [in,out] pointer to number of metric sets. if count is zero, then the + ///< driver shall update the value with the total number of metric sets to + ///< be calculated. If count is greater than the number available in the raw + ///< data buffer, then the driver shall update the value with the actual number + ///< of metric sets to be calculated. There is a 1:1 relationship between the + ///< number of sets and the number sub-devices metrics results that can be + ///< calculated from the provided data. + uint32_t *pMetricReportCountPerSet, ///< [in,out][optional][range(0, *pSetCount)] buffer of metric reports counts + ///< per metric set, one value per set + uint32_t *pTotalMetricReportCount, ///< [in,out] [optional] pointer to the total number of metric reports calculated, + ///< for all metric sets. If count is zero, then the driver shall update the value + ///< with the total number of metric reports to be calculated. If count is greater + ///< than zero but less than the total number of reports available in the raw data, + ///< then only that number of reports will be calculated. If count is greater than + ///< the number of reports available in the raw data buffer, then the driver shall + ///< update the value with the actual number of metric reports calculated. If set + ///< to null, then driver will only update the value of pSetCount + zet_intel_metric_result_exp_t *pMetricResults); ///< [in,out][optional][range(0, *pTotalMetricResultsCount)] buffer of calculated + ///< metrics results. ze_result_t ZE_APICALL zetIntelMetricCalculateValuesExp( - const size_t rawDataSize, ///< [in] size in bytes of raw data buffer. - size_t *pOffset, ///< [in,out] On input, the offset from the beginning of the pRawData to calculate - ///< On output, the number raw bytes processed - const uint8_t *pRawData, ///< [in,out][range(0, *rawDataSize)] buffer containing tracer - ///< data in raw format - zet_intel_metric_calculate_operation_exp_handle_t hCalculateOperation, ///< [in] Calculate operation handle - uint32_t *pTotalMetricReportCount, ///< [in,out] [optional] pointer to the total number of metric reports calculated, - ///< If count is zero, then the driver shall update the value with the total number of - ///< metric reports to be calculated. If count is greater than zero but less than the - ///< total number of reports available in the raw data, then only that number of - ///< reports will be calculated. If count is greater than the number of reports - ///< available in the raw data buffer, then the driver shall update the value with - ///< the actual number of metric reports calculated. - zet_intel_metric_result_exp_t *pMetricResults); ///< [in,out][optional][range(0, *pTotalMetricResultsCount)] buffer of calculated - ///< metrics results. + const size_t rawDataSize, ///< [in] size in bytes of raw data buffer. + size_t *pOffset, ///< [in,out] On input, the offset from the beginning of the pRawData. + ///< On output, the number raw bytes processed + const uint8_t *pRawData, ///< [in,out][range(0, *rawDataSize)] buffer containing tracer + ///< data in raw format + zet_intel_metric_calculation_operation_exp_handle_t hCalculationOperation, ///< [in] Calculation operation handle + uint32_t *pTotalMetricReportCount, ///< [in,out] [optional] pointer to the total number of metric reports calculated, + ///< If count is zero, then the driver shall update the value with the total number of + ///< metric reports to be calculated. If count is greater than zero but less than the + ///< total number of reports available in the raw data, then only that number of + ///< reports will be calculated. If count is greater than the number of reports + ///< available in the raw data buffer, then the driver shall update the value with + ///< the actual number of metric reports calculated. + zet_intel_metric_result_exp_t *pMetricResults); ///< [in,out][optional][range(0, *pTotalMetricResultsCount)] buffer of calculated + ///< metrics results. #ifndef ZET_INTEL_METRICS_RUNTIME_ENABLE_DISABLE_EXP_NAME /// @brief Extension name for enabling and disabling Intel Metrics collection @@ -443,58 +487,6 @@ ze_result_t ZE_APICALL zetIntelDeviceEnableMetricsExp(zet_device_handle_t hDevic /// is returned. ze_result_t ZE_APICALL zetIntelDeviceDisableMetricsExp(zet_device_handle_t hDevice); -#ifndef ZET_INTEL_METRIC_SCOPES_EXP_NAME -/// @brief Extension name to query Intel Metric Scopes operations -#define ZET_INTEL_METRIC_SCOPES_EXP_NAME "ZET_intel_metric_scopes" -#endif // ZET_INTEL_METRIC_SCOPES_EXP_NAME -typedef enum _zet_intel_metric_scopes_exp_version_t { - ZET_INTEL_METRIC_SCOPES_EXP_VERSION_1_0 = ZE_MAKE_VERSION(1, 0), ///< version 1.0 - ZET_INTEL_METRIC_SCOPES_EXP_VERSION_CURRENT = ZET_INTEL_METRIC_SCOPES_EXP_VERSION_1_0, ///< latest known version - ZET_INTEL_METRIC_SCOPES_EXP_VERSION_FORCE_UINT32 = 0x7fffffff -} zet_intel_metric_scopes_exp_version_t; - -/// @brief Handle of metric scope -struct _zet_intel_metric_scope_exp_handle_t {}; -typedef struct _zet_intel_metric_scope_exp_handle_t *zet_intel_metric_scope_exp_handle_t; - -#define ZET_INTEL_MAX_METRIC_SCOPE_NAME_EXP 64u -#define ZET_INTEL_MAX_METRIC_SCOPE_DESCRIPTION_EXP 128u - -#ifndef ZET_STRUCTURE_TYPE_INTEL_METRIC_SCOPE_PROPERTIES_EXP -#define ZET_STRUCTURE_TYPE_INTEL_METRIC_SCOPE_PROPERTIES_EXP 0x7fffffff -#endif // ZET_STRUCTURE_TYPE_INTEL_METRIC_SCOPE_PROPERTIES_EXP - -/// @brief Query an metric scope properties -typedef struct _zet_intel_metric_scope_properties_exp_t { - zet_structure_type_ext_t stype; ///< [in] type of this structure - void *pNext; ///< [in][optional] must be null or a pointer to an extension-specific - ///< structure (i.e. contains stype and pNext). - uint16_t iD; ///< [out ]ID will be equal to the index of the metric scope in the - ///> array returned by zetMetricScopesGet() - char name[ZET_INTEL_MAX_METRIC_SCOPE_NAME_EXP]; ///< [out] name of the metric scope, which is unique for the device. - ///< The name is expected to be a human readable string. - ///< The name can be used to identify the metric scope in the UI. - char description[ZET_INTEL_MAX_METRIC_SCOPE_DESCRIPTION_EXP]; ///< [out] description of the metric scope, which is unique for the device. - ///< The description is expected to be a human readable string. - ///< The description can be used to provide additional information about - ///< the metric scope in the UI. -} zet_intel_metric_scope_properties_exp_t; - -ze_result_t ZE_APICALL zetIntelMetricScopesGetExp( - zet_context_handle_t hContext, ///< [in] handle of the context object - zet_device_handle_t hDevice, ///< [in] handle of the device - uint32_t *pMetricScopesCount, ///< [in,out] pointer to the number of metric scopes available for the device. - ///< If set to zero, then the driver shall update the value with the total - ///< number of metric scopes available for the device. - zet_intel_metric_scope_exp_handle_t *phMetricScopes); ///< [out][optional] [range(0, *pMetricScopesCount)] array of metric scopes handles - ///< available for the device. If pMetricScopesCount is greater than zero but - ///< less than the total number of metric scopes available for the device, - ///< then driver shall only return that number of metric scopes. - -ze_result_t ZE_APICALL zetIntelMetricScopeGetPropertiesExp( - zet_intel_metric_scope_exp_handle_t hMetricScope, ///< [in] handle of the metric scope - zet_intel_metric_scope_properties_exp_t *pMetricScopeProperties); ///< [out] pointer to the metric scope properties structure - #ifndef ZET_INTEL_METRIC_HW_BUFFER_SIZE_EXP_NAME /// @brief Extension name for query to read the Intel Level Zero Driver Version String #define ZET_INTEL_METRIC_HW_BUFFER_SIZE_EXP_NAME "ZET_intel_get_hw_buffer_size" diff --git a/level_zero/tools/source/metrics/metric.cpp b/level_zero/tools/source/metrics/metric.cpp index 89872a1c9d..39d4232bb1 100644 --- a/level_zero/tools/source/metrics/metric.cpp +++ b/level_zero/tools/source/metrics/metric.cpp @@ -601,58 +601,58 @@ bool MetricDeviceContext::areMetricsFromSameSource(uint32_t count, zet_metric_ha } ze_result_t MetricDeviceContext::calcOperationCreate(zet_context_handle_t hContext, - zet_intel_metric_calculate_exp_desc_t *pCalculateDesc, - zet_intel_metric_calculate_operation_exp_handle_t *phCalculateOperation) { + zet_intel_metric_calculation_exp_desc_t *pCalculationDesc, + zet_intel_metric_calculation_operation_exp_handle_t *phCalculationOperation) { - if (pCalculateDesc->timeAggregationWindow == 0) { + if (pCalculationDesc->timeAggregationWindow == 0) { METRICS_LOG_ERR("%s", "Must define an aggregation window"); return ZE_RESULT_ERROR_INVALID_ARGUMENT; } uint32_t metricGroupsSourceType = MetricSource::metricSourceTypeUndefined; MetricGroupImp *metricGroupImp = nullptr; - if (pCalculateDesc->metricGroupCount > 0) { - if (!areMetricGroupsFromSameSource(pCalculateDesc->metricGroupCount, pCalculateDesc->phMetricGroups, &metricGroupsSourceType)) { + if (pCalculationDesc->metricGroupCount > 0) { + if (!areMetricGroupsFromSameSource(pCalculationDesc->metricGroupCount, pCalculationDesc->phMetricGroups, &metricGroupsSourceType)) { METRICS_LOG_ERR("%s", "Metric groups must be from the same domain"); return ZE_RESULT_ERROR_INVALID_ARGUMENT; } - if (!areMetricGroupsFromSameDeviceHierarchy(pCalculateDesc->metricGroupCount, pCalculateDesc->phMetricGroups)) { + if (!areMetricGroupsFromSameDeviceHierarchy(pCalculationDesc->metricGroupCount, pCalculationDesc->phMetricGroups)) { METRICS_LOG_ERR("%s", "Mix of root device and sub-device metric group handle is not allowed"); return ZE_RESULT_ERROR_INVALID_ARGUMENT; } - metricGroupImp = static_cast(MetricGroup::fromHandle(pCalculateDesc->phMetricGroups[0])); + metricGroupImp = static_cast(MetricGroup::fromHandle(pCalculationDesc->phMetricGroups[0])); } uint32_t metricsSourceType = MetricSource::metricSourceTypeUndefined; MetricImp *metricImp = nullptr; - if (pCalculateDesc->metricCount > 0) { - if (!areMetricsFromSameSource(pCalculateDesc->metricCount, pCalculateDesc->phMetrics, &metricsSourceType)) { + if (pCalculationDesc->metricCount > 0) { + if (!areMetricsFromSameSource(pCalculationDesc->metricCount, pCalculationDesc->phMetrics, &metricsSourceType)) { METRICS_LOG_ERR("%s", "Metrics must be from the same domain"); return ZE_RESULT_ERROR_INVALID_ARGUMENT; } - metricImp = static_cast(Metric::fromHandle(pCalculateDesc->phMetrics[0])); + metricImp = static_cast(Metric::fromHandle(pCalculationDesc->phMetrics[0])); // IpSampling does not use multi-device metrics if ((metricImp->getMetricSource().getType() != MetricSource::metricSourceTypeIpSampling) && - (!areMetricsFromSameDeviceHierarchy(pCalculateDesc->metricCount, pCalculateDesc->phMetrics))) { + (!areMetricsFromSameDeviceHierarchy(pCalculationDesc->metricCount, pCalculationDesc->phMetrics))) { METRICS_LOG_ERR("%s", "Mix of root device and sub-device metric handle is not allowed"); return ZE_RESULT_ERROR_INVALID_ARGUMENT; } } - if (pCalculateDesc->metricGroupCount > 0) { - if ((pCalculateDesc->metricCount > 0) && (metricGroupsSourceType != metricsSourceType)) { + if (pCalculationDesc->metricGroupCount > 0) { + if ((pCalculationDesc->metricCount > 0) && (metricGroupsSourceType != metricsSourceType)) { METRICS_LOG_ERR("%s", "Metric groups and metrics must be from the same domain"); return ZE_RESULT_ERROR_INVALID_ARGUMENT; } - } else if (pCalculateDesc->metricCount == 0) { + } else if (pCalculationDesc->metricCount == 0) { METRICS_LOG_ERR("%s", "Must define at least one metric group or metric"); return ZE_RESULT_ERROR_INVALID_ARGUMENT; } MetricSource &metricSource = (metricGroupImp) ? metricGroupImp->getMetricSource() : metricImp->getMetricSource(); // NOLINT(clang-analyzer-core.CallAndMessage) - return metricSource.calcOperationCreate(*this, pCalculateDesc, phCalculateOperation); + return metricSource.calcOperationCreate(*this, pCalculationDesc, phCalculationOperation); } std::unique_ptr MetricScopeImp::create(zet_intel_metric_scope_properties_exp_t &scopeProperties) { @@ -1039,55 +1039,55 @@ ze_result_t metricCreateFromProgrammable( return L0::MetricProgrammable::fromHandle(hMetricProgrammable)->createMetric(pParameterValues, parameterCount, name, description, pMetricHandleCount, phMetricHandles); } -ze_result_t metricCalculateOperationCreate( +ze_result_t metricCalculationOperationCreate( zet_context_handle_t hContext, zet_device_handle_t hDevice, - zet_intel_metric_calculate_exp_desc_t *pCalculateDesc, - zet_intel_metric_calculate_operation_exp_handle_t *phCalculateOperation) { + zet_intel_metric_calculation_exp_desc_t *pCalculationDesc, + zet_intel_metric_calculation_operation_exp_handle_t *phCalculationOperation) { DeviceImp *deviceImp = static_cast(L0::Device::fromHandle(hDevice)); - return deviceImp->getMetricDeviceContext().calcOperationCreate(hContext, pCalculateDesc, phCalculateOperation); + return deviceImp->getMetricDeviceContext().calcOperationCreate(hContext, pCalculationDesc, phCalculationOperation); } -ze_result_t metricCalculateOperationDestroy( - zet_intel_metric_calculate_operation_exp_handle_t hCalculateOperation) { - return MetricCalcOp::fromHandle(hCalculateOperation)->destroy(); +ze_result_t metricCalculationOperationDestroy( + zet_intel_metric_calculation_operation_exp_handle_t hCalculationOperation) { + return MetricCalcOp::fromHandle(hCalculationOperation)->destroy(); } -ze_result_t metricCalculateGetReportFormat( - zet_intel_metric_calculate_operation_exp_handle_t hCalculateOperation, +ze_result_t metricCalculationGetReportFormat( + zet_intel_metric_calculation_operation_exp_handle_t hCalculationOperation, uint32_t *pCount, zet_metric_handle_t *phMetrics) { - return MetricCalcOp::fromHandle(hCalculateOperation)->getReportFormat(pCount, phMetrics); + return MetricCalcOp::fromHandle(hCalculationOperation)->getReportFormat(pCount, phMetrics); } -ze_result_t metricCalculateGetExcludedMetrics( - zet_intel_metric_calculate_operation_exp_handle_t hCalculateOperation, +ze_result_t metricCalculationGetExcludedMetrics( + zet_intel_metric_calculation_operation_exp_handle_t hCalculationOperation, uint32_t *pCount, zet_metric_handle_t *phMetrics) { - return MetricCalcOp::fromHandle(hCalculateOperation)->getExcludedMetrics(pCount, phMetrics); + return MetricCalcOp::fromHandle(hCalculationOperation)->getExcludedMetrics(pCount, phMetrics); } ze_result_t metricCalculateValues( const size_t rawDataSize, size_t *pOffset, const uint8_t *pRawData, - zet_intel_metric_calculate_operation_exp_handle_t hCalculateOperation, + zet_intel_metric_calculation_operation_exp_handle_t hCalculationOperation, uint32_t *pTotalMetricReportsCount, zet_intel_metric_result_exp_t *pMetricResults) { - return MetricCalcOp::fromHandle(hCalculateOperation)->metricCalculateValues(rawDataSize, pOffset, pRawData, pTotalMetricReportsCount, pMetricResults); + return MetricCalcOp::fromHandle(hCalculationOperation)->metricCalculateValues(rawDataSize, pOffset, pRawData, pTotalMetricReportsCount, pMetricResults); } ze_result_t metricCalculateMultipleValues( const size_t rawDataSize, size_t *offset, const uint8_t *pRawData, - zet_intel_metric_calculate_operation_exp_handle_t hCalculateOperation, + zet_intel_metric_calculation_operation_exp_handle_t hCalculationOperation, uint32_t *pSetCount, uint32_t *pMetricsReportCountPerSet, uint32_t *pTotalMetricReportCount, zet_intel_metric_result_exp_t *pMetricResults) { - return MetricCalcOp::fromHandle(hCalculateOperation)->metricCalculateMultipleValues(rawDataSize, offset, pRawData, pSetCount, pMetricsReportCountPerSet, pTotalMetricReportCount, pMetricResults); + return MetricCalcOp::fromHandle(hCalculationOperation)->metricCalculateMultipleValues(rawDataSize, offset, pRawData, pSetCount, pMetricsReportCountPerSet, pTotalMetricReportCount, pMetricResults); } ze_result_t metricsEnable(zet_device_handle_t hDevice) { diff --git a/level_zero/tools/source/metrics/metric.h b/level_zero/tools/source/metrics/metric.h index 17268634f2..fcd8a96f7c 100644 --- a/level_zero/tools/source/metrics/metric.h +++ b/level_zero/tools/source/metrics/metric.h @@ -106,8 +106,8 @@ class MetricSource { std::vector &metricGroupList) = 0; virtual ze_result_t appendMarker(zet_command_list_handle_t hCommandList, zet_metric_group_handle_t hMetricGroup, uint32_t value) = 0; virtual ze_result_t calcOperationCreate(MetricDeviceContext &metricDeviceContext, - zet_intel_metric_calculate_exp_desc_t *pCalculateDesc, - zet_intel_metric_calculate_operation_exp_handle_t *phCalculateOperation) = 0; + zet_intel_metric_calculation_exp_desc_t *pCalculationDesc, + zet_intel_metric_calculation_operation_exp_handle_t *phCalculationOperation) = 0; virtual bool canDisable() = 0; virtual void initMetricScopes(MetricDeviceContext &metricDeviceContext) = 0; static std::optional getHwBufferSizeDesc(zet_base_desc_t *baseDesc); @@ -179,8 +179,8 @@ class MetricDeviceContext { uint32_t *pMetricGroupCount, zet_metric_group_handle_t *phMetricGroups); ze_result_t calcOperationCreate(zet_context_handle_t hContext, - zet_intel_metric_calculate_exp_desc_t *pCalculateDesc, - zet_intel_metric_calculate_operation_exp_handle_t *phCalculateOperation); + zet_intel_metric_calculation_exp_desc_t *pCalculationDesc, + zet_intel_metric_calculation_operation_exp_handle_t *phCalculationOperation); ze_result_t metricScopesGet(zet_context_handle_t hContext, uint32_t *pMetricScopesCount, zet_intel_metric_scope_exp_handle_t *phMetricScopes); @@ -461,13 +461,13 @@ struct HomogeneousMultiDeviceMetricCreated : public MultiDeviceMetricImp { static MetricImp *create(MetricSource &metricSource, std::vector &subDeviceMetrics); }; -struct MetricCalcOp : _zet_intel_metric_calculate_operation_exp_handle_t { +struct MetricCalcOp : _zet_intel_metric_calculation_operation_exp_handle_t { virtual ~MetricCalcOp() = default; MetricCalcOp() {} - static MetricCalcOp *fromHandle(zet_intel_metric_calculate_operation_exp_handle_t handle) { + static MetricCalcOp *fromHandle(zet_intel_metric_calculation_operation_exp_handle_t handle) { return static_cast(handle); } - inline zet_intel_metric_calculate_operation_exp_handle_t toHandle() { return this; } + inline zet_intel_metric_calculation_operation_exp_handle_t toHandle() { return this; } virtual ze_result_t destroy() = 0; virtual ze_result_t getReportFormat(uint32_t *pCount, zet_metric_handle_t *phMetrics) = 0; @@ -576,29 +576,29 @@ ze_result_t metricTracerDecode(zet_metric_decoder_exp_handle_t hMetricDecoder, s uint32_t metricsCount, zet_metric_handle_t *phMetrics, uint32_t *pSetCount, uint32_t *pMetricEntriesCountPerSet, uint32_t *pMetricEntriesCount, zet_metric_entry_exp_t *pMetricEntries); -ze_result_t metricCalculateOperationCreate(zet_context_handle_t hContext, zet_device_handle_t hDevice, zet_intel_metric_calculate_exp_desc_t *pCalculateDesc, - zet_intel_metric_calculate_operation_exp_handle_t *phCalculateOperation); +ze_result_t metricCalculationOperationCreate(zet_context_handle_t hContext, zet_device_handle_t hDevice, zet_intel_metric_calculation_exp_desc_t *pCalculationDesc, + zet_intel_metric_calculation_operation_exp_handle_t *phCalculationOperation); -ze_result_t metricCalculateOperationDestroy(zet_intel_metric_calculate_operation_exp_handle_t hCalculateOperation); +ze_result_t metricCalculationOperationDestroy(zet_intel_metric_calculation_operation_exp_handle_t hCalculationOperation); -ze_result_t metricCalculateGetReportFormat(zet_intel_metric_calculate_operation_exp_handle_t hCalculateOperation, - uint32_t *pCount, zet_metric_handle_t *phMetrics); +ze_result_t metricCalculationGetReportFormat(zet_intel_metric_calculation_operation_exp_handle_t hCalculationOperation, + uint32_t *pCount, zet_metric_handle_t *phMetrics); -ze_result_t metricCalculateGetExcludedMetrics(zet_intel_metric_calculate_operation_exp_handle_t hCalculateOperation, - uint32_t *pCount, zet_metric_handle_t *phMetrics); +ze_result_t metricCalculationGetExcludedMetrics(zet_intel_metric_calculation_operation_exp_handle_t hCalculationOperation, + uint32_t *pCount, zet_metric_handle_t *phMetrics); ze_result_t metricCalculateValues(const size_t rawDataSize, size_t *pOffset, const uint8_t *pRawData, - zet_intel_metric_calculate_operation_exp_handle_t hCalculateOperation, + zet_intel_metric_calculation_operation_exp_handle_t hCalculationOperation, uint32_t *pTotalMetricReportsCount, zet_intel_metric_result_exp_t *pMetricResults); ze_result_t metricCalculateMultipleValues(const size_t rawDataSize, size_t *offset, const uint8_t *pRawData, - zet_intel_metric_calculate_operation_exp_handle_t hCalculateOperation, + zet_intel_metric_calculation_operation_exp_handle_t hCalculationOperation, uint32_t *pSetCount, uint32_t *pMetricsReportCountPerSet, uint32_t *pTotalMetricReportCount, zet_intel_metric_result_exp_t *pMetricResults); ze_result_t metricDecodeCalculateMultipleValues(zet_intel_metric_decoder_exp_handle_t hMetricDecoder, const size_t rawDataSize, size_t *offset, const uint8_t *pRawData, - zet_intel_metric_calculate_operation_exp_handle_t hCalculateOperation, + zet_intel_metric_calculation_operation_exp_handle_t hCalculationOperation, uint32_t *pSetCount, uint32_t *pMetricReportCountPerSet, uint32_t *pTotalMetricReportCount, zet_intel_metric_result_exp_t *pMetricResults); diff --git a/level_zero/tools/source/metrics/metric_device_context_create.cpp b/level_zero/tools/source/metrics/metric_device_context_create.cpp index 16ad96f3d4..0b6e0c26fd 100644 --- a/level_zero/tools/source/metrics/metric_device_context_create.cpp +++ b/level_zero/tools/source/metrics/metric_device_context_create.cpp @@ -87,7 +87,7 @@ ze_result_t metricDecodeCalculateMultipleValues( const size_t rawDataSize, size_t *offset, const uint8_t *pRawData, - zet_intel_metric_calculate_operation_exp_handle_t hCalculateOperation, + zet_intel_metric_calculation_operation_exp_handle_t hCalculationOperation, uint32_t *pSetCount, uint32_t *pMetricReportCountPerSet, uint32_t *pTotalMetricReportCount, diff --git a/level_zero/tools/source/metrics/metric_ip_sampling_source.cpp b/level_zero/tools/source/metrics/metric_ip_sampling_source.cpp index daf092f561..35f2b535a5 100644 --- a/level_zero/tools/source/metrics/metric_ip_sampling_source.cpp +++ b/level_zero/tools/source/metrics/metric_ip_sampling_source.cpp @@ -260,8 +260,8 @@ ze_result_t IpSamplingMetricSourceImp::handleMetricGroupExtendedProperties(zet_m zet_metric_group_type_exp_t *groupType = reinterpret_cast(extendedProperties); groupType->type = ZET_METRIC_GROUP_TYPE_EXP_FLAG_OTHER; retVal = ZE_RESULT_SUCCESS; - } else if (static_cast(extendedProperties->stype) == ZET_INTEL_STRUCTURE_TYPE_METRIC_GROUP_CALCULATE_EXP_PROPERTIES) { - auto calcProperties = reinterpret_cast(extendedProperties); + } else if (static_cast(extendedProperties->stype) == ZET_INTEL_STRUCTURE_TYPE_METRIC_GROUP_CALCULATION_EXP_PROPERTIES) { + auto calcProperties = reinterpret_cast(extendedProperties); calcProperties->isTimeFilterSupported = false; retVal = ZE_RESULT_SUCCESS; } @@ -273,12 +273,12 @@ ze_result_t IpSamplingMetricSourceImp::handleMetricGroupExtendedProperties(zet_m } ze_result_t IpSamplingMetricSourceImp::calcOperationCreate(MetricDeviceContext &metricDeviceContext, - zet_intel_metric_calculate_exp_desc_t *pCalculateDesc, - zet_intel_metric_calculate_operation_exp_handle_t *phCalculateOperation) { + zet_intel_metric_calculation_exp_desc_t *pCalculationDesc, + zet_intel_metric_calculation_operation_exp_handle_t *phCalculationOperation) { ze_result_t status = ZE_RESULT_ERROR_UNKNOWN; bool isMultiDevice = (metricDeviceContext.isImplicitScalingCapable()) ? true : false; - status = IpSamplingMetricCalcOpImp::create(*this, pCalculateDesc, isMultiDevice, phCalculateOperation); + status = IpSamplingMetricCalcOpImp::create(*this, pCalculationDesc, isMultiDevice, phCalculationOperation); return status; } diff --git a/level_zero/tools/source/metrics/metric_ip_sampling_source.h b/level_zero/tools/source/metrics/metric_ip_sampling_source.h index f34696152c..39a8a7d722 100644 --- a/level_zero/tools/source/metrics/metric_ip_sampling_source.h +++ b/level_zero/tools/source/metrics/metric_ip_sampling_source.h @@ -58,8 +58,8 @@ class IpSamplingMetricSourceImp : public MetricSource { activationTracker.reset(inputActivationTracker); } ze_result_t calcOperationCreate(MetricDeviceContext &metricDeviceContext, - zet_intel_metric_calculate_exp_desc_t *pCalculateDesc, - zet_intel_metric_calculate_operation_exp_handle_t *phCalculateOperation) override; + zet_intel_metric_calculation_exp_desc_t *pCalculationDesc, + zet_intel_metric_calculation_operation_exp_handle_t *phCalculationOperation) override; uint32_t metricSourceCount = 0; bool canDisable() override; diff --git a/level_zero/tools/source/metrics/metric_ip_sampling_streamer.cpp b/level_zero/tools/source/metrics/metric_ip_sampling_streamer.cpp index 2205db6f85..769d2ec297 100644 --- a/level_zero/tools/source/metrics/metric_ip_sampling_streamer.cpp +++ b/level_zero/tools/source/metrics/metric_ip_sampling_streamer.cpp @@ -106,15 +106,15 @@ uint32_t IpSamplingMetricStreamerImp::getMaxSupportedReportCount() { } ze_result_t IpSamplingMetricCalcOpImp::create(IpSamplingMetricSourceImp &metricSource, - zet_intel_metric_calculate_exp_desc_t *pCalculateDesc, + zet_intel_metric_calculation_exp_desc_t *pCalculationDesc, bool isMultiDevice, - zet_intel_metric_calculate_operation_exp_handle_t *phCalculateOperation) { + zet_intel_metric_calculation_operation_exp_handle_t *phCalculationOperation) { // There is only one valid metric group in IP sampling and time filtering is not supported // So only metrics handles are used to filter the metrics // avoid duplicates - std::set uniqueMetricHandles(pCalculateDesc->phMetrics, pCalculateDesc->phMetrics + pCalculateDesc->metricCount); + std::set uniqueMetricHandles(pCalculationDesc->phMetrics, pCalculationDesc->phMetrics + pCalculationDesc->metricCount); // The order of metrics in the report should be the same as the one in the HW report to optimize calculation uint32_t metricGroupCount = 1; @@ -129,7 +129,7 @@ ze_result_t IpSamplingMetricCalcOpImp::create(IpSamplingMetricSourceImp &metricS for (uint32_t i = 0; i < metricCount; i++) { auto metric = static_cast(Metric::fromHandle(hMetrics[i])); - if (pCalculateDesc->metricGroupCount > 0) { + if (pCalculationDesc->metricGroupCount > 0) { metricsInReport.push_back(metric); includedMetricIndexes.push_back(i); } else { @@ -143,7 +143,7 @@ ze_result_t IpSamplingMetricCalcOpImp::create(IpSamplingMetricSourceImp &metricS auto calcOp = new IpSamplingMetricCalcOpImp(static_cast(hMetrics.size()), metricsInReport, includedMetricIndexes, isMultiDevice); - *phCalculateOperation = calcOp->toHandle(); + *phCalculationOperation = calcOp->toHandle(); return ZE_RESULT_SUCCESS; } @@ -248,7 +248,7 @@ ze_result_t IpSamplingMetricCalcOpImp::metricCalculateValues(const size_t rawDat if (!isMultiDevice) { if (isMultiDeviceData) { - METRICS_LOG_ERR("%s", "Cannot use root device raw data in a sub-device calculate operation handle"); + METRICS_LOG_ERR("%s", "Cannot use root device raw data in a sub-device calculation operation handle"); return ZE_RESULT_ERROR_INVALID_ARGUMENT; } @@ -256,7 +256,7 @@ ze_result_t IpSamplingMetricCalcOpImp::metricCalculateValues(const size_t rawDat l0GfxCoreHelper, metricGroupBase, getSize, dataOverflow, stallReportDataMap); } else { if (!isMultiDeviceData) { - METRICS_LOG_ERR("%s", "Cannot use sub-device raw data in a root device calculate operation handle"); + METRICS_LOG_ERR("%s", "Cannot use sub-device raw data in a root device calculation operation handle"); return ZE_RESULT_ERROR_INVALID_ARGUMENT; } @@ -275,7 +275,7 @@ ze_result_t IpSamplingMetricCalcOpImp::metricCalculateValues(const size_t rawDat l0GfxCoreHelper.stallSumIpDataToTypedValues(it->first, it->second, ipDataValues); for (uint32_t j = 0; j < includedMetricIndexes.size(); j++) { (pMetricResults + i)->value = ipDataValues[includedMetricIndexes[j]].value; - (pMetricResults + i)->resultStatus = ZET_INTEL_METRIC_CALCULATE_EXP_RESULT_VALID; + (pMetricResults + i)->resultStatus = ZET_INTEL_METRIC_CALCULATION_EXP_RESULT_VALID; i++; } ipDataValues.clear(); diff --git a/level_zero/tools/source/metrics/metric_ip_sampling_streamer.h b/level_zero/tools/source/metrics/metric_ip_sampling_streamer.h index f1b8196880..89f6783679 100644 --- a/level_zero/tools/source/metrics/metric_ip_sampling_streamer.h +++ b/level_zero/tools/source/metrics/metric_ip_sampling_streamer.h @@ -57,9 +57,9 @@ struct IpSamplingMetricCalcOpImp : public MetricCalcOpImp { ~IpSamplingMetricCalcOpImp() override{}; static ze_result_t create(IpSamplingMetricSourceImp &metricSource, - zet_intel_metric_calculate_exp_desc_t *pCalculateDesc, + zet_intel_metric_calculation_exp_desc_t *pCalculationDesc, bool isMultiDevice, - zet_intel_metric_calculate_operation_exp_handle_t *phCalculateOperation); + zet_intel_metric_calculation_operation_exp_handle_t *phCalculationOperation); ze_result_t destroy() override; ze_result_t metricCalculateMultipleValues(const size_t rawDataSize, size_t *offset, const uint8_t *pRawData, uint32_t *pSetCount, uint32_t *pMetricsReportCountPerSet, diff --git a/level_zero/tools/source/metrics/metric_oa_source.cpp b/level_zero/tools/source/metrics/metric_oa_source.cpp index d41b7e444e..23f57ae7e8 100644 --- a/level_zero/tools/source/metrics/metric_oa_source.cpp +++ b/level_zero/tools/source/metrics/metric_oa_source.cpp @@ -227,8 +227,8 @@ ze_result_t OaMetricSourceImp::handleMetricGroupExtendedProperties(zet_metric_gr zet_metric_group_type_exp_t *groupType = reinterpret_cast(extendedProperties); groupType->type = ZET_METRIC_GROUP_TYPE_EXP_FLAG_OTHER; retVal = ZE_RESULT_SUCCESS; - } else if (static_cast(extendedProperties->stype) == ZET_INTEL_STRUCTURE_TYPE_METRIC_GROUP_CALCULATE_EXP_PROPERTIES) { - auto calcProperties = reinterpret_cast(extendedProperties); + } else if (static_cast(extendedProperties->stype) == ZET_INTEL_STRUCTURE_TYPE_METRIC_GROUP_CALCULATION_EXP_PROPERTIES) { + auto calcProperties = reinterpret_cast(extendedProperties); if (pBaseProperties->samplingType == ZET_METRIC_GROUP_SAMPLING_TYPE_FLAG_TIME_BASED) { calcProperties->isTimeFilterSupported = true; } else { diff --git a/level_zero/tools/source/metrics/metric_oa_source.h b/level_zero/tools/source/metrics/metric_oa_source.h index a1dc9d93d8..4e3c3b4c5c 100644 --- a/level_zero/tools/source/metrics/metric_oa_source.h +++ b/level_zero/tools/source/metrics/metric_oa_source.h @@ -65,8 +65,8 @@ class OaMetricSourceImp : public MetricSource { zet_metric_group_sampling_type_flag_t samplingType, zet_metric_group_handle_t *pMetricGroupHandle); ze_result_t calcOperationCreate(MetricDeviceContext &metricDeviceContext, - zet_intel_metric_calculate_exp_desc_t *pCalculateDesc, - zet_intel_metric_calculate_operation_exp_handle_t *phCalculateOperation) override { + zet_intel_metric_calculation_exp_desc_t *pCalculationDesc, + zet_intel_metric_calculation_operation_exp_handle_t *phCalculationOperation) override { return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } bool canDisable() override; diff --git a/level_zero/tools/test/unit_tests/sources/metrics/mock_metric_source.h b/level_zero/tools/test/unit_tests/sources/metrics/mock_metric_source.h index 50f1a51d52..300c7bf043 100644 --- a/level_zero/tools/test/unit_tests/sources/metrics/mock_metric_source.h +++ b/level_zero/tools/test/unit_tests/sources/metrics/mock_metric_source.h @@ -50,8 +50,8 @@ class MockMetricSource : public L0::MetricSource { } ze_result_t calcOperationCreate(MetricDeviceContext &metricDeviceContext, - zet_intel_metric_calculate_exp_desc_t *pCalculateDesc, - zet_intel_metric_calculate_operation_exp_handle_t *phCalculateOperation) override { + zet_intel_metric_calculation_exp_desc_t *pCalculationDesc, + zet_intel_metric_calculation_operation_exp_handle_t *phCalculationOperation) override { return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } bool canDisable() override { return false; } diff --git a/level_zero/tools/test/unit_tests/sources/metrics/test_metric.cpp b/level_zero/tools/test/unit_tests/sources/metrics/test_metric.cpp index 7b282fb280..4bbdfbcb50 100644 --- a/level_zero/tools/test/unit_tests/sources/metrics/test_metric.cpp +++ b/level_zero/tools/test/unit_tests/sources/metrics/test_metric.cpp @@ -69,29 +69,29 @@ void CalcOperationFixture::TearDown() { TEST_F(CalcOperationFixture, WhenCreatingCalcOpAndInvalidParamsPassedThenErrorIsHandled) { // Aggregation window is zero - zet_intel_metric_calculate_exp_desc_t calculateDesc{ - ZET_INTEL_STRUCTURE_TYPE_METRIC_CALCULATE_DESC_EXP, + zet_intel_metric_calculation_exp_desc_t calculationDesc{ + ZET_INTEL_STRUCTURE_TYPE_METRIC_CALCULATION_DESC_EXP, nullptr, // pNext 1, // metricGroupCount &phMetricGroup, // phMetricGroups 0, // metricCount nullptr, // phMetrics 0, // timeWindowsCount - nullptr, // pCalculateTimeWindows + nullptr, // pCalculationTimeWindows 0, // timeAggregationWindow, zero is not accepted }; - zet_intel_metric_calculate_operation_exp_handle_t hCalculateOperation; - EXPECT_EQ(ZE_RESULT_ERROR_INVALID_ARGUMENT, zetIntelMetricCalculateOperationCreateExp(context->toHandle(), - device->toHandle(), &calculateDesc, - &hCalculateOperation)); + zet_intel_metric_calculation_operation_exp_handle_t hCalculationOperation; + EXPECT_EQ(ZE_RESULT_ERROR_INVALID_ARGUMENT, zetIntelMetricCalculationOperationCreateExp(context->toHandle(), + device->toHandle(), &calculationDesc, + &hCalculationOperation)); // No metric groups or metrics - calculateDesc.timeAggregationWindow = 100; - calculateDesc.metricGroupCount = 0; - EXPECT_EQ(ZE_RESULT_ERROR_INVALID_ARGUMENT, zetIntelMetricCalculateOperationCreateExp(context->toHandle(), - device->toHandle(), &calculateDesc, - &hCalculateOperation)); + calculationDesc.timeAggregationWindow = 100; + calculationDesc.metricGroupCount = 0; + EXPECT_EQ(ZE_RESULT_ERROR_INVALID_ARGUMENT, zetIntelMetricCalculationOperationCreateExp(context->toHandle(), + device->toHandle(), &calculationDesc, + &hCalculationOperation)); } TEST_F(CalcOperationFixture, WhenCreatingCalcOpWithMixedSourcesThenErrorIsReturned) { @@ -102,42 +102,42 @@ TEST_F(CalcOperationFixture, WhenCreatingCalcOpWithMixedSourcesThenErrorIsReturn // metric groups from different source std::vector metricGroups{phMetricGroup, mockMetricGroup2.toHandle()}; - zet_intel_metric_calculate_exp_desc_t calculateDesc{ - ZET_INTEL_STRUCTURE_TYPE_METRIC_CALCULATE_DESC_EXP, + zet_intel_metric_calculation_exp_desc_t calculationDesc{ + ZET_INTEL_STRUCTURE_TYPE_METRIC_CALCULATION_DESC_EXP, nullptr, // pNext 2, // metricGroupCount metricGroups.data(), // phMetricGroups 0, // metricCount nullptr, // phMetrics 0, // timeWindowsCount - nullptr, // pCalculateTimeWindows + nullptr, // pCalculationTimeWindows 1000, // timeAggregationWindow }; - zet_intel_metric_calculate_operation_exp_handle_t hCalculateOperation; - EXPECT_EQ(ZE_RESULT_ERROR_INVALID_ARGUMENT, zetIntelMetricCalculateOperationCreateExp(context, - device->toHandle(), &calculateDesc, - &hCalculateOperation)); + zet_intel_metric_calculation_operation_exp_handle_t hCalculationOperation; + EXPECT_EQ(ZE_RESULT_ERROR_INVALID_ARGUMENT, zetIntelMetricCalculationOperationCreateExp(context, + device->toHandle(), &calculationDesc, + &hCalculationOperation)); // metrics from different source MockMetric mockMetric(mockMetricSource); MockMetric mockMetric2(mockMetricSource2); std::vector metrics{mockMetric.toHandle(), mockMetric2.toHandle()}; - calculateDesc.metricGroupCount = 1; - calculateDesc.phMetricGroups = &phMetricGroup; - calculateDesc.metricCount = 2; - calculateDesc.phMetrics = metrics.data(); - EXPECT_EQ(ZE_RESULT_ERROR_INVALID_ARGUMENT, zetIntelMetricCalculateOperationCreateExp(context, - device->toHandle(), &calculateDesc, - &hCalculateOperation)); + calculationDesc.metricGroupCount = 1; + calculationDesc.phMetricGroups = &phMetricGroup; + calculationDesc.metricCount = 2; + calculationDesc.phMetrics = metrics.data(); + EXPECT_EQ(ZE_RESULT_ERROR_INVALID_ARGUMENT, zetIntelMetricCalculationOperationCreateExp(context, + device->toHandle(), &calculationDesc, + &hCalculationOperation)); // metrics and metric group from different source - calculateDesc.metricCount = 1; - calculateDesc.phMetrics = &metrics[1]; - EXPECT_EQ(ZE_RESULT_ERROR_INVALID_ARGUMENT, zetIntelMetricCalculateOperationCreateExp(context, - device->toHandle(), &calculateDesc, - &hCalculateOperation)); + calculationDesc.metricCount = 1; + calculationDesc.phMetrics = &metrics[1]; + EXPECT_EQ(ZE_RESULT_ERROR_INVALID_ARGUMENT, zetIntelMetricCalculationOperationCreateExp(context, + device->toHandle(), &calculationDesc, + &hCalculationOperation)); } TEST_F(CalcOperationFixture, WhenCreatingCalcOpWithMixedHierarchiesThenErrorIsReturned) { @@ -146,35 +146,35 @@ TEST_F(CalcOperationFixture, WhenCreatingCalcOpWithMixedHierarchiesThenErrorIsRe // metric groups from different hierarchy std::vector metricGroups{phMetricGroup, mockMetricGroup2.toHandle()}; - zet_intel_metric_calculate_exp_desc_t calculateDesc{ - ZET_INTEL_STRUCTURE_TYPE_METRIC_CALCULATE_DESC_EXP, + zet_intel_metric_calculation_exp_desc_t calculationDesc{ + ZET_INTEL_STRUCTURE_TYPE_METRIC_CALCULATION_DESC_EXP, nullptr, // pNext 2, // metricGroupCount metricGroups.data(), // phMetricGroups 0, // metricCount nullptr, // phMetrics 0, // timeWindowsCount - nullptr, // pCalculateTimeWindows + nullptr, // pCalculationTimeWindows 1000, // timeAggregationWindow }; - zet_intel_metric_calculate_operation_exp_handle_t hCalculateOperation; - EXPECT_EQ(ZE_RESULT_ERROR_INVALID_ARGUMENT, zetIntelMetricCalculateOperationCreateExp(context, - device->toHandle(), &calculateDesc, - &hCalculateOperation)); + zet_intel_metric_calculation_operation_exp_handle_t hCalculationOperation; + EXPECT_EQ(ZE_RESULT_ERROR_INVALID_ARGUMENT, zetIntelMetricCalculationOperationCreateExp(context, + device->toHandle(), &calculationDesc, + &hCalculationOperation)); MockMetric mockMetric(mockMetricSource), mockMetric2(mockMetricSource); mockMetric2.setMultiDevice(true); std::vector metrics{mockMetric.toHandle(), mockMetric2.toHandle()}; - calculateDesc.metricGroupCount = 1; - calculateDesc.phMetricGroups = &phMetricGroup; - calculateDesc.metricCount = 2; - calculateDesc.phMetrics = metrics.data(); - EXPECT_EQ(ZE_RESULT_ERROR_INVALID_ARGUMENT, zetIntelMetricCalculateOperationCreateExp(context, - device->toHandle(), &calculateDesc, - &hCalculateOperation)); + calculationDesc.metricGroupCount = 1; + calculationDesc.phMetricGroups = &phMetricGroup; + calculationDesc.metricCount = 2; + calculationDesc.phMetrics = metrics.data(); + EXPECT_EQ(ZE_RESULT_ERROR_INVALID_ARGUMENT, zetIntelMetricCalculationOperationCreateExp(context, + device->toHandle(), &calculationDesc, + &hCalculationOperation)); } TEST_F(CalcOperationFixture, WhenCreatingCalcOpUseTheSourceFromMetricGroupOrMetricWhenAvailable) { @@ -182,33 +182,33 @@ TEST_F(CalcOperationFixture, WhenCreatingCalcOpUseTheSourceFromMetricGroupOrMetr MockMetricGroup mockMetricGroup2(mockMetricSource); std::vector metricGroups{phMetricGroup, mockMetricGroup2.toHandle()}; - zet_intel_metric_calculate_exp_desc_t calculateDesc{ - ZET_INTEL_STRUCTURE_TYPE_METRIC_CALCULATE_DESC_EXP, + zet_intel_metric_calculation_exp_desc_t calculationDesc{ + ZET_INTEL_STRUCTURE_TYPE_METRIC_CALCULATION_DESC_EXP, nullptr, // pNext 2, // metricGroupCount metricGroups.data(), // phMetricGroups 0, // metricCount nullptr, // phMetrics 0, // timeWindowsCount - nullptr, // pCalculateTimeWindows + nullptr, // pCalculationTimeWindows 1000, // timeAggregationWindow }; - zet_intel_metric_calculate_operation_exp_handle_t hCalculateOperation; - EXPECT_EQ(ZE_RESULT_ERROR_UNSUPPORTED_FEATURE, zetIntelMetricCalculateOperationCreateExp(context, - device->toHandle(), &calculateDesc, - &hCalculateOperation)); + zet_intel_metric_calculation_operation_exp_handle_t hCalculationOperation; + EXPECT_EQ(ZE_RESULT_ERROR_UNSUPPORTED_FEATURE, zetIntelMetricCalculationOperationCreateExp(context, + device->toHandle(), &calculationDesc, + &hCalculationOperation)); MockMetric mockMetric(mockMetricSource), mockMetric2(mockMetricSource); std::vector metrics{mockMetric.toHandle(), mockMetric.toHandle()}; - calculateDesc.metricGroupCount = 0; - calculateDesc.phMetricGroups = nullptr; - calculateDesc.metricCount = 2; - calculateDesc.phMetrics = metrics.data(); - EXPECT_EQ(ZE_RESULT_ERROR_UNSUPPORTED_FEATURE, zetIntelMetricCalculateOperationCreateExp(context, - device->toHandle(), &calculateDesc, - &hCalculateOperation)); + calculationDesc.metricGroupCount = 0; + calculationDesc.phMetricGroups = nullptr; + calculationDesc.metricCount = 2; + calculationDesc.phMetrics = metrics.data(); + EXPECT_EQ(ZE_RESULT_ERROR_UNSUPPORTED_FEATURE, zetIntelMetricCalculationOperationCreateExp(context, + device->toHandle(), &calculationDesc, + &hCalculationOperation)); } TEST_F(CalcOperationFixture, WhenCreatingCalcOpObjectToAndFromHandleBaseClassWorkAsExpected) { @@ -219,7 +219,7 @@ TEST_F(CalcOperationFixture, WhenCreatingCalcOpObjectToAndFromHandleBaseClassWor MockMetricCalcOp mockMetricCalcOp(false, mockMetricsInReport, mockExcludedMetricCount, mockExcludedMetrics); auto hMockCalcOp = mockMetricCalcOp.toHandle(); - EXPECT_EQ(ZE_RESULT_ERROR_UNSUPPORTED_FEATURE, zetIntelMetricCalculateOperationDestroyExp(hMockCalcOp)); + EXPECT_EQ(ZE_RESULT_ERROR_UNSUPPORTED_FEATURE, zetIntelMetricCalculationOperationDestroyExp(hMockCalcOp)); EXPECT_EQ(false, mockMetricCalcOp.isRootDevice()); auto mockCalcOp = MetricCalcOp::fromHandle(hMockCalcOp); EXPECT_NE(nullptr, mockCalcOp); @@ -237,20 +237,20 @@ TEST_F(CalcOperationFixture, WhenGettingMetricsInReportAndExcludedMetricsThenThe MockMetricCalcOp mockMetricCalcOp(false, mockMetricsInReport, mockExcludedMetricCount, mockExcludedMetrics); uint32_t metricCount = 0; - EXPECT_EQ(ZE_RESULT_SUCCESS, zetIntelMetricCalculateOperationGetReportFormatExp(mockMetricCalcOp.toHandle(), &metricCount, nullptr)); + EXPECT_EQ(ZE_RESULT_SUCCESS, zetIntelMetricCalculationOperationGetReportFormatExp(mockMetricCalcOp.toHandle(), &metricCount, nullptr)); EXPECT_EQ(metricCount, 1U); zet_metric_handle_t metricHandle = nullptr; - EXPECT_EQ(ZE_RESULT_SUCCESS, zetIntelMetricCalculateOperationGetReportFormatExp(mockMetricCalcOp.toHandle(), &metricCount, &metricHandle)); + EXPECT_EQ(ZE_RESULT_SUCCESS, zetIntelMetricCalculationOperationGetReportFormatExp(mockMetricCalcOp.toHandle(), &metricCount, &metricHandle)); EXPECT_EQ(metricCount, 1U); EXPECT_EQ(metricHandle, mockMetricInReport.toHandle()); EXPECT_EQ(metricCount, mockMetricCalcOp.getMetricsInReportCount()); metricCount = 0; - EXPECT_EQ(ZE_RESULT_SUCCESS, zetIntelMetricCalculateOperationGetExcludedMetricsExp(mockMetricCalcOp.toHandle(), &metricCount, nullptr)); + EXPECT_EQ(ZE_RESULT_SUCCESS, zetIntelMetricCalculationOperationGetExcludedMetricsExp(mockMetricCalcOp.toHandle(), &metricCount, nullptr)); EXPECT_EQ(metricCount, 1U); zet_metric_handle_t excludedMetricHandle = nullptr; - EXPECT_EQ(ZE_RESULT_SUCCESS, zetIntelMetricCalculateOperationGetExcludedMetricsExp(mockMetricCalcOp.toHandle(), &metricCount, &excludedMetricHandle)); + EXPECT_EQ(ZE_RESULT_SUCCESS, zetIntelMetricCalculationOperationGetExcludedMetricsExp(mockMetricCalcOp.toHandle(), &metricCount, &excludedMetricHandle)); EXPECT_EQ(metricCount, 1U); EXPECT_EQ(excludedMetricHandle, mockExcludedMetric.toHandle()); EXPECT_NE(excludedMetricHandle, metricHandle); diff --git a/level_zero/tools/test/unit_tests/sources/metrics/test_metric_ip_sampling_enumeration.cpp b/level_zero/tools/test/unit_tests/sources/metrics/test_metric_ip_sampling_enumeration.cpp index 79545255d0..28ad97662a 100644 --- a/level_zero/tools/test/unit_tests/sources/metrics/test_metric_ip_sampling_enumeration.cpp +++ b/level_zero/tools/test/unit_tests/sources/metrics/test_metric_ip_sampling_enumeration.cpp @@ -179,7 +179,7 @@ using DriverExtensionsTest = Test; TEST_F(DriverExtensionsTest, givenDriverHandleWhenAskingForExtensionsThenReturnCorrectVersions) { verifyExtensionDefinition(ZET_INTEL_METRIC_SOURCE_ID_EXP_NAME, ZET_INTEL_METRIC_SOURCE_ID_EXP_VERSION_CURRENT); - verifyExtensionDefinition(ZET_INTEL_METRIC_CALCULATE_EXP_NAME, ZET_INTEL_METRIC_CALCULATE_EXP_VERSION_CURRENT); + verifyExtensionDefinition(ZET_INTEL_METRIC_CALCULATION_EXP_NAME, ZET_INTEL_METRIC_CALCULATION_EXP_VERSION_CURRENT); } struct TestMetricProperties { diff --git a/level_zero/tools/test/unit_tests/sources/metrics/test_metric_ip_sampling_streamer.cpp b/level_zero/tools/test/unit_tests/sources/metrics/test_metric_ip_sampling_streamer.cpp index e2e15bab93..9c513d7b2e 100644 --- a/level_zero/tools/test/unit_tests/sources/metrics/test_metric_ip_sampling_streamer.cpp +++ b/level_zero/tools/test/unit_tests/sources/metrics/test_metric_ip_sampling_streamer.cpp @@ -597,23 +597,23 @@ HWTEST2_F(MetricIpSamplingCalcOpMultiDevTest, givenIpSamplingMetricGroupThenCrea EXPECT_EQ(metricGroupCount, 1u); EXPECT_NE(metricGroupHandle, nullptr); - zet_intel_metric_calculate_exp_desc_t calculateDesc{ - ZET_INTEL_STRUCTURE_TYPE_METRIC_CALCULATE_DESC_EXP, + zet_intel_metric_calculation_exp_desc_t calculationDesc{ + ZET_INTEL_STRUCTURE_TYPE_METRIC_CALCULATION_DESC_EXP, nullptr, // pNext 1, // metricGroupCount &metricGroupHandle, // phMetricGroups 0, // metricCount nullptr, // phMetrics 0, // timeWindowsCount - nullptr, // pCalculateTimeWindows + nullptr, // pCalculationTimeWindows 1000, // timeAggregationWindow }; - zet_intel_metric_calculate_operation_exp_handle_t hCalculateOperation; - EXPECT_EQ(ZE_RESULT_SUCCESS, zetIntelMetricCalculateOperationCreateExp(context->toHandle(), - device->toHandle(), &calculateDesc, - &hCalculateOperation)); - EXPECT_EQ(ZE_RESULT_SUCCESS, zetIntelMetricCalculateOperationDestroyExp(hCalculateOperation)); + zet_intel_metric_calculation_operation_exp_handle_t hCalculationOperation; + EXPECT_EQ(ZE_RESULT_SUCCESS, zetIntelMetricCalculationOperationCreateExp(context->toHandle(), + device->toHandle(), &calculationDesc, + &hCalculationOperation)); + EXPECT_EQ(ZE_RESULT_SUCCESS, zetIntelMetricCalculationOperationDestroyExp(hCalculationOperation)); uint32_t metricCount = 0; EXPECT_EQ(zetMetricGet(metricGroupHandle, &metricCount, nullptr), ZE_RESULT_SUCCESS); @@ -622,13 +622,13 @@ HWTEST2_F(MetricIpSamplingCalcOpMultiDevTest, givenIpSamplingMetricGroupThenCrea metricCount = 1; EXPECT_EQ(zetMetricGet(metricGroupHandle, &metricCount, &phMetric), ZE_RESULT_SUCCESS); - calculateDesc.metricGroupCount = 0; - calculateDesc.metricCount = 1; - calculateDesc.phMetrics = &phMetric; - EXPECT_EQ(ZE_RESULT_SUCCESS, zetIntelMetricCalculateOperationCreateExp(context->toHandle(), - device->toHandle(), &calculateDesc, - &hCalculateOperation)); - EXPECT_EQ(ZE_RESULT_SUCCESS, zetIntelMetricCalculateOperationDestroyExp(hCalculateOperation)); + calculationDesc.metricGroupCount = 0; + calculationDesc.metricCount = 1; + calculationDesc.phMetrics = &phMetric; + EXPECT_EQ(ZE_RESULT_SUCCESS, zetIntelMetricCalculationOperationCreateExp(context->toHandle(), + device->toHandle(), &calculationDesc, + &hCalculationOperation)); + EXPECT_EQ(ZE_RESULT_SUCCESS, zetIntelMetricCalculationOperationDestroyExp(hCalculationOperation)); } } @@ -644,30 +644,30 @@ HWTEST2_F(MetricIpSamplingCalcOpMultiDevTest, givenIpSamplingCalcOpCanGetReportF EXPECT_EQ(metricGroupCount, 1u); EXPECT_NE(metricGroupHandle, nullptr); - zet_intel_metric_calculate_exp_desc_t calculateDesc{ - ZET_INTEL_STRUCTURE_TYPE_METRIC_CALCULATE_DESC_EXP, + zet_intel_metric_calculation_exp_desc_t calculationDesc{ + ZET_INTEL_STRUCTURE_TYPE_METRIC_CALCULATION_DESC_EXP, nullptr, // pNext 1, // metricGroupCount &metricGroupHandle, // phMetricGroups 0, // metricCount nullptr, // phMetrics 0, // timeWindowsCount - nullptr, // pCalculateTimeWindows + nullptr, // pCalculationTimeWindows 1000, // timeAggregationWindow }; - zet_intel_metric_calculate_operation_exp_handle_t hCalculateOperation; + zet_intel_metric_calculation_operation_exp_handle_t hCalculationOperation; - EXPECT_EQ(ZE_RESULT_SUCCESS, zetIntelMetricCalculateOperationCreateExp(context->toHandle(), - device->toHandle(), &calculateDesc, - &hCalculateOperation)); + EXPECT_EQ(ZE_RESULT_SUCCESS, zetIntelMetricCalculationOperationCreateExp(context->toHandle(), + device->toHandle(), &calculationDesc, + &hCalculationOperation)); uint32_t metricsInReportCount = 0; - EXPECT_EQ(ZE_RESULT_SUCCESS, zetIntelMetricCalculateOperationGetReportFormatExp(hCalculateOperation, &metricsInReportCount, nullptr)); + EXPECT_EQ(ZE_RESULT_SUCCESS, zetIntelMetricCalculationOperationGetReportFormatExp(hCalculationOperation, &metricsInReportCount, nullptr)); EXPECT_EQ(metricsInReportCount, 10u); std::vector metricsInReport(metricsInReportCount); - EXPECT_EQ(ZE_RESULT_SUCCESS, zetIntelMetricCalculateOperationGetReportFormatExp(hCalculateOperation, &metricsInReportCount, metricsInReport.data())); + EXPECT_EQ(ZE_RESULT_SUCCESS, zetIntelMetricCalculationOperationGetReportFormatExp(hCalculationOperation, &metricsInReportCount, metricsInReport.data())); EXPECT_EQ(metricsInReportCount, 10u); zet_metric_properties_t ipSamplingMetricProperties = {}; @@ -679,9 +679,9 @@ HWTEST2_F(MetricIpSamplingCalcOpMultiDevTest, givenIpSamplingCalcOpCanGetReportF // Can't filter metrics in report metricsInReportCount = 1; - EXPECT_EQ(ZE_RESULT_ERROR_INVALID_ARGUMENT, zetIntelMetricCalculateOperationGetReportFormatExp(hCalculateOperation, &metricsInReportCount, metricsInReport.data())); + EXPECT_EQ(ZE_RESULT_ERROR_INVALID_ARGUMENT, zetIntelMetricCalculationOperationGetReportFormatExp(hCalculationOperation, &metricsInReportCount, metricsInReport.data())); - EXPECT_EQ(ZE_RESULT_SUCCESS, zetIntelMetricCalculateOperationDestroyExp(hCalculateOperation)); + EXPECT_EQ(ZE_RESULT_SUCCESS, zetIntelMetricCalculationOperationDestroyExp(hCalculationOperation)); } } @@ -715,29 +715,29 @@ HWTEST2_F(MetricIpSamplingCalcOpMultiDevTest, givenIpSamplingCalcOpGetReportForm uint32_t metricsToCalculateCount = static_cast(metricsToCalculate.size()); EXPECT_EQ(metricsToCalculateCount, 5u); - zet_intel_metric_calculate_exp_desc_t calculateDesc{ - ZET_INTEL_STRUCTURE_TYPE_METRIC_CALCULATE_DESC_EXP, + zet_intel_metric_calculation_exp_desc_t calculationDesc{ + ZET_INTEL_STRUCTURE_TYPE_METRIC_CALCULATION_DESC_EXP, nullptr, // pNext 0, // metricGroupCount nullptr, // phMetricGroups metricsToCalculateCount, // metricCount metricsToCalculate.data(), // phMetrics 0, // timeWindowsCount - nullptr, // pCalculateTimeWindows + nullptr, // pCalculationTimeWindows 1000, // timeAggregationWindow }; - zet_intel_metric_calculate_operation_exp_handle_t hCalculateOperation; - EXPECT_EQ(ZE_RESULT_SUCCESS, zetIntelMetricCalculateOperationCreateExp(context->toHandle(), - device->toHandle(), &calculateDesc, - &hCalculateOperation)); + zet_intel_metric_calculation_operation_exp_handle_t hCalculationOperation; + EXPECT_EQ(ZE_RESULT_SUCCESS, zetIntelMetricCalculationOperationCreateExp(context->toHandle(), + device->toHandle(), &calculationDesc, + &hCalculationOperation)); uint32_t metricsInReportCount = 0; - EXPECT_EQ(ZE_RESULT_SUCCESS, zetIntelMetricCalculateOperationGetReportFormatExp(hCalculateOperation, &metricsInReportCount, nullptr)); + EXPECT_EQ(ZE_RESULT_SUCCESS, zetIntelMetricCalculationOperationGetReportFormatExp(hCalculationOperation, &metricsInReportCount, nullptr)); EXPECT_EQ(metricsInReportCount, 5u); std::vector metricsInReport(metricsInReportCount); - EXPECT_EQ(ZE_RESULT_SUCCESS, zetIntelMetricCalculateOperationGetReportFormatExp(hCalculateOperation, &metricsInReportCount, metricsInReport.data())); + EXPECT_EQ(ZE_RESULT_SUCCESS, zetIntelMetricCalculationOperationGetReportFormatExp(hCalculationOperation, &metricsInReportCount, metricsInReport.data())); EXPECT_EQ(metricsInReportCount, 5u); // Metrics must be in the report but can be in different order @@ -746,7 +746,7 @@ HWTEST2_F(MetricIpSamplingCalcOpMultiDevTest, givenIpSamplingCalcOpGetReportForm EXPECT_NE(it, metricsInReport.end()); } - EXPECT_EQ(ZE_RESULT_SUCCESS, zetIntelMetricCalculateOperationDestroyExp(hCalculateOperation)); + EXPECT_EQ(ZE_RESULT_SUCCESS, zetIntelMetricCalculationOperationDestroyExp(hCalculationOperation)); } } @@ -762,29 +762,29 @@ HWTEST2_F(MetricIpSamplingCalcOpMultiDevTest, givenIpSamplingCalcOpCanGetExclude EXPECT_EQ(metricGroupCount, 1u); EXPECT_NE(metricGroupHandle, nullptr); - zet_intel_metric_calculate_exp_desc_t calculateDesc{ - ZET_INTEL_STRUCTURE_TYPE_METRIC_CALCULATE_DESC_EXP, + zet_intel_metric_calculation_exp_desc_t calculationDesc{ + ZET_INTEL_STRUCTURE_TYPE_METRIC_CALCULATION_DESC_EXP, nullptr, // pNext 1, // metricGroupCount &metricGroupHandle, // phMetricGroups 0, // metricCount nullptr, // phMetrics 0, // timeWindowsCount - nullptr, // pCalculateTimeWindows + nullptr, // pCalculationTimeWindows 1000, // timeAggregationWindow }; - zet_intel_metric_calculate_operation_exp_handle_t hCalculateOperation; + zet_intel_metric_calculation_operation_exp_handle_t hCalculationOperation; - EXPECT_EQ(ZE_RESULT_SUCCESS, zetIntelMetricCalculateOperationCreateExp(context->toHandle(), - device->toHandle(), &calculateDesc, - &hCalculateOperation)); + EXPECT_EQ(ZE_RESULT_SUCCESS, zetIntelMetricCalculationOperationCreateExp(context->toHandle(), + device->toHandle(), &calculationDesc, + &hCalculationOperation)); uint32_t excludedMetricsCount = 0; - EXPECT_EQ(ZE_RESULT_SUCCESS, zetIntelMetricCalculateOperationGetExcludedMetricsExp(hCalculateOperation, &excludedMetricsCount, nullptr)); + EXPECT_EQ(ZE_RESULT_SUCCESS, zetIntelMetricCalculationOperationGetExcludedMetricsExp(hCalculationOperation, &excludedMetricsCount, nullptr)); EXPECT_EQ(excludedMetricsCount, 0u); - EXPECT_EQ(ZE_RESULT_SUCCESS, zetIntelMetricCalculateOperationDestroyExp(hCalculateOperation)); + EXPECT_EQ(ZE_RESULT_SUCCESS, zetIntelMetricCalculationOperationDestroyExp(hCalculationOperation)); } } @@ -804,8 +804,8 @@ HWTEST2_F(MetricIpSamplingCalcOpMultiDevTest, WhenReadingMetricGroupTimeCalculat ASSERT_EQ(zetMetricGroupGet(device->toHandle(), &metricGroupCount, metricGroups.data()), ZE_RESULT_SUCCESS); ASSERT_NE(metricGroups[0], nullptr); - zet_intel_metric_group_calculate_properties_exp_t metricGroupCalcProps{}; - metricGroupCalcProps.stype = ZET_INTEL_STRUCTURE_TYPE_METRIC_GROUP_CALCULATE_EXP_PROPERTIES; + zet_intel_metric_group_calculation_properties_exp_t metricGroupCalcProps{}; + metricGroupCalcProps.stype = ZET_INTEL_STRUCTURE_TYPE_METRIC_GROUP_CALCULATION_EXP_PROPERTIES; metricGroupCalcProps.pNext = nullptr; metricGroupCalcProps.isTimeFilterSupported = true; @@ -831,27 +831,27 @@ HWTEST2_F(MetricIpSamplingCalcOpTest, GivenIpSamplingCalcOpCallingMetricCalculat EXPECT_EQ(metricGroupCount, 1u); EXPECT_NE(metricGroupHandle, nullptr); - zet_intel_metric_calculate_exp_desc_t calculateDesc{ - ZET_INTEL_STRUCTURE_TYPE_METRIC_CALCULATE_DESC_EXP, + zet_intel_metric_calculation_exp_desc_t calculationDesc{ + ZET_INTEL_STRUCTURE_TYPE_METRIC_CALCULATION_DESC_EXP, nullptr, // pNext 1, // metricGroupCount &metricGroupHandle, // phMetricGroups 0, // metricCount nullptr, // phMetrics 0, // timeWindowsCount - nullptr, // pCalculateTimeWindows + nullptr, // pCalculationTimeWindows 1000, // timeAggregationWindow }; - zet_intel_metric_calculate_operation_exp_handle_t hCalculateOperation; - EXPECT_EQ(ZE_RESULT_SUCCESS, zetIntelMetricCalculateOperationCreateExp(context->toHandle(), - device->toHandle(), &calculateDesc, - &hCalculateOperation)); + zet_intel_metric_calculation_operation_exp_handle_t hCalculationOperation; + EXPECT_EQ(ZE_RESULT_SUCCESS, zetIntelMetricCalculationOperationCreateExp(context->toHandle(), + device->toHandle(), &calculationDesc, + &hCalculationOperation)); uint32_t metricsInReportCount = 10; std::vector metricsInReport(metricsInReportCount); - EXPECT_EQ(ZE_RESULT_SUCCESS, zetIntelMetricCalculateOperationGetReportFormatExp(hCalculateOperation, - &metricsInReportCount, - metricsInReport.data())); + EXPECT_EQ(ZE_RESULT_SUCCESS, zetIntelMetricCalculationOperationGetReportFormatExp(hCalculationOperation, + &metricsInReportCount, + metricsInReport.data())); EXPECT_EQ(metricsInReportCount, 10u); std::vector metricProperties(metricsInReportCount); @@ -862,13 +862,13 @@ HWTEST2_F(MetricIpSamplingCalcOpTest, GivenIpSamplingCalcOpCallingMetricCalculat uint32_t totalMetricReportCount = 0; size_t offset = 0; EXPECT_EQ(ZE_RESULT_SUCCESS, zetIntelMetricCalculateValuesExp(rawDataVectorSize, &offset, - reinterpret_cast(rawDataVector.data()), hCalculateOperation, + reinterpret_cast(rawDataVector.data()), hCalculationOperation, &totalMetricReportCount, nullptr)); EXPECT_EQ(totalMetricReportCount, 3U); std::vector metricResults(totalMetricReportCount * metricsInReportCount); EXPECT_EQ(ZE_RESULT_SUCCESS, zetIntelMetricCalculateValuesExp(rawDataVectorSize, &offset, - reinterpret_cast(rawDataVector.data()), hCalculateOperation, + reinterpret_cast(rawDataVector.data()), hCalculationOperation, &totalMetricReportCount, metricResults.data())); EXPECT_EQ(totalMetricReportCount, 3U); EXPECT_EQ(offset, rawDataVectorSize); @@ -878,11 +878,11 @@ HWTEST2_F(MetricIpSamplingCalcOpTest, GivenIpSamplingCalcOpCallingMetricCalculat uint32_t resultIndex = i * metricsInReportCount + j; EXPECT_TRUE(metricProperties[j].resultType == expectedMetricValues[resultIndex].type); EXPECT_TRUE(metricResults[resultIndex].value.ui64 == expectedMetricValues[resultIndex].value.ui64); - EXPECT_TRUE(metricResults[resultIndex].resultStatus == ZET_INTEL_METRIC_CALCULATE_EXP_RESULT_VALID); + EXPECT_TRUE(metricResults[resultIndex].resultStatus == ZET_INTEL_METRIC_CALCULATION_EXP_RESULT_VALID); } } - EXPECT_EQ(ZE_RESULT_SUCCESS, zetIntelMetricCalculateOperationDestroyExp(hCalculateOperation)); + EXPECT_EQ(ZE_RESULT_SUCCESS, zetIntelMetricCalculationOperationDestroyExp(hCalculationOperation)); } HWTEST2_F(MetricIpSamplingCalcOpTest, GivenIpSamplingCalcOpCallingMetricCalculateValuesOnSubDevicedCanInterruptAndContinue, EustallSupportedPlatforms) { @@ -895,27 +895,27 @@ HWTEST2_F(MetricIpSamplingCalcOpTest, GivenIpSamplingCalcOpCallingMetricCalculat EXPECT_EQ(metricGroupCount, 1u); EXPECT_NE(metricGroupHandle, nullptr); - zet_intel_metric_calculate_exp_desc_t calculateDesc{ - ZET_INTEL_STRUCTURE_TYPE_METRIC_CALCULATE_DESC_EXP, + zet_intel_metric_calculation_exp_desc_t calculationDesc{ + ZET_INTEL_STRUCTURE_TYPE_METRIC_CALCULATION_DESC_EXP, nullptr, // pNext 1, // metricGroupCount &metricGroupHandle, // phMetricGroups 0, // metricCount nullptr, // phMetrics 0, // timeWindowsCount - nullptr, // pCalculateTimeWindows + nullptr, // pCalculationTimeWindows 1000, // timeAggregationWindow }; - zet_intel_metric_calculate_operation_exp_handle_t hCalculateOperation; - EXPECT_EQ(ZE_RESULT_SUCCESS, zetIntelMetricCalculateOperationCreateExp(context->toHandle(), - device->toHandle(), &calculateDesc, - &hCalculateOperation)); + zet_intel_metric_calculation_operation_exp_handle_t hCalculationOperation; + EXPECT_EQ(ZE_RESULT_SUCCESS, zetIntelMetricCalculationOperationCreateExp(context->toHandle(), + device->toHandle(), &calculationDesc, + &hCalculationOperation)); uint32_t metricsInReportCount = 10; std::vector metricsInReport(metricsInReportCount); - EXPECT_EQ(ZE_RESULT_SUCCESS, zetIntelMetricCalculateOperationGetReportFormatExp(hCalculateOperation, - &metricsInReportCount, - metricsInReport.data())); + EXPECT_EQ(ZE_RESULT_SUCCESS, zetIntelMetricCalculationOperationGetReportFormatExp(hCalculationOperation, + &metricsInReportCount, + metricsInReport.data())); EXPECT_EQ(metricsInReportCount, 10u); std::vector metricProperties(metricsInReportCount); @@ -927,7 +927,7 @@ HWTEST2_F(MetricIpSamplingCalcOpTest, GivenIpSamplingCalcOpCallingMetricCalculat size_t processedSize = 0; size_t offset = 0; EXPECT_EQ(ZE_RESULT_SUCCESS, zetIntelMetricCalculateValuesExp(rawDataVectorSize, &offset, - reinterpret_cast(rawDataVector.data()), hCalculateOperation, + reinterpret_cast(rawDataVector.data()), hCalculationOperation, &totalMetricReportCount, nullptr)); EXPECT_EQ(totalMetricReportCount, 3U); @@ -936,7 +936,7 @@ HWTEST2_F(MetricIpSamplingCalcOpTest, GivenIpSamplingCalcOpCallingMetricCalculat std::vector metricResults(totalMetricReportCount * metricsInReportCount); EXPECT_EQ(ZE_RESULT_SUCCESS, zetIntelMetricCalculateValuesExp(rawDataVectorSize, &offset, - reinterpret_cast(rawDataVector.data()), hCalculateOperation, + reinterpret_cast(rawDataVector.data()), hCalculationOperation, &totalMetricReportCount, metricResults.data())); EXPECT_EQ(totalMetricReportCount, 2U); EXPECT_EQ(offset, IpSamplingMetricGroupBase::rawReportSize * 2); @@ -947,7 +947,7 @@ HWTEST2_F(MetricIpSamplingCalcOpTest, GivenIpSamplingCalcOpCallingMetricCalculat uint32_t resultIndex = i * metricsInReportCount + j; EXPECT_TRUE(metricProperties[j].resultType == interruptedExpectedMetricValues12[resultIndex].type); EXPECT_TRUE(metricResults[resultIndex].value.ui64 == interruptedExpectedMetricValues12[resultIndex].value.ui64); - EXPECT_TRUE(metricResults[resultIndex].resultStatus == ZET_INTEL_METRIC_CALCULATE_EXP_RESULT_VALID); + EXPECT_TRUE(metricResults[resultIndex].resultStatus == ZET_INTEL_METRIC_CALCULATION_EXP_RESULT_VALID); } } @@ -955,7 +955,7 @@ HWTEST2_F(MetricIpSamplingCalcOpTest, GivenIpSamplingCalcOpCallingMetricCalculat offset = processedSize; totalMetricReportCount = 1; EXPECT_EQ(ZE_RESULT_SUCCESS, zetIntelMetricCalculateValuesExp(rawDataVectorSize - processedSize, &offset, - reinterpret_cast(rawDataVector.data()), hCalculateOperation, + reinterpret_cast(rawDataVector.data()), hCalculationOperation, &totalMetricReportCount, metricResults.data())); EXPECT_EQ(totalMetricReportCount, 1U); EXPECT_EQ(offset, IpSamplingMetricGroupBase::rawReportSize); @@ -967,7 +967,7 @@ HWTEST2_F(MetricIpSamplingCalcOpTest, GivenIpSamplingCalcOpCallingMetricCalculat uint32_t resultIndex = i * metricsInReportCount + j; EXPECT_TRUE(metricProperties[j].resultType == interruptedExpectedMetricValues3[resultIndex].type); EXPECT_TRUE(metricResults[resultIndex].value.ui64 == interruptedExpectedMetricValues3[resultIndex].value.ui64); - EXPECT_TRUE(metricResults[resultIndex].resultStatus == ZET_INTEL_METRIC_CALCULATE_EXP_RESULT_VALID); + EXPECT_TRUE(metricResults[resultIndex].resultStatus == ZET_INTEL_METRIC_CALCULATION_EXP_RESULT_VALID); } } @@ -977,7 +977,7 @@ HWTEST2_F(MetricIpSamplingCalcOpTest, GivenIpSamplingCalcOpCallingMetricCalculat offset = processedSize; EXPECT_EQ(ZE_RESULT_SUCCESS, zetIntelMetricCalculateValuesExp(rawDataVectorSize - processedSize, &offset, - reinterpret_cast(rawDataVector.data()), hCalculateOperation, + reinterpret_cast(rawDataVector.data()), hCalculationOperation, &totalMetricReportCount, metricResults.data())); EXPECT_EQ(totalMetricReportCount, 2U); EXPECT_EQ(offset, IpSamplingMetricGroupBase::rawReportSize * 3); @@ -989,11 +989,11 @@ HWTEST2_F(MetricIpSamplingCalcOpTest, GivenIpSamplingCalcOpCallingMetricCalculat uint32_t resultIndex = i * metricsInReportCount + j; EXPECT_TRUE(metricProperties[j].resultType == interruptedExpectedMetricValues456[resultIndex].type); EXPECT_TRUE(metricResults[resultIndex].value.ui64 == interruptedExpectedMetricValues456[resultIndex].value.ui64); - EXPECT_TRUE(metricResults[resultIndex].resultStatus == ZET_INTEL_METRIC_CALCULATE_EXP_RESULT_VALID); + EXPECT_TRUE(metricResults[resultIndex].resultStatus == ZET_INTEL_METRIC_CALCULATION_EXP_RESULT_VALID); } } - EXPECT_EQ(ZE_RESULT_SUCCESS, zetIntelMetricCalculateOperationDestroyExp(hCalculateOperation)); + EXPECT_EQ(ZE_RESULT_SUCCESS, zetIntelMetricCalculationOperationDestroyExp(hCalculationOperation)); } HWTEST2_F(MetricIpSamplingCalcOpTest, GivenIpSamplingCalcOpCoverBoundaryConditionsOfFillStallDataMap, EustallSupportedPlatforms) { @@ -1006,30 +1006,30 @@ HWTEST2_F(MetricIpSamplingCalcOpTest, GivenIpSamplingCalcOpCoverBoundaryConditio EXPECT_EQ(metricGroupCount, 1u); EXPECT_NE(metricGroupHandle, nullptr); - zet_intel_metric_calculate_exp_desc_t calculateDesc{ - ZET_INTEL_STRUCTURE_TYPE_METRIC_CALCULATE_DESC_EXP, + zet_intel_metric_calculation_exp_desc_t calculationDesc{ + ZET_INTEL_STRUCTURE_TYPE_METRIC_CALCULATION_DESC_EXP, nullptr, // pNext 1, // metricGroupCount &metricGroupHandle, // phMetricGroups 0, // metricCount nullptr, // phMetrics 0, // timeWindowsCount - nullptr, // pCalculateTimeWindows + nullptr, // pCalculationTimeWindows 1000, // timeAggregationWindow }; - zet_intel_metric_calculate_operation_exp_handle_t hCalculateOperation; - EXPECT_EQ(ZE_RESULT_SUCCESS, zetIntelMetricCalculateOperationCreateExp(context->toHandle(), - device->toHandle(), &calculateDesc, - &hCalculateOperation)); + zet_intel_metric_calculation_operation_exp_handle_t hCalculationOperation; + EXPECT_EQ(ZE_RESULT_SUCCESS, zetIntelMetricCalculationOperationCreateExp(context->toHandle(), + device->toHandle(), &calculationDesc, + &hCalculationOperation)); uint32_t totalMetricReportCount = 0; size_t offset = 0; EXPECT_EQ(ZE_RESULT_SUCCESS, zetIntelMetricCalculateValuesExp(rawDataVectorSize, &offset, - reinterpret_cast(rawDataVector.data()), hCalculateOperation, + reinterpret_cast(rawDataVector.data()), hCalculationOperation, &totalMetricReportCount, nullptr)); EXPECT_EQ(totalMetricReportCount, 3U); - IpSamplingMetricCalcOpImp *calcop = static_cast(MetricCalcOpImp::fromHandle(hCalculateOperation)); + IpSamplingMetricCalcOpImp *calcop = static_cast(MetricCalcOpImp::fromHandle(hCalculationOperation)); size_t rawDataSize = 0; size_t processedSize = 0; L0::L0GfxCoreHelper &l0GfxCoreHelper = neoDevice->getRootDeviceEnvironment().getHelper(); @@ -1061,7 +1061,7 @@ HWTEST2_F(MetricIpSamplingCalcOpTest, GivenIpSamplingCalcOpCoverBoundaryConditio EXPECT_TRUE(dataOverflow == false); l0GfxCoreHelper.stallIpDataMapDelete(stallReportDataMap); - EXPECT_EQ(ZE_RESULT_SUCCESS, zetIntelMetricCalculateOperationDestroyExp(hCalculateOperation)); + EXPECT_EQ(ZE_RESULT_SUCCESS, zetIntelMetricCalculationOperationDestroyExp(hCalculationOperation)); } HWTEST2_F(MetricIpSamplingCalcOpTest, GivenIpSamplingCalcOpCallingMetricCalculateValuesOnSubDeviceThenHandleErrorConditions, EustallSupportedPlatforms) { @@ -1074,23 +1074,23 @@ HWTEST2_F(MetricIpSamplingCalcOpTest, GivenIpSamplingCalcOpCallingMetricCalculat EXPECT_EQ(metricGroupCount, 1u); EXPECT_NE(metricGroupHandle, nullptr); - zet_intel_metric_calculate_exp_desc_t calculateDesc{ - ZET_INTEL_STRUCTURE_TYPE_METRIC_CALCULATE_DESC_EXP, + zet_intel_metric_calculation_exp_desc_t calculationDesc{ + ZET_INTEL_STRUCTURE_TYPE_METRIC_CALCULATION_DESC_EXP, nullptr, // pNext 1, // metricGroupCount &metricGroupHandle, // phMetricGroups 0, // metricCount nullptr, // phMetrics 0, // timeWindowsCount - nullptr, // pCalculateTimeWindows + nullptr, // pCalculationTimeWindows 1000, // timeAggregationWindow }; - zet_intel_metric_calculate_operation_exp_handle_t hCalculateOperation; + zet_intel_metric_calculation_operation_exp_handle_t hCalculationOperation; - EXPECT_EQ(ZE_RESULT_SUCCESS, zetIntelMetricCalculateOperationCreateExp(context->toHandle(), - device->toHandle(), &calculateDesc, - &hCalculateOperation)); + EXPECT_EQ(ZE_RESULT_SUCCESS, zetIntelMetricCalculationOperationCreateExp(context->toHandle(), + device->toHandle(), &calculationDesc, + &hCalculationOperation)); std::vector rawDataWithHeader(rawDataVectorSize + sizeof(IpSamplingMetricDataHeader)); addHeader(rawDataWithHeader.data(), rawDataWithHeader.size(), reinterpret_cast(rawDataVector.data()), rawDataVectorSize, 0); @@ -1099,15 +1099,15 @@ HWTEST2_F(MetricIpSamplingCalcOpTest, GivenIpSamplingCalcOpCallingMetricCalculat size_t offset = 0; // sub-device cal op does not accept root device data EXPECT_EQ(ZE_RESULT_ERROR_INVALID_ARGUMENT, zetIntelMetricCalculateValuesExp(rawDataWithHeader.size(), &offset, - reinterpret_cast(rawDataWithHeader.data()), hCalculateOperation, + reinterpret_cast(rawDataWithHeader.data()), hCalculationOperation, &totalMetricReportCount, nullptr)); // invalid input raw data size EXPECT_EQ(ZE_RESULT_ERROR_INVALID_SIZE, zetIntelMetricCalculateValuesExp(rawDataVectorSize / 30, &offset, - reinterpret_cast(rawDataVector.data()), hCalculateOperation, + reinterpret_cast(rawDataVector.data()), hCalculationOperation, &totalMetricReportCount, nullptr)); - EXPECT_EQ(ZE_RESULT_SUCCESS, zetIntelMetricCalculateOperationDestroyExp(hCalculateOperation)); + EXPECT_EQ(ZE_RESULT_SUCCESS, zetIntelMetricCalculationOperationDestroyExp(hCalculationOperation)); } HWTEST2_F(MetricIpSamplingCalcOpTest, GivenIpSamplingCalcOpCallingMetricCalculateValuesOnSubDeviceCanDetectRawDataOverflow, EustallSupportedPlatforms) { @@ -1120,33 +1120,33 @@ HWTEST2_F(MetricIpSamplingCalcOpTest, GivenIpSamplingCalcOpCallingMetricCalculat EXPECT_EQ(metricGroupCount, 1u); EXPECT_NE(metricGroupHandle, nullptr); - zet_intel_metric_calculate_exp_desc_t calculateDesc{ - ZET_INTEL_STRUCTURE_TYPE_METRIC_CALCULATE_DESC_EXP, + zet_intel_metric_calculation_exp_desc_t calculationDesc{ + ZET_INTEL_STRUCTURE_TYPE_METRIC_CALCULATION_DESC_EXP, nullptr, // pNext 1, // metricGroupCount &metricGroupHandle, // phMetricGroups 0, // metricCount nullptr, // phMetrics 0, // timeWindowsCount - nullptr, // pCalculateTimeWindows + nullptr, // pCalculationTimeWindows 1000, // timeAggregationWindow }; - zet_intel_metric_calculate_operation_exp_handle_t hCalculateOperation; - EXPECT_EQ(ZE_RESULT_SUCCESS, zetIntelMetricCalculateOperationCreateExp(context->toHandle(), - device->toHandle(), &calculateDesc, - &hCalculateOperation)); + zet_intel_metric_calculation_operation_exp_handle_t hCalculationOperation; + EXPECT_EQ(ZE_RESULT_SUCCESS, zetIntelMetricCalculationOperationCreateExp(context->toHandle(), + device->toHandle(), &calculationDesc, + &hCalculationOperation)); uint32_t totalMetricReportCount = 2; size_t offset = 0; std::vector metricResults(totalMetricReportCount * 10); EXPECT_EQ(ZE_RESULT_WARNING_DROPPED_DATA, zetIntelMetricCalculateValuesExp(rawDataVectorOverflowSize, &offset, - reinterpret_cast(rawDataVectorOverflow.data()), hCalculateOperation, + reinterpret_cast(rawDataVectorOverflow.data()), hCalculationOperation, &totalMetricReportCount, metricResults.data())); EXPECT_EQ(totalMetricReportCount, 2U); EXPECT_EQ(offset, rawDataVectorOverflowSize); - EXPECT_EQ(ZE_RESULT_SUCCESS, zetIntelMetricCalculateOperationDestroyExp(hCalculateOperation)); + EXPECT_EQ(ZE_RESULT_SUCCESS, zetIntelMetricCalculationOperationDestroyExp(hCalculationOperation)); } HWTEST2_F(MetricIpSamplingCalcOpTest, GivenIpSamplingCalcOpCallingMetricCalculateValuesOnSubDeviceFilterMetricsInReport, EustallSupportedPlatforms) { @@ -1178,25 +1178,25 @@ HWTEST2_F(MetricIpSamplingCalcOpTest, GivenIpSamplingCalcOpCallingMetricCalculat uint32_t metricsToCalculateCount = static_cast(metricsToCalculate.size()); EXPECT_EQ(metricsToCalculateCount, 5u); - zet_intel_metric_calculate_exp_desc_t calculateDesc{ - ZET_INTEL_STRUCTURE_TYPE_METRIC_CALCULATE_DESC_EXP, + zet_intel_metric_calculation_exp_desc_t calculationDesc{ + ZET_INTEL_STRUCTURE_TYPE_METRIC_CALCULATION_DESC_EXP, nullptr, // pNext 0, // metricGroupCount nullptr, // phMetricGroups metricsToCalculateCount, // metricCount metricsToCalculate.data(), // phMetrics 0, // timeWindowsCount - nullptr, // pCalculateTimeWindows + nullptr, // pCalculationTimeWindows 1000, // timeAggregationWindow }; - zet_intel_metric_calculate_operation_exp_handle_t hCalculateOperation; + zet_intel_metric_calculation_operation_exp_handle_t hCalculationOperation; - EXPECT_EQ(ZE_RESULT_SUCCESS, zetIntelMetricCalculateOperationCreateExp(context->toHandle(), - device->toHandle(), &calculateDesc, - &hCalculateOperation)); + EXPECT_EQ(ZE_RESULT_SUCCESS, zetIntelMetricCalculationOperationCreateExp(context->toHandle(), + device->toHandle(), &calculationDesc, + &hCalculationOperation)); uint32_t metricsInReportCount = 0; - EXPECT_EQ(ZE_RESULT_SUCCESS, zetIntelMetricCalculateOperationGetReportFormatExp(hCalculateOperation, &metricsInReportCount, nullptr)); + EXPECT_EQ(ZE_RESULT_SUCCESS, zetIntelMetricCalculationOperationGetReportFormatExp(hCalculationOperation, &metricsInReportCount, nullptr)); EXPECT_EQ(metricsInReportCount, 5u); // calculate only one report and expect results follow the order of rawDataVector @@ -1204,7 +1204,7 @@ HWTEST2_F(MetricIpSamplingCalcOpTest, GivenIpSamplingCalcOpCallingMetricCalculat size_t offset = 0; std::vector metricResults(totalMetricReportCount * metricsInReportCount); EXPECT_EQ(ZE_RESULT_SUCCESS, zetIntelMetricCalculateValuesExp(rawDataVectorSize, &offset, - reinterpret_cast(rawDataVector.data()), hCalculateOperation, + reinterpret_cast(rawDataVector.data()), hCalculationOperation, &totalMetricReportCount, metricResults.data())); EXPECT_EQ(totalMetricReportCount, 1U); EXPECT_EQ(offset, IpSamplingMetricGroupBase::rawReportSize); @@ -1214,7 +1214,7 @@ HWTEST2_F(MetricIpSamplingCalcOpTest, GivenIpSamplingCalcOpCallingMetricCalculat EXPECT_TRUE(metricResults[j].value.ui64 == interruptedExpectedMetricValues12[j * 2 + 1].value.ui64); } - EXPECT_EQ(ZE_RESULT_SUCCESS, zetIntelMetricCalculateOperationDestroyExp(hCalculateOperation)); + EXPECT_EQ(ZE_RESULT_SUCCESS, zetIntelMetricCalculationOperationDestroyExp(hCalculationOperation)); } HWTEST2_F(MetricIpSamplingCalcOpMultiDevTest, GivenIpSamplingCalcOpCallingMetricCalculateValuesOnRootDeviceExpectSuccess, EustallSupportedPlatforms) { @@ -1232,23 +1232,23 @@ HWTEST2_F(MetricIpSamplingCalcOpMultiDevTest, GivenIpSamplingCalcOpCallingMetric EXPECT_EQ(metricGroupCount, 1u); EXPECT_NE(metricGroupHandle, nullptr); - zet_intel_metric_calculate_exp_desc_t calculateDesc{ - ZET_INTEL_STRUCTURE_TYPE_METRIC_CALCULATE_DESC_EXP, + zet_intel_metric_calculation_exp_desc_t calculationDesc{ + ZET_INTEL_STRUCTURE_TYPE_METRIC_CALCULATION_DESC_EXP, nullptr, // pNext 1, // metricGroupCount &metricGroupHandle, // phMetricGroups 0, // metricCount nullptr, // phMetrics 0, // timeWindowsCount - nullptr, // pCalculateTimeWindows + nullptr, // pCalculationTimeWindows 1000, // timeAggregationWindow }; - zet_intel_metric_calculate_operation_exp_handle_t hCalculateOperation; + zet_intel_metric_calculation_operation_exp_handle_t hCalculationOperation; - EXPECT_EQ(ZE_RESULT_SUCCESS, zetIntelMetricCalculateOperationCreateExp(context->toHandle(), - device->toHandle(), &calculateDesc, - &hCalculateOperation)); + EXPECT_EQ(ZE_RESULT_SUCCESS, zetIntelMetricCalculationOperationCreateExp(context->toHandle(), + device->toHandle(), &calculationDesc, + &hCalculationOperation)); std::vector rawDataWithHeader(rawDataVectorSize + sizeof(IpSamplingMetricDataHeader)); addHeader(rawDataWithHeader.data(), rawDataWithHeader.size(), reinterpret_cast(rawDataVector.data()), rawDataVectorSize, 0); @@ -1256,20 +1256,20 @@ HWTEST2_F(MetricIpSamplingCalcOpMultiDevTest, GivenIpSamplingCalcOpCallingMetric uint32_t totalMetricReportCount = 0; size_t offset = 0; EXPECT_EQ(ZE_RESULT_ERROR_UNSUPPORTED_FEATURE, zetIntelMetricCalculateValuesExp(rawDataWithHeader.size(), &offset, - reinterpret_cast(rawDataWithHeader.data()), hCalculateOperation, + reinterpret_cast(rawDataWithHeader.data()), hCalculationOperation, &totalMetricReportCount, nullptr)); EXPECT_EQ(ZE_RESULT_ERROR_INVALID_ARGUMENT, zetIntelMetricCalculateValuesExp(rawDataVectorSize, &offset, - reinterpret_cast(rawDataVector.data()), hCalculateOperation, + reinterpret_cast(rawDataVector.data()), hCalculationOperation, &totalMetricReportCount, nullptr)); uint32_t setCount = 0; EXPECT_EQ(ZE_RESULT_ERROR_UNSUPPORTED_FEATURE, zetIntelMetricCalculateMultipleValuesExp(rawDataVectorSize, &offset, reinterpret_cast(rawDataVector.data()), - hCalculateOperation, &setCount, nullptr, + hCalculationOperation, &setCount, nullptr, nullptr, nullptr)); - EXPECT_EQ(ZE_RESULT_SUCCESS, zetIntelMetricCalculateOperationDestroyExp(hCalculateOperation)); + EXPECT_EQ(ZE_RESULT_SUCCESS, zetIntelMetricCalculationOperationDestroyExp(hCalculationOperation)); } } // namespace ult diff --git a/level_zero/tools/test/unit_tests/sources/metrics/test_metric_oa_enumeration_1.cpp b/level_zero/tools/test/unit_tests/sources/metrics/test_metric_oa_enumeration_1.cpp index 59ce4dac9c..f6355e0490 100644 --- a/level_zero/tools/test/unit_tests/sources/metrics/test_metric_oa_enumeration_1.cpp +++ b/level_zero/tools/test/unit_tests/sources/metrics/test_metric_oa_enumeration_1.cpp @@ -613,8 +613,8 @@ TEST_F(MetricEnumerationTest, whenReadingMetricCroupCalculateParametersThenExpec EXPECT_EQ(zetMetricGroupGet(device->toHandle(), &metricGroupCount, metricGroupsHandles.data()), ZE_RESULT_SUCCESS); EXPECT_EQ(metricGroupCount, 2u); - zet_intel_metric_group_calculate_properties_exp_t metricGroupCalcProps{}; - metricGroupCalcProps.stype = ZET_INTEL_STRUCTURE_TYPE_METRIC_GROUP_CALCULATE_EXP_PROPERTIES; + zet_intel_metric_group_calculation_properties_exp_t metricGroupCalcProps{}; + metricGroupCalcProps.stype = ZET_INTEL_STRUCTURE_TYPE_METRIC_GROUP_CALCULATION_EXP_PROPERTIES; metricGroupCalcProps.pNext = nullptr; metricGroupCalcProps.isTimeFilterSupported = false; @@ -3689,23 +3689,23 @@ TEST_F(MetricEnumerationTest, givenValidOAMetricGroupThenOASourceCalcOperationIs EXPECT_NE(metricGroupHandle, nullptr); // metric groups from different source - zet_intel_metric_calculate_exp_desc_t calculateDesc{ - ZET_INTEL_STRUCTURE_TYPE_METRIC_CALCULATE_DESC_EXP, + zet_intel_metric_calculation_exp_desc_t calculationDesc{ + ZET_INTEL_STRUCTURE_TYPE_METRIC_CALCULATION_DESC_EXP, nullptr, // pNext 1, // metricGroupCount &metricGroupHandle, // phMetricGroups 0, // metricCount nullptr, // phMetrics 0, // timeWindowsCount - nullptr, // pCalculateTimeWindows + nullptr, // pCalculationTimeWindows 1000, // timeAggregationWindow }; - zet_intel_metric_calculate_operation_exp_handle_t hCalculateOperation; + zet_intel_metric_calculation_operation_exp_handle_t hCalculationOperation; - EXPECT_EQ(ZE_RESULT_ERROR_UNSUPPORTED_FEATURE, zetIntelMetricCalculateOperationCreateExp(context->toHandle(), - device->toHandle(), &calculateDesc, - &hCalculateOperation)); + EXPECT_EQ(ZE_RESULT_ERROR_UNSUPPORTED_FEATURE, zetIntelMetricCalculationOperationCreateExp(context->toHandle(), + device->toHandle(), &calculationDesc, + &hCalculationOperation)); } using AppendMarkerDriverVersionTest = Test;