From 6d86d562b596cab7194aa944b7b9267e2b716d0c Mon Sep 17 00:00:00 2001 From: Joshua Santosh Ranjan Date: Wed, 18 Sep 2024 17:17:22 +0000 Subject: [PATCH] refactor: move metric driver experimental apis to shared location modify driver experimental extensions according to guideline Related-To: NEO-12530 Signed-off-by: Joshua Santosh Ranjan --- .../driver_experimental/public/CMakeLists.txt | 1 - .../api/driver_experimental/public/zex_api.h | 1 - .../driver_experimental/public/zex_metric.cpp | 11 +- .../driver_experimental/public/zex_metric.h | 62 --- .../driver/extension_function_address.cpp | 3 +- level_zero/include/CMakeLists.txt | 2 +- level_zero/include/zet_intel_gpu_metric.h | 472 ++---------------- .../include/zet_intel_gpu_metric_export.h | 461 +++++++++++++++++ .../metrics/metric_ip_sampling_source.cpp | 6 +- .../source/metrics/metric_oa_export_data.cpp | 4 +- .../source/metrics/metric_oa_export_data.h | 4 +- .../tools/source/metrics/metric_oa_source.cpp | 2 +- .../zello_metrics/zello_metrics_export.cpp | 4 +- .../test_metric_ip_sampling_enumeration.cpp | 2 +- .../metrics/test_metric_oa_enumeration_1.cpp | 2 +- .../sources/metrics/test_metric_oa_export.cpp | 4 +- 16 files changed, 523 insertions(+), 518 deletions(-) delete mode 100644 level_zero/api/driver_experimental/public/zex_metric.h create mode 100644 level_zero/include/zet_intel_gpu_metric_export.h diff --git a/level_zero/api/driver_experimental/public/CMakeLists.txt b/level_zero/api/driver_experimental/public/CMakeLists.txt index ab38fcd4d2..81d7ac6752 100644 --- a/level_zero/api/driver_experimental/public/CMakeLists.txt +++ b/level_zero/api/driver_experimental/public/CMakeLists.txt @@ -22,6 +22,5 @@ target_sources(${L0_STATIC_LIB_NAME} ${CMAKE_CURRENT_SOURCE_DIR}/zex_memory.h ${CMAKE_CURRENT_SOURCE_DIR}/zex_module.cpp ${CMAKE_CURRENT_SOURCE_DIR}/zex_module.h - ${CMAKE_CURRENT_SOURCE_DIR}/zex_metric.h ${CMAKE_CURRENT_SOURCE_DIR}/zex_metric.cpp ) diff --git a/level_zero/api/driver_experimental/public/zex_api.h b/level_zero/api/driver_experimental/public/zex_api.h index 1f1a8ac0b0..0986c146b0 100644 --- a/level_zero/api/driver_experimental/public/zex_api.h +++ b/level_zero/api/driver_experimental/public/zex_api.h @@ -23,7 +23,6 @@ #include "zex_driver.h" #include "zex_event.h" #include "zex_memory.h" -#include "zex_metric.h" #include "zex_module.h" #endif // _ZEX_API_H diff --git a/level_zero/api/driver_experimental/public/zex_metric.cpp b/level_zero/api/driver_experimental/public/zex_metric.cpp index 84c79331da..bb8b76fe58 100644 --- a/level_zero/api/driver_experimental/public/zex_metric.cpp +++ b/level_zero/api/driver_experimental/public/zex_metric.cpp @@ -5,15 +5,14 @@ * */ -#include "level_zero/api/driver_experimental/public/zex_metric.h" - #include "level_zero/core/source/device/device.h" +#include "level_zero/include/zet_intel_gpu_metric.h" #include "level_zero/tools/source/metrics/metric.h" namespace L0 { ze_result_t ZE_APICALL -zexDeviceGetConcurrentMetricGroups( +zetIntelDeviceGetConcurrentMetricGroupsExp( zet_device_handle_t hDevice, uint32_t metricGroupCount, zet_metric_group_handle_t *phMetricGroups, @@ -28,14 +27,14 @@ zexDeviceGetConcurrentMetricGroups( extern "C" { -ZE_APIEXPORT ze_result_t ZE_APICALL -zexDeviceGetConcurrentMetricGroups( +ze_result_t ZE_APICALL +zetIntelDeviceGetConcurrentMetricGroupsExp( zet_device_handle_t hDevice, uint32_t metricGroupCount, zet_metric_group_handle_t *phMetricGroups, uint32_t *pConcurrentGroupCount, uint32_t *pCountPerConcurrentGroup) { - return L0::zexDeviceGetConcurrentMetricGroups( + return L0::zetIntelDeviceGetConcurrentMetricGroupsExp( hDevice, metricGroupCount, phMetricGroups, pConcurrentGroupCount, pCountPerConcurrentGroup); } diff --git a/level_zero/api/driver_experimental/public/zex_metric.h b/level_zero/api/driver_experimental/public/zex_metric.h deleted file mode 100644 index 451e1b3ba6..0000000000 --- a/level_zero/api/driver_experimental/public/zex_metric.h +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Copyright (C) 2024 Intel Corporation - * - * SPDX-License-Identifier: MIT - * - */ - -#ifndef _ZEX_METRIC_H -#define _ZEX_METRIC_H -#if defined(__cplusplus) -#pragma once -#endif - -#include -#include - -#define ZET_INTEL_STRUCTURE_TYPE_METRIC_GROUP_TYPE_EXP (static_cast(0x00010006)) -#define ZET_INTEL_STRUCTURE_TYPE_EXPORT_DMA_PROPERTIES_EXP (static_cast(0x00010007)) -#define ZET_INTEL_METRIC_TYPE_EXPORT_DMA_BUF_EXP (0x7ffffffd) - -typedef struct _zet_intel_export_dma_buf_exp_properties_t { - zet_structure_type_t stype; - void *pNext; - int fd; // [out] the file descriptor handle that could be used to import the memory by the host process. - size_t size; // [out] size in bytes of the dma_buf -} zet_intel_export_dma_buf_exp_properties_t; - -typedef enum _zet_intel_metric_group_type_exp_flags_t { - ZET_INTEL_METRIC_GROUP_TYPE_EXP_OTHER = ZE_BIT(0), - ZET_INTEL_METRIC_GROUP_TYPE_EXP_EXPORT_DMA_BUF = ZE_BIT(1) -} zet_intel_metric_group_type_exp_flags_t; - -typedef struct _zet_intel_metric_group_type_exp_t { - zet_structure_type_t stype; - void *pNext; - zet_intel_metric_group_type_exp_flags_t type; //[out] metric group type -} zet_intel_metric_group_type_exp_t; - -namespace L0 { -/////////////////////////////////////////////////////////////////////////////// -/// @brief Get sets of metric groups which could be collected concurrently. -/// -/// @details -/// - Re-arrange the input metric groups to provide sets of concurrent metric groups. -/// - The application may call this function from simultaneous threads. -/// - The implementation of this function must be thread-safe. -/// -/// @returns -/// - ::ZE_RESULT_SUCCESS -/// - ::ZE_RESULT_ERROR_INVALID_ARGUMENT -/// + `pConcurrentGroupCount` is not same as was returned by L0 using zexDeviceGetConcurrentMetricGroups -ZE_APIEXPORT ze_result_t ZE_APICALL -zexDeviceGetConcurrentMetricGroups( - zet_device_handle_t hDevice, // [in] handle of the device - uint32_t metricGroupCount, // [in] metric group count - zet_metric_group_handle_t *phMetricGroups, // [in, out] metrics groups to be re-arranged to be sets of concurrent groups - uint32_t *pConcurrentGroupCount, // [out] number of concurrent groups. - uint32_t *pCountPerConcurrentGroup); // [in,out][optional][*pConcurrentGroupCount] count of metric groups per concurrent group. - -} // namespace L0 - -#endif // _ZEX_METRIC_H diff --git a/level_zero/core/source/driver/extension_function_address.cpp b/level_zero/core/source/driver/extension_function_address.cpp index 50ef7a10aa..d2e8151003 100644 --- a/level_zero/core/source/driver/extension_function_address.cpp +++ b/level_zero/core/source/driver/extension_function_address.cpp @@ -11,6 +11,7 @@ #include "level_zero/api/driver_experimental/public/zex_context.h" #include "level_zero/api/extensions/public/ze_exp_ext.h" #include "level_zero/include/ze_intel_gpu.h" +#include "level_zero/include/zet_intel_gpu_metric.h" #include @@ -42,7 +43,7 @@ void *ExtensionFunctionAddressHelper::getExtensionFunctionAddress(const std::str RETURN_FUNC_PTR_IF_EXIST(zeMemGetPitchFor2dImage); RETURN_FUNC_PTR_IF_EXIST(zeImageGetDeviceOffsetExp); - RETURN_FUNC_PTR_IF_EXIST(zexDeviceGetConcurrentMetricGroups); + RETURN_FUNC_PTR_IF_EXIST(zetIntelDeviceGetConcurrentMetricGroupsExp); RETURN_FUNC_PTR_IF_EXIST(zeIntelGetDriverVersionString); RETURN_FUNC_PTR_IF_EXIST(zeIntelMediaCommunicationCreate); diff --git a/level_zero/include/CMakeLists.txt b/level_zero/include/CMakeLists.txt index 22ee4275f7..185f7aee60 100644 --- a/level_zero/include/CMakeLists.txt +++ b/level_zero/include/CMakeLists.txt @@ -9,7 +9,7 @@ target_sources(${L0_STATIC_LIB_NAME} ${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt ${CMAKE_CURRENT_SOURCE_DIR}/ze_intel_gpu.h ${CMAKE_CURRENT_SOURCE_DIR}/zet_intel_gpu_debug.h - ${CMAKE_CURRENT_SOURCE_DIR}/zet_intel_gpu_metric.h + ${CMAKE_CURRENT_SOURCE_DIR}/zet_intel_gpu_metric_export.h ) add_subdirectories() diff --git a/level_zero/include/zet_intel_gpu_metric.h b/level_zero/include/zet_intel_gpu_metric.h index 28d1754d68..36e97a7d74 100644 --- a/level_zero/include/zet_intel_gpu_metric.h +++ b/level_zero/include/zet_intel_gpu_metric.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2023 Intel Corporation + * Copyright (C) 2023-2024 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -8,7 +8,7 @@ #ifndef _ZET_INTEL_GPU_METRIC_H #define _ZET_INTEL_GPU_METRIC_H -#include +#include #if defined(__cplusplus) #pragma once @@ -20,442 +20,50 @@ extern "C" { #define ZET_INTEL_GPU_METRIC_VERSION_MAJOR 0 #define ZET_INTEL_GPU_METRIC_VERSION_MINOR 1 -#pragma pack(push, 1) +#define ZET_INTEL_STRUCTURE_TYPE_METRIC_GROUP_TYPE_EXP (static_cast(0x00010006)) +#define ZET_INTEL_STRUCTURE_TYPE_EXPORT_DMA_PROPERTIES_EXP (static_cast(0x00010007)) +#define ZET_INTEL_METRIC_TYPE_EXPORT_DMA_BUF (0x7ffffffd) -#define ZET_INTEL_GPU_METRIC_INVALID_OFFSET ((ptrdiff_t)0u) -#define zet_intel_metric_df_gpu_offset_to_ptr(type, offset, base) \ - type##_to_pointer(offset, base); +typedef struct _zet_intel_export_dma_buf_exp_properties_t { + zet_structure_type_t stype; + void *pNext; + int fd; // [out] the file descriptor handle that could be used to import the memory by the host process. + size_t size; // [out] size in bytes of the dma_buf +} zet_intel_export_dma_buf_exp_properties_t; -typedef ptrdiff_t uint8_offset_t; -typedef ptrdiff_t cstring_offset_t; -typedef ptrdiff_t zet_intel_metric_df_gpu_equation_element_0_1_offset_t; -typedef ptrdiff_t zet_intel_metric_df_gpu_information_params_0_1_offset_t; -typedef ptrdiff_t zet_intel_metric_df_gpu_metric_params_0_1_offset_t; -typedef ptrdiff_t zet_intel_metric_df_gpu_global_symbol_0_1_offset_t; +typedef enum _zet_intel_metric_group_type_exp_flags_t { + ZET_INTEL_METRIC_GROUP_TYPE_EXP_OTHER = ZE_BIT(0), + ZET_INTEL_METRIC_GROUP_TYPE_EXP_EXPORT_DMA_BUF = ZE_BIT(1) +} zet_intel_metric_group_type_exp_flags_t; -////////////////////////////////////////////////////////////////////////////////// -// zet_intel_metric_df_gpu_apiversion_0_1_t -////////////////////////////////////////////////////////////////////////////////// -typedef struct _zet_intel_metric_df_gpu_apiversion_0_1_t { - uint32_t majorNumber; - uint32_t minorNumber; - uint32_t buildNumber; -} zet_intel_metric_df_gpu_apiversion_0_1_t; +typedef struct _zet_intel_metric_group_type_exp_t { + zet_structure_type_t stype; + void *pNext; + zet_intel_metric_group_type_exp_flags_t type; //[out] metric group type +} zet_intel_metric_group_type_exp_t; -////////////////////////////////////////////////////////////////////////////////// -// zet_intel_metric_df_gpu_adapter_id_type_t -////////////////////////////////////////////////////////////////////////////////// -typedef enum _zet_intel_metric_df_gpu_adapter_id_type_t { - ZET_INTEL_METRIC_DF_ADAPTER_ID_TYPE_UNDEFINED = 0, - ZET_INTEL_METRIC_DF_ADAPTER_ID_TYPE_LUID, - ZET_INTEL_METRIC_DF_ADAPTER_ID_TYPE_MAJOR_MINOR, - ZET_INTEL_METRIC_DF_ADAPTER_ID_TYPE_FORCE_UINT32 = 0x7fffffff -} zet_intel_metric_df_gpu_adapter_id_type_t; - -////////////////////////////////////////////////////////////////////////////////// -// zet_intel_metric_df_gpu_adapter_id_luid_0_1_t -////////////////////////////////////////////////////////////////////////////////// -typedef struct _zet_intel_metric_df_gpu_adapter_id_luid_0_1_t { - uint32_t lowPart; - int32_t highPart; -} zet_intel_metric_df_gpu_adapter_id_luid_0_1_t; - -////////////////////////////////////////////////////////////////////////////////// -// zet_intel_metric_df_gpu_adapter_id_major_minor_0_1_t -////////////////////////////////////////////////////////////////////////////////// -typedef struct _zet_intel_metric_df_gpu_adapter_id_major_minor_0_1_t { - int32_t major; - int32_t minor; -} zet_intel_metric_df_gpu_adapter_id_major_minor_0_1_t; - -////////////////////////////////////////////////////////////////////////////////// -// zet_intel_metric_df_gpu_adapter_id_0_1_t -////////////////////////////////////////////////////////////////////////////////// -typedef struct _zet_intel_metric_df_gpu_adapter_id_0_1_t { - zet_intel_metric_df_gpu_adapter_id_type_t type; - union { - zet_intel_metric_df_gpu_adapter_id_luid_0_1_t luid; - zet_intel_metric_df_gpu_adapter_id_major_minor_0_1_t majorMinor; - }; -} zet_intel_metric_df_gpu_adapter_id_0_1_t; - -////////////////////////////////////////////////////////////////////////////////// -// zet_intel_metric_df_gpu_adapter_params_0_1_t -////////////////////////////////////////////////////////////////////////////////// -typedef struct _zet_intel_metric_df_gpu_adapter_params_0_1_t { - zet_intel_metric_df_gpu_adapter_id_0_1_t systemId; // Operating system specific adapter id - uint32_t busNumber; - uint32_t deviceNumber; - uint32_t functionNumber; - uint32_t domainNumber; -} zet_intel_metric_df_gpu_adapter_params_0_1_t; - -////////////////////////////////////////////////////////////////////////////////// -// zet_intel_metric_df_gpu_metrics_device_params_0_1_t -////////////////////////////////////////////////////////////////////////////////// -typedef struct _zet_intel_metric_df_gpu_metrics_device_params_0_1_t { - // API version - zet_intel_metric_df_gpu_apiversion_0_1_t version; - uint32_t globalSymbolsCount; -} zet_intel_metric_df_gpu_metrics_device_params_0_1_t; - -////////////////////////////////////////////////////////////////////////////////// -// zet_intel_metric_df_gpu_value_type_t -////////////////////////////////////////////////////////////////////////////////// -typedef enum _zet_intel_metric_df_gpu_value_type_t { - ZET_INTEL_METRIC_DF_VALUE_TYPE_UINT32, - ZET_INTEL_METRIC_DF_VALUE_TYPE_UINT64, - ZET_INTEL_METRIC_DF_VALUE_TYPE_FLOAT, - ZET_INTEL_METRIC_DF_VALUE_TYPE_BOOL, - ZET_INTEL_METRIC_DF_VALUE_TYPE_CSTRING, - ZET_INTEL_METRIC_DF_VALUE_TYPE_BYTEARRAY, - ZET_INTEL_METRIC_DF_VALUE_TYPE_FORCE_UINT32 = 0x7fffffff -} zet_intel_metric_df_gpu_value_type_t; - -////////////////////////////////////////////////////////////////////////////////// -// zet_intel_metric_df_gpu_byte_array_0_1_t -////////////////////////////////////////////////////////////////////////////////// -typedef struct _zet_intel_metric_df_gpu_byte_array_0_1_t { - uint8_offset_t data; - uint32_t size; -} zet_intel_metric_df_gpu_byte_array_0_1_t; - -////////////////////////////////////////////////////////////////////////////////// -// zet_intel_metric_df_gpu_typed_value_0_1_t -////////////////////////////////////////////////////////////////////////////////// -typedef struct _zet_intel_metric_df_gpu_typed_value_0_1_t { - union { - uint32_t valueUInt32; - uint64_t valueUInt64; - struct { - uint32_t low; - uint32_t high; - } valueUInt64Fields; - float valueFloat; - bool valueBool; - cstring_offset_t valueCString; - zet_intel_metric_df_gpu_byte_array_0_1_t valueByteArray; - }; - zet_intel_metric_df_gpu_value_type_t valueType; -} zet_intel_metric_df_gpu_typed_value_0_1_t; - -////////////////////////////////////////////////////////////////////////////////// -// zet_intel_metric_df_gpu_global_symbol_0_1_t -////////////////////////////////////////////////////////////////////////////////// -typedef struct _zet_intel_metric_df_gpu_global_symbol_0_1_t { - cstring_offset_t symbolName; - zet_intel_metric_df_gpu_typed_value_0_1_t symbolTypedValue; -} zet_intel_metric_df_gpu_global_symbol_0_1_t; - -////////////////////////////////////////////////////////////////////////////////// -// zet_intel_metric_df_gpu_equation_element_type_t -////////////////////////////////////////////////////////////////////////////////// -typedef enum _zet_intel_metric_df_gpu_equation_element_type_t { - ZET_INTEL_METRIC_DF_EQUATION_ELEM_OPERATION, // See Tequation_operation enumeration - ZET_INTEL_METRIC_DF_EQUATION_ELEM_RD_BITFIELD, // - ZET_INTEL_METRIC_DF_EQUATION_ELEM_RD_UINT8, // - ZET_INTEL_METRIC_DF_EQUATION_ELEM_RD_UINT16, // - ZET_INTEL_METRIC_DF_EQUATION_ELEM_RD_UINT32, // - ZET_INTEL_METRIC_DF_EQUATION_ELEM_RD_UINT64, // - ZET_INTEL_METRIC_DF_EQUATION_ELEM_RD_FLOAT, // - ZET_INTEL_METRIC_DF_EQUATION_ELEM_RD_40BIT_CNTR, // Assemble 40 bit counter that is in two locations, result in unsigned integer 64b - ZET_INTEL_METRIC_DF_EQUATION_ELEM_IMM_UINT64, // - ZET_INTEL_METRIC_DF_EQUATION_ELEM_IMM_FLOAT, // - ZET_INTEL_METRIC_DF_EQUATION_ELEM_SELF_COUNTER_VALUE, // Defined by $Self token, the UINT64 result of delta_function for IO or QueryReadEquation - ZET_INTEL_METRIC_DF_EQUATION_ELEM_GLOBAL_SYMBOL, // Defined by $"SymbolName", available in MetricsDevice SymbolTable - ZET_INTEL_METRIC_DF_EQUATION_ELEM_LOCAL_COUNTER_SYMBOL, // Defined by $"SymbolName", refers to counter delta value in the local set - ZET_INTEL_METRIC_DF_EQUATION_ELEM_OTHER_SET_COUNTER_SYMBOL, // Defined by concatenated string of $"setSymbolName/SymbolName", refers to counter - // Delta value in the other set - ZET_INTEL_METRIC_DF_EQUATION_ELEM_LOCAL_METRIC_SYMBOL, // Defined by $$"SymbolName", refers to metric normalized value in the local set - ZET_INTEL_METRIC_DF_EQUATION_ELEM_OTHER_SET_METRIC_SYMBOL, // Defined by concatenated string of $$"setSymbolName/SymbolName", refers to metric - // Normalized value in the other set - ZET_INTEL_METRIC_DF_EQUATION_ELEM_INFORMATION_SYMBOL, // Defined by i$"SymbolName", refers to information value type only - ZET_INTEL_METRIC_DF_EQUATION_ELEM_STD_NORM_GPU_DURATION, // Action is $Self $GpuCoreClocks FDIV 100 FMUL - ZET_INTEL_METRIC_DF_EQUATION_ELEM_STD_NORM_EU_AGGR_DURATION, // Action is $Self $GpuCoreClocks $EuCoresTotalCount UMUL FDIV 100 FMUL - ZET_INTEL_METRIC_DF_EQUATION_ELEM_MASK, - ZET_INTEL_METRIC_DF_EQUATION_ELEM_FORCE_UINT32 = 0x7fffffff -} zet_intel_metric_df_gpu_equation_element_type_t; - -////////////////////////////////////////////////////////////////////////////////// -// zet_intel_metric_df_gpu_equation_operation_t -////////////////////////////////////////////////////////////////////////////////// -typedef enum _zet_intel_metric_df_gpu_equation_operation_t { - ZET_INTEL_METRIC_DF_EQUATION_OPER_RSHIFT, // 64b unsigned integer right shift - ZET_INTEL_METRIC_DF_EQUATION_OPER_LSHIFT, // 64b unsigned integer left shift - ZET_INTEL_METRIC_DF_EQUATION_OPER_AND, // Bitwise AND of two unsigned integers, 64b each - ZET_INTEL_METRIC_DF_EQUATION_OPER_OR, // Bitwise OR of two unsigned integers, 64b each - ZET_INTEL_METRIC_DF_EQUATION_OPER_XOR, // Bitwise XOR of two unsigned integers, 64b each - ZET_INTEL_METRIC_DF_EQUATION_OPER_XNOR, // Bitwise XNOR of two unsigned integers, 64b each - ZET_INTEL_METRIC_DF_EQUATION_OPER_AND_L, // Logical AND (C-like "&&") of two unsigned integers, 64b each, result is true(1) if both values are true(greater than 0) - ZET_INTEL_METRIC_DF_EQUATION_OPER_EQUALS, // Equality (C-like "==") of two unsigned integers, 64b each, result is true(1) or false(0) - ZET_INTEL_METRIC_DF_EQUATION_OPER_UADD, // Unsigned integer add, arguments are casted to be 64b unsigned integers, result is unsigned integer 64b - ZET_INTEL_METRIC_DF_EQUATION_OPER_USUB, // Unsigned integer subtract, arguments are casted to be 64b unsigned integers, result is unsigned integer 64b - ZET_INTEL_METRIC_DF_EQUATION_OPER_UMUL, // Unsigned integer mul, arguments are casted to be 64b unsigned integers, result is unsigned integer 64b - ZET_INTEL_METRIC_DF_EQUATION_OPER_UDIV, // Unsigned integer div, arguments are casted to be 64b unsigned integers, result is unsigned integer 64b - ZET_INTEL_METRIC_DF_EQUATION_OPER_FADD, // Floating point add, arguments are casted to be 32b floating points, result is a 32b float - ZET_INTEL_METRIC_DF_EQUATION_OPER_FSUB, // Floating point subtract, arguments are casted to be 32b floating points, result is a 32b float - ZET_INTEL_METRIC_DF_EQUATION_OPER_FMUL, // Floating point multiply, arguments are casted to be 32b floating points, result is a 32b float - ZET_INTEL_METRIC_DF_EQUATION_OPER_FDIV, // Floating point divide, arguments are casted to be 32b floating points, result is a 32b float - ZET_INTEL_METRIC_DF_EQUATION_OPER_UGT, // 64b unsigned integers comparison of is greater than, result is bool true(1) or false(0) - ZET_INTEL_METRIC_DF_EQUATION_OPER_ULT, // 64b unsigned integers comparison of is less than, result is bool true(1) or false(0) - ZET_INTEL_METRIC_DF_EQUATION_OPER_UGTE, // 64b unsigned integers comparison of is greater than or equal, result is bool true(1) or false(0) - ZET_INTEL_METRIC_DF_EQUATION_OPER_ULTE, // 64b unsigned integers comparison of is less than or equal, result is bool true(1) or false(0) - ZET_INTEL_METRIC_DF_EQUATION_OPER_FGT, // 32b floating point numbers comparison of is greater than, result is bool true(1) or false(0) - ZET_INTEL_METRIC_DF_EQUATION_OPER_FLT, // 32b floating point numbers comparison of is less than, result is bool true(1) or false(0) - ZET_INTEL_METRIC_DF_EQUATION_OPER_FGTE, // 32b floating point numbers comparison of is greater than or equal, result is bool true(1) or false(0) - ZET_INTEL_METRIC_DF_EQUATION_OPER_FLTE, // 32b floating point numbers comparison of is less than or equal, result is bool true(1) or false(0) - ZET_INTEL_METRIC_DF_EQUATION_OPER_UMIN, // Unsigned integer MIN function, arguments are casted to be 64b unsigned integers, result is unsigned integer 64b - ZET_INTEL_METRIC_DF_EQUATION_OPER_UMAX, // Unsigned integer MAX function, arguments are casted to be 64b unsigned integers, result is unsigned integer 64b - ZET_INTEL_METRIC_DF_EQUATION_OPER_FMIN, // Floating point MIN function, arguments are casted to be 32b floating points, result is a 32b float - ZET_INTEL_METRIC_DF_EQUATION_OPER_FMAX, // Floating point MAX function, arguments are casted to be 32b floating points, result is a 32b float - ZET_INTEL_METRIC_DF_EQUATION_OPER_FORCE_UINT32 = 0x7fffffff -} zet_intel_metric_df_gpu_equation_operation_t; - -////////////////////////////////////////////////////////////////////////////////// -// zet_intel_metric_df_gpu_read_params_0_1_t -////////////////////////////////////////////////////////////////////////////////// -typedef struct _zet_intel_metric_df_gpu_read_params_0_1_t { - uint32_t byteOffset; - uint32_t bitOffset; - uint32_t bitsCount; - uint32_t byteOffsetExt; -} zet_intel_metric_df_gpu_read_params_0_1_t; - -////////////////////////////////////////////////////////////////////////////////// -// zet_intel_metric_df_gpu_equation_element_0_1_t -////////////////////////////////////////////////////////////////////////////////// -typedef struct _zet_intel_metric_df_gpu_equation_element_0_1_t { - cstring_offset_t symbolName; - union { - uint64_t immediateUInt64; - float immediateFloat; - zet_intel_metric_df_gpu_byte_array_0_1_t mask; - zet_intel_metric_df_gpu_equation_operation_t operation; - zet_intel_metric_df_gpu_read_params_0_1_t readParams; - }; - zet_intel_metric_df_gpu_equation_element_type_t type; -} zet_intel_metric_df_gpu_equation_element_0_1_t; - -////////////////////////////////////////////////////////////////////////////////// -// zet_intel_metric_df_gpu_equation_0_1_t -////////////////////////////////////////////////////////////////////////////////// -typedef struct _zet_intel_metric_df_gpu_equation_0_1_t { - uint32_t elementCount; - zet_intel_metric_df_gpu_equation_element_0_1_offset_t elements; -} zet_intel_metric_df_gpu_equation_0_1_t; - -////////////////////////////////////////////////////////////////////////////////// -// zet_intel_metric_df_gpu_metric_result_type_t -////////////////////////////////////////////////////////////////////////////////// -typedef enum _zet_intel_metric_df_gpu_metric_result_type_t { - ZET_INTEL_METRIC_DF_RESULT_UINT32, - ZET_INTEL_METRIC_DF_RESULT_UINT64, - ZET_INTEL_METRIC_DF_RESULT_BOOL, - ZET_INTEL_METRIC_DF_RESULT_FLOAT, - ZET_INTEL_METRIC_DF_RESULT_FORCE_UINT32 = 0x7fffffff -} zet_intel_metric_df_gpu_metric_result_type_t; - -////////////////////////////////////////////////////////////////////////////////// -// zet_intel_metric_df_gpu_delta_function_type_t -////////////////////////////////////////////////////////////////////////////////// -typedef enum _zet_intel_metric_df_gpu_delta_function_type_t { - ZET_INTEL_METRIC_DF_DELTA_FUNCTION_NULL = 0, - ZET_INTEL_METRIC_DF_DELTA_N_BITS, - ZET_INTEL_METRIC_DF_DELTA_BOOL_OR, // Logic OR - good for exceptions - ZET_INTEL_METRIC_DF_DELTA_BOOL_XOR, // Logic XOR - good to check if bits were changed - ZET_INTEL_METRIC_DF_DELTA_GET_PREVIOUS, // Preserve previous value - ZET_INTEL_METRIC_DF_DELTA_GET_LAST, // Preserve last value - ZET_INTEL_METRIC_DF_DELTA_NS_TIME, // Delta for nanosecond timestamps (GPU timestamp wraps at 32 bits but was value multiplied by 80) - ZET_INTEL_METRIC_DF_DELTA_FORCE_UINT32 = 0x7fffffff -} zet_intel_metric_df_gpu_delta_function_type_t; - -////////////////////////////////////////////////////////////////////////////////// -// zet_intel_metric_df_gpu_metric_type_t -////////////////////////////////////////////////////////////////////////////////// -typedef enum _zet_intel_metric_df_gpu_metric_type_t { - ZET_INTEL_METRIC_DF_METRIC_TYPE_DURATION, - ZET_INTEL_METRIC_DF_METRIC_TYPE_EVENT, - ZET_INTEL_METRIC_DF_METRIC_TYPE_EVENT_WITH_RANGE, - ZET_INTEL_METRIC_DF_METRIC_TYPE_THROUGHPUT, - ZET_INTEL_METRIC_DF_METRIC_TYPE_TIMESTAMP, - ZET_INTEL_METRIC_DF_METRIC_TYPE_FLAG, - ZET_INTEL_METRIC_DF_METRIC_TYPE_RATIO, - ZET_INTEL_METRIC_DF_METRIC_TYPE_RAW, - ZET_INTEL_METRIC_DF_METRIC_TYPE_FORCE_UINT32 = 0x7fffffff -} zet_intel_metric_df_gpu_metric_type_t; - -////////////////////////////////////////////////////////////////////////////////// -// zet_intel_metric_df_gpu_delta_function_0_1_t -////////////////////////////////////////////////////////////////////////////////// -typedef struct _zet_intel_metric_df_gpu_delta_function_0_1_t { - zet_intel_metric_df_gpu_delta_function_type_t functionType; - union { - uint32_t bitsCount; // Used for DELTA_N_BITS to specify bits count - }; -} zet_intel_metric_df_gpu_delta_function_0_1_t; - -////////////////////////////////////////////////////////////////////////////////// -// zet_intel_metric_df_gpu_metric_params_0_1_t -////////////////////////////////////////////////////////////////////////////////// -typedef struct _zet_intel_metric_df_gpu_metric_params_0_1_t { - cstring_offset_t symbolName; // Symbol name, used in equations - cstring_offset_t shortName; // Consistent metric name, not changed platform to platform - cstring_offset_t groupName; // VertexShader for example - cstring_offset_t longName; // Hint about the metric shown to users - uint32_t idInSet; // Position in set (may change after SetApiFiltering) - uint32_t apiMask; // - cstring_offset_t metricResultUnits; // - zet_intel_metric_df_gpu_metric_type_t metricType; // - zet_intel_metric_df_gpu_equation_0_1_t ioReadEquation; // Read equation specification for IO stream (accessing raw values potentially spread in report in several locations) - zet_intel_metric_df_gpu_equation_0_1_t queryReadEquation; // Read equation specification for query (accessing calculated delta values) - zet_intel_metric_df_gpu_delta_function_0_1_t deltaFunction; // - zet_intel_metric_df_gpu_equation_0_1_t normEquation; // Normalization equation to get normalized value to bytes transfered or to a percentage of utilization - zet_intel_metric_df_gpu_equation_0_1_t maxValueEquation; // To calculate metrics max value as a function of other metrics and device parameters (e.g. 100 for percentage) - uint32_t usageFlagsMask; - zet_intel_metric_df_gpu_metric_result_type_t resultType; -} zet_intel_metric_df_gpu_metric_params_0_1_t; - -////////////////////////////////////////////////////////////////////////////////// -// zet_intel_metric_df_gpu_information_type_t -////////////////////////////////////////////////////////////////////////////////// -typedef enum _zet_intel_metric_df_gpu_information_type_t { - ZET_INTEL_METRIC_DF_INFORMATION_TYPE_REPORT_REASON, - ZET_INTEL_METRIC_DF_INFORMATION_TYPE_VALUE, - ZET_INTEL_METRIC_DF_INFORMATION_TYPE_FLAG, - ZET_INTEL_METRIC_DF_INFORMATION_TYPE_TIMESTAMP, - ZET_INTEL_METRIC_DF_INFORMATION_TYPE_CONTEXT_ID_TAG, - ZET_INTEL_METRIC_DF_INFORMATION_TYPE_SAMPLE_PHASE, - ZET_INTEL_METRIC_DF_INFORMATION_TYPE_GPU_NODE, - ZET_INTEL_METRIC_DF_INFORMATION_TYPE_FORCE_UINT32 = 0x7fffffff -} zet_intel_metric_df_gpu_information_type_t; - -////////////////////////////////////////////////////////////////////////////////// -// zet_intel_metric_df_gpu_information_params_0_1_t -////////////////////////////////////////////////////////////////////////////////// -typedef struct _zet_intel_metric_df_gpu_information_params_0_1_t { - cstring_offset_t symbolName; // Symbol name, used in equations - cstring_offset_t shortName; // Consistent name, not changed platform to platform - cstring_offset_t groupName; // Some more global context of the information - cstring_offset_t longName; // Hint about the information shown to users - uint32_t idInSet; - uint32_t apiMask; // - zet_intel_metric_df_gpu_information_type_t infoType; // - cstring_offset_t infoUnits; // - zet_intel_metric_df_gpu_equation_0_1_t ioReadEquation; // Read equation specification for IO stream (accessing raw values potentially spread in report in several locations) - zet_intel_metric_df_gpu_equation_0_1_t queryReadEquation; // Read equation specification for query (accessing calculated delta values) - zet_intel_metric_df_gpu_delta_function_0_1_t overflowFunction; // -} zet_intel_metric_df_gpu_information_params_0_1_t; - -////////////////////////////////////////////////////////////////////////////////// -// zet_intel_metric_df_gpu_metric_set_params_0_1_t -////////////////////////////////////////////////////////////////////////////////// -typedef struct _zet_intel_metric_df_gpu_metric_set_params_0_1_t { - cstring_offset_t symbolName; // For example "Dx11Tessellation" - cstring_offset_t shortName; // For example "DX11 Tessellation Metrics Set" - uint32_t apiMask; - uint32_t metricsCount; - uint32_t informationCount; - cstring_offset_t availabilityEquation; -} zet_intel_metric_df_gpu_metric_set_params_0_1_t; - -////////////////////////////////////////////////////////////////////////////////// -// zet_intel_metric_df_gpu_concurrent_group_params_0_1_t -////////////////////////////////////////////////////////////////////////////////// -typedef struct _zet_intel_metric_df_gpu_concurrent_group_params_0_1_t { - cstring_offset_t symbolName; // For example "OA" or "OAM0" or "PipeStats" - cstring_offset_t description; // For example "OA Unit Metrics" - uint32_t ioMeasurementInformationCount; - uint32_t ioGpuContextInformationCount; -} zet_intel_metric_df_gpu_concurrent_group_params_0_1_t; - -////////////////////////////////////////////////////////////////////////////////// -// zet_intel_metric_df_gpu_concurrent_group_0_1_t -////////////////////////////////////////////////////////////////////////////////// -typedef struct _zet_intel_metric_df_gpu_concurrent_group_0_1_t { - zet_intel_metric_df_gpu_concurrent_group_params_0_1_t params; - zet_intel_metric_df_gpu_information_params_0_1_offset_t ioMeasurementInformation; - zet_intel_metric_df_gpu_information_params_0_1_offset_t ioGpuContextInformation; -} zet_intel_metric_df_gpu_concurrent_group_0_1_t; - -////////////////////////////////////////////////////////////////////////////////// -// zet_intel_metric_df_gpu_metric_set_0_1_t -////////////////////////////////////////////////////////////////////////////////// -typedef struct _zet_intel_metric_df_gpu_metric_set_0_1_t { - zet_intel_metric_df_gpu_metric_set_params_0_1_t params; - zet_intel_metric_df_gpu_information_params_0_1_offset_t informationParams; - zet_intel_metric_df_gpu_metric_params_0_1_offset_t metricParams; -} zet_intel_metric_df_gpu_metric_set_0_1_t; - -////////////////////////////////////////////////////////////////////////////////// -// zet_intel_metric_df_gpu_metric_oa_calc_0_1_t -////////////////////////////////////////////////////////////////////////////////// -typedef struct _zet_intel_metric_df_gpu_metric_oa_calc_0_1_t { - zet_intel_metric_df_gpu_metrics_device_params_0_1_t deviceParams; - zet_intel_metric_df_gpu_global_symbol_0_1_offset_t globalSymbols; - zet_intel_metric_df_gpu_adapter_params_0_1_t adapterParams; - zet_intel_metric_df_gpu_concurrent_group_0_1_t concurrentGroup; - zet_intel_metric_df_gpu_metric_set_0_1_t metricSet; -} zet_intel_metric_df_gpu_metric_oa_calc_0_1_t; - -////////////////////////////////////////////////////////////////////////////////// -// zet_intel_metric_df_gpu_export_data_format_0_1_t -////////////////////////////////////////////////////////////////////////////////// -typedef struct _zet_intel_metric_df_gpu_export_data_format_0_1_t { - union { - zet_intel_metric_df_gpu_metric_oa_calc_0_1_t oaData; - }; -} zet_intel_metric_df_gpu_export_data_format_0_1_t; - -////////////////////////////////////////////////////////////////////////////////// -// zet_intel_metric_df_gpu_metric_source_type_t -////////////////////////////////////////////////////////////////////////////////// -typedef enum _zet_intel_metric_df_gpu_metric_source_type_t { - ZET_INTEL_METRIC_DF_SOURCE_TYPE_OA, - ZET_INTEL_METRIC_DF_SOURCE_TYPE_IPSAMPLING, - ZET_INTEL_METRIC_DF_SOURCE_TYPE_FORCE_UINT32 = 0x7fffffff -} zet_intel_metric_df_gpu_metric_source_type_t; - -////////////////////////////////////////////////////////////////////////////////// -// zet_intel_metric_df_gpu_metric_version_t -////////////////////////////////////////////////////////////////////////////////// -typedef struct _zet_intel_metric_df_gpu_metric_version_t { - uint32_t major; - uint32_t minor; - uint32_t reserved[2]; -} zet_intel_metric_df_gpu_metric_version_t; - -////////////////////////////////////////////////////////////////////////////////// -// zet_intel_metric_df_gpu_header_t -////////////////////////////////////////////////////////////////////////////////// -typedef struct _zet_intel_metric_df_gpu_header_t { - zet_intel_metric_df_gpu_metric_source_type_t type; - zet_intel_metric_df_gpu_metric_version_t version; - ze_device_type_t deviceType; - uint64_t rawDataOffset; - uint64_t rawDataSize; - uint8_t reserved[256]; -} zet_intel_metric_df_gpu_header_t; - -////////////////////////////////////////////////////////////////////////////////// -// zet_intel_metric_df_gpu_export_data_format_t -////////////////////////////////////////////////////////////////////////////////// -typedef struct _zet_intel_metric_df_gpu_export_data_format_t { - zet_intel_metric_df_gpu_header_t header; - zet_intel_metric_df_gpu_export_data_format_0_1_t format01; -} zet_intel_metric_df_gpu_export_data_format_t; - -#define offset_to_pointer(offset, base) (ZET_INTEL_GPU_METRIC_INVALID_OFFSET == offset ? nullptr : (uint8_t *)base + offset) -#define uint8_offset_t_to_pointer(offset, base) (uint8_t *)offset_to_pointer(offset, base) -#define cstring_offset_t_to_pointer(offset, base) (const char *)offset_to_pointer(offset, base) -#define zet_intel_metric_df_gpu_equation_element_0_1_offset_t_to_pointer(offset, base) (zet_intel_metric_df_gpu_equation_element_0_1_t *)offset_to_pointer(offset, base) -#define zet_intel_metric_df_gpu_information_params_0_1_offset_t_to_pointer(offset, base) (zet_intel_metric_df_gpu_information_params_0_1_t *)offset_to_pointer(offset, base) -#define zet_intel_metric_df_gpu_metric_params_0_1_offset_t_to_pointer(offset, base) (zet_intel_metric_df_gpu_metric_params_0_1_t *)offset_to_pointer(offset, base) -#define zet_intel_metric_df_gpu_global_symbol_0_1_offset_t_to_pointer(offset, base) (zet_intel_metric_df_gpu_global_symbol_0_1_t *)offset_to_pointer(offset, base) - -#pragma pack(pop) +/////////////////////////////////////////////////////////////////////////////// +/// @brief Get sets of metric groups which could be collected concurrently. +/// +/// @details +/// - Re-arrange the input metric groups to provide sets of concurrent metric groups. +/// - The application may call this function from simultaneous threads. +/// - The implementation of this function must be thread-safe. +/// +/// @returns +/// - ::ZE_RESULT_SUCCESS +/// - ::ZE_RESULT_ERROR_INVALID_ARGUMENT +/// + `pConcurrentGroupCount` is not same as was returned by L0 using zetIntelDeviceGetConcurrentMetricGroupsExp +ze_result_t ZE_APICALL +zetIntelDeviceGetConcurrentMetricGroupsExp( + zet_device_handle_t hDevice, // [in] handle of the device + uint32_t metricGroupCount, // [in] metric group count + zet_metric_group_handle_t *phMetricGroups, // [in, out] metrics groups to be re-arranged to be sets of concurrent groups + uint32_t *pConcurrentGroupCount, // [out] number of concurrent groups. + uint32_t *pCountPerConcurrentGroup); // [in,out][optional][*pConcurrentGroupCount] count of metric groups per concurrent group. #if defined(__cplusplus) } // extern "C" #endif -#endif // _ZET_INTEL_GPU_METRIC_H \ No newline at end of file +#endif diff --git a/level_zero/include/zet_intel_gpu_metric_export.h b/level_zero/include/zet_intel_gpu_metric_export.h new file mode 100644 index 0000000000..e38ced2f84 --- /dev/null +++ b/level_zero/include/zet_intel_gpu_metric_export.h @@ -0,0 +1,461 @@ +/* + * Copyright (C) 2024 Intel Corporation + * + * SPDX-License-Identifier: MIT + * + */ + +#ifndef _ZET_INTEL_GPU_METRIC_EXPORT_H +#define _ZET_INTEL_GPU_METRIC_EXPORT_H + +#include + +#if defined(__cplusplus) +#pragma once +extern "C" { +#endif + +#include + +#define ZET_INTEL_GPU_METRIC_EXPORT_VERSION_MAJOR 0 +#define ZET_INTEL_GPU_METRIC_EXPORT_VERSION_MINOR 1 + +#pragma pack(push, 1) + +#define ZET_INTEL_GPU_METRIC_INVALID_OFFSET ((ptrdiff_t)0u) +#define zet_intel_metric_df_gpu_offset_to_ptr(type, offset, base) \ + type##_to_pointer(offset, base); + +typedef ptrdiff_t uint8_offset_t; +typedef ptrdiff_t cstring_offset_t; +typedef ptrdiff_t zet_intel_metric_df_gpu_equation_element_0_1_offset_t; +typedef ptrdiff_t zet_intel_metric_df_gpu_information_params_0_1_offset_t; +typedef ptrdiff_t zet_intel_metric_df_gpu_metric_params_0_1_offset_t; +typedef ptrdiff_t zet_intel_metric_df_gpu_global_symbol_0_1_offset_t; + +////////////////////////////////////////////////////////////////////////////////// +// zet_intel_metric_df_gpu_apiversion_0_1_t +////////////////////////////////////////////////////////////////////////////////// +typedef struct _zet_intel_metric_df_gpu_apiversion_0_1_t { + uint32_t majorNumber; + uint32_t minorNumber; + uint32_t buildNumber; +} zet_intel_metric_df_gpu_apiversion_0_1_t; + +////////////////////////////////////////////////////////////////////////////////// +// zet_intel_metric_df_gpu_adapter_id_type_t +////////////////////////////////////////////////////////////////////////////////// +typedef enum _zet_intel_metric_df_gpu_adapter_id_type_t { + ZET_INTEL_METRIC_DF_ADAPTER_ID_TYPE_UNDEFINED = 0, + ZET_INTEL_METRIC_DF_ADAPTER_ID_TYPE_LUID, + ZET_INTEL_METRIC_DF_ADAPTER_ID_TYPE_MAJOR_MINOR, + ZET_INTEL_METRIC_DF_ADAPTER_ID_TYPE_FORCE_UINT32 = 0x7fffffff +} zet_intel_metric_df_gpu_adapter_id_type_t; + +////////////////////////////////////////////////////////////////////////////////// +// zet_intel_metric_df_gpu_adapter_id_luid_0_1_t +////////////////////////////////////////////////////////////////////////////////// +typedef struct _zet_intel_metric_df_gpu_adapter_id_luid_0_1_t { + uint32_t lowPart; + int32_t highPart; +} zet_intel_metric_df_gpu_adapter_id_luid_0_1_t; + +////////////////////////////////////////////////////////////////////////////////// +// zet_intel_metric_df_gpu_adapter_id_major_minor_0_1_t +////////////////////////////////////////////////////////////////////////////////// +typedef struct _zet_intel_metric_df_gpu_adapter_id_major_minor_0_1_t { + int32_t major; + int32_t minor; +} zet_intel_metric_df_gpu_adapter_id_major_minor_0_1_t; + +////////////////////////////////////////////////////////////////////////////////// +// zet_intel_metric_df_gpu_adapter_id_0_1_t +////////////////////////////////////////////////////////////////////////////////// +typedef struct _zet_intel_metric_df_gpu_adapter_id_0_1_t { + zet_intel_metric_df_gpu_adapter_id_type_t type; + union { + zet_intel_metric_df_gpu_adapter_id_luid_0_1_t luid; + zet_intel_metric_df_gpu_adapter_id_major_minor_0_1_t majorMinor; + }; +} zet_intel_metric_df_gpu_adapter_id_0_1_t; + +////////////////////////////////////////////////////////////////////////////////// +// zet_intel_metric_df_gpu_adapter_params_0_1_t +////////////////////////////////////////////////////////////////////////////////// +typedef struct _zet_intel_metric_df_gpu_adapter_params_0_1_t { + zet_intel_metric_df_gpu_adapter_id_0_1_t systemId; // Operating system specific adapter id + uint32_t busNumber; + uint32_t deviceNumber; + uint32_t functionNumber; + uint32_t domainNumber; +} zet_intel_metric_df_gpu_adapter_params_0_1_t; + +////////////////////////////////////////////////////////////////////////////////// +// zet_intel_metric_df_gpu_metrics_device_params_0_1_t +////////////////////////////////////////////////////////////////////////////////// +typedef struct _zet_intel_metric_df_gpu_metrics_device_params_0_1_t { + // API version + zet_intel_metric_df_gpu_apiversion_0_1_t version; + uint32_t globalSymbolsCount; +} zet_intel_metric_df_gpu_metrics_device_params_0_1_t; + +////////////////////////////////////////////////////////////////////////////////// +// zet_intel_metric_df_gpu_value_type_t +////////////////////////////////////////////////////////////////////////////////// +typedef enum _zet_intel_metric_df_gpu_value_type_t { + ZET_INTEL_METRIC_DF_VALUE_TYPE_UINT32 = 0, + ZET_INTEL_METRIC_DF_VALUE_TYPE_UINT64, + ZET_INTEL_METRIC_DF_VALUE_TYPE_FLOAT, + ZET_INTEL_METRIC_DF_VALUE_TYPE_BOOL, + ZET_INTEL_METRIC_DF_VALUE_TYPE_CSTRING, + ZET_INTEL_METRIC_DF_VALUE_TYPE_BYTEARRAY, + ZET_INTEL_METRIC_DF_VALUE_TYPE_FORCE_UINT32 = 0x7fffffff +} zet_intel_metric_df_gpu_value_type_t; + +////////////////////////////////////////////////////////////////////////////////// +// zet_intel_metric_df_gpu_byte_array_0_1_t +////////////////////////////////////////////////////////////////////////////////// +typedef struct _zet_intel_metric_df_gpu_byte_array_0_1_t { + uint8_offset_t data; + uint32_t size; +} zet_intel_metric_df_gpu_byte_array_0_1_t; + +////////////////////////////////////////////////////////////////////////////////// +// zet_intel_metric_df_gpu_typed_value_0_1_t +////////////////////////////////////////////////////////////////////////////////// +typedef struct _zet_intel_metric_df_gpu_typed_value_0_1_t { + union { + uint32_t valueUInt32; + uint64_t valueUInt64; + struct { + uint32_t low; + uint32_t high; + } valueUInt64Fields; + float valueFloat; + bool valueBool; + cstring_offset_t valueCString; + zet_intel_metric_df_gpu_byte_array_0_1_t valueByteArray; + }; + zet_intel_metric_df_gpu_value_type_t valueType; +} zet_intel_metric_df_gpu_typed_value_0_1_t; + +////////////////////////////////////////////////////////////////////////////////// +// zet_intel_metric_df_gpu_global_symbol_0_1_t +////////////////////////////////////////////////////////////////////////////////// +typedef struct _zet_intel_metric_df_gpu_global_symbol_0_1_t { + cstring_offset_t symbolName; + zet_intel_metric_df_gpu_typed_value_0_1_t symbolTypedValue; +} zet_intel_metric_df_gpu_global_symbol_0_1_t; + +////////////////////////////////////////////////////////////////////////////////// +// zet_intel_metric_df_gpu_equation_element_type_t +////////////////////////////////////////////////////////////////////////////////// +typedef enum _zet_intel_metric_df_gpu_equation_element_type_t { + ZET_INTEL_METRIC_DF_EQUATION_ELEM_OPERATION = 0, // See Tequation_operation enumeration + ZET_INTEL_METRIC_DF_EQUATION_ELEM_RD_BITFIELD, // + ZET_INTEL_METRIC_DF_EQUATION_ELEM_RD_UINT8, // + ZET_INTEL_METRIC_DF_EQUATION_ELEM_RD_UINT16, // + ZET_INTEL_METRIC_DF_EQUATION_ELEM_RD_UINT32, // + ZET_INTEL_METRIC_DF_EQUATION_ELEM_RD_UINT64, // + ZET_INTEL_METRIC_DF_EQUATION_ELEM_RD_FLOAT, // + ZET_INTEL_METRIC_DF_EQUATION_ELEM_RD_40BIT_CNTR, // Assemble 40 bit counter that is in two locations, result in unsigned integer 64b + ZET_INTEL_METRIC_DF_EQUATION_ELEM_IMM_UINT64, // + ZET_INTEL_METRIC_DF_EQUATION_ELEM_IMM_FLOAT, // + ZET_INTEL_METRIC_DF_EQUATION_ELEM_SELF_COUNTER_VALUE, // Defined by $Self token, the UINT64 result of delta_function for IO or QueryReadEquation + ZET_INTEL_METRIC_DF_EQUATION_ELEM_GLOBAL_SYMBOL, // Defined by $"SymbolName", available in MetricsDevice SymbolTable + ZET_INTEL_METRIC_DF_EQUATION_ELEM_LOCAL_COUNTER_SYMBOL, // Defined by $"SymbolName", refers to counter delta value in the local set + ZET_INTEL_METRIC_DF_EQUATION_ELEM_OTHER_SET_COUNTER_SYMBOL, // Defined by concatenated string of $"setSymbolName/SymbolName", refers to counter + // Delta value in the other set + ZET_INTEL_METRIC_DF_EQUATION_ELEM_LOCAL_METRIC_SYMBOL, // Defined by $$"SymbolName", refers to metric normalized value in the local set + ZET_INTEL_METRIC_DF_EQUATION_ELEM_OTHER_SET_METRIC_SYMBOL, // Defined by concatenated string of $$"setSymbolName/SymbolName", refers to metric + // Normalized value in the other set + ZET_INTEL_METRIC_DF_EQUATION_ELEM_INFORMATION_SYMBOL, // Defined by i$"SymbolName", refers to information value type only + ZET_INTEL_METRIC_DF_EQUATION_ELEM_STD_NORM_GPU_DURATION, // Action is $Self $GpuCoreClocks FDIV 100 FMUL + ZET_INTEL_METRIC_DF_EQUATION_ELEM_STD_NORM_EU_AGGR_DURATION, // Action is $Self $GpuCoreClocks $EuCoresTotalCount UMUL FDIV 100 FMUL + ZET_INTEL_METRIC_DF_EQUATION_ELEM_MASK, + ZET_INTEL_METRIC_DF_EQUATION_ELEM_FORCE_UINT32 = 0x7fffffff +} zet_intel_metric_df_gpu_equation_element_type_t; + +////////////////////////////////////////////////////////////////////////////////// +// zet_intel_metric_df_gpu_equation_operation_t +////////////////////////////////////////////////////////////////////////////////// +typedef enum _zet_intel_metric_df_gpu_equation_operation_t { + ZET_INTEL_METRIC_DF_EQUATION_OPER_RSHIFT = 0, // 64b unsigned integer right shift + ZET_INTEL_METRIC_DF_EQUATION_OPER_LSHIFT, // 64b unsigned integer left shift + ZET_INTEL_METRIC_DF_EQUATION_OPER_AND, // Bitwise AND of two unsigned integers, 64b each + ZET_INTEL_METRIC_DF_EQUATION_OPER_OR, // Bitwise OR of two unsigned integers, 64b each + ZET_INTEL_METRIC_DF_EQUATION_OPER_XOR, // Bitwise XOR of two unsigned integers, 64b each + ZET_INTEL_METRIC_DF_EQUATION_OPER_XNOR, // Bitwise XNOR of two unsigned integers, 64b each + ZET_INTEL_METRIC_DF_EQUATION_OPER_AND_L, // Logical AND (C-like "&&") of two unsigned integers, 64b each, result is true(1) if both values are true(greater than 0) + ZET_INTEL_METRIC_DF_EQUATION_OPER_EQUALS, // Equality (C-like "==") of two unsigned integers, 64b each, result is true(1) or false(0) + ZET_INTEL_METRIC_DF_EQUATION_OPER_UADD, // Unsigned integer add, arguments are casted to be 64b unsigned integers, result is unsigned integer 64b + ZET_INTEL_METRIC_DF_EQUATION_OPER_USUB, // Unsigned integer subtract, arguments are casted to be 64b unsigned integers, result is unsigned integer 64b + ZET_INTEL_METRIC_DF_EQUATION_OPER_UMUL, // Unsigned integer mul, arguments are casted to be 64b unsigned integers, result is unsigned integer 64b + ZET_INTEL_METRIC_DF_EQUATION_OPER_UDIV, // Unsigned integer div, arguments are casted to be 64b unsigned integers, result is unsigned integer 64b + ZET_INTEL_METRIC_DF_EQUATION_OPER_FADD, // Floating point add, arguments are casted to be 32b floating points, result is a 32b float + ZET_INTEL_METRIC_DF_EQUATION_OPER_FSUB, // Floating point subtract, arguments are casted to be 32b floating points, result is a 32b float + ZET_INTEL_METRIC_DF_EQUATION_OPER_FMUL, // Floating point multiply, arguments are casted to be 32b floating points, result is a 32b float + ZET_INTEL_METRIC_DF_EQUATION_OPER_FDIV, // Floating point divide, arguments are casted to be 32b floating points, result is a 32b float + ZET_INTEL_METRIC_DF_EQUATION_OPER_UGT, // 64b unsigned integers comparison of is greater than, result is bool true(1) or false(0) + ZET_INTEL_METRIC_DF_EQUATION_OPER_ULT, // 64b unsigned integers comparison of is less than, result is bool true(1) or false(0) + ZET_INTEL_METRIC_DF_EQUATION_OPER_UGTE, // 64b unsigned integers comparison of is greater than or equal, result is bool true(1) or false(0) + ZET_INTEL_METRIC_DF_EQUATION_OPER_ULTE, // 64b unsigned integers comparison of is less than or equal, result is bool true(1) or false(0) + ZET_INTEL_METRIC_DF_EQUATION_OPER_FGT, // 32b floating point numbers comparison of is greater than, result is bool true(1) or false(0) + ZET_INTEL_METRIC_DF_EQUATION_OPER_FLT, // 32b floating point numbers comparison of is less than, result is bool true(1) or false(0) + ZET_INTEL_METRIC_DF_EQUATION_OPER_FGTE, // 32b floating point numbers comparison of is greater than or equal, result is bool true(1) or false(0) + ZET_INTEL_METRIC_DF_EQUATION_OPER_FLTE, // 32b floating point numbers comparison of is less than or equal, result is bool true(1) or false(0) + ZET_INTEL_METRIC_DF_EQUATION_OPER_UMIN, // Unsigned integer MIN function, arguments are casted to be 64b unsigned integers, result is unsigned integer 64b + ZET_INTEL_METRIC_DF_EQUATION_OPER_UMAX, // Unsigned integer MAX function, arguments are casted to be 64b unsigned integers, result is unsigned integer 64b + ZET_INTEL_METRIC_DF_EQUATION_OPER_FMIN, // Floating point MIN function, arguments are casted to be 32b floating points, result is a 32b float + ZET_INTEL_METRIC_DF_EQUATION_OPER_FMAX, // Floating point MAX function, arguments are casted to be 32b floating points, result is a 32b float + ZET_INTEL_METRIC_DF_EQUATION_OPER_FORCE_UINT32 = 0x7fffffff +} zet_intel_metric_df_gpu_equation_operation_t; + +////////////////////////////////////////////////////////////////////////////////// +// zet_intel_metric_df_gpu_read_params_0_1_t +////////////////////////////////////////////////////////////////////////////////// +typedef struct _zet_intel_metric_df_gpu_read_params_0_1_t { + uint32_t byteOffset; + uint32_t bitOffset; + uint32_t bitsCount; + uint32_t byteOffsetExt; +} zet_intel_metric_df_gpu_read_params_0_1_t; + +////////////////////////////////////////////////////////////////////////////////// +// zet_intel_metric_df_gpu_equation_element_0_1_t +////////////////////////////////////////////////////////////////////////////////// +typedef struct _zet_intel_metric_df_gpu_equation_element_0_1_t { + cstring_offset_t symbolName; + union { + uint64_t immediateUInt64; + float immediateFloat; + zet_intel_metric_df_gpu_byte_array_0_1_t mask; + zet_intel_metric_df_gpu_equation_operation_t operation; + zet_intel_metric_df_gpu_read_params_0_1_t readParams; + }; + zet_intel_metric_df_gpu_equation_element_type_t type; +} zet_intel_metric_df_gpu_equation_element_0_1_t; + +////////////////////////////////////////////////////////////////////////////////// +// zet_intel_metric_df_gpu_equation_0_1_t +////////////////////////////////////////////////////////////////////////////////// +typedef struct _zet_intel_metric_df_gpu_equation_0_1_t { + uint32_t elementCount; + zet_intel_metric_df_gpu_equation_element_0_1_offset_t elements; +} zet_intel_metric_df_gpu_equation_0_1_t; + +////////////////////////////////////////////////////////////////////////////////// +// zet_intel_metric_df_gpu_metric_result_type_t +////////////////////////////////////////////////////////////////////////////////// +typedef enum _zet_intel_metric_df_gpu_metric_result_type_t { + ZET_INTEL_METRIC_DF_RESULT_UINT32 = 0, + ZET_INTEL_METRIC_DF_RESULT_UINT64, + ZET_INTEL_METRIC_DF_RESULT_BOOL, + ZET_INTEL_METRIC_DF_RESULT_FLOAT, + ZET_INTEL_METRIC_DF_RESULT_FORCE_UINT32 = 0x7fffffff +} zet_intel_metric_df_gpu_metric_result_type_t; + +////////////////////////////////////////////////////////////////////////////////// +// zet_intel_metric_df_gpu_delta_function_type_t +////////////////////////////////////////////////////////////////////////////////// +typedef enum _zet_intel_metric_df_gpu_delta_function_type_t { + ZET_INTEL_METRIC_DF_DELTA_FUNCTION_NULL = 0, + ZET_INTEL_METRIC_DF_DELTA_N_BITS, + ZET_INTEL_METRIC_DF_DELTA_BOOL_OR, // Logic OR - good for exceptions + ZET_INTEL_METRIC_DF_DELTA_BOOL_XOR, // Logic XOR - good to check if bits were changed + ZET_INTEL_METRIC_DF_DELTA_GET_PREVIOUS, // Preserve previous value + ZET_INTEL_METRIC_DF_DELTA_GET_LAST, // Preserve last value + ZET_INTEL_METRIC_DF_DELTA_NS_TIME, // Delta for nanosecond timestamps (GPU timestamp wraps at 32 bits but was value multiplied by 80) + ZET_INTEL_METRIC_DF_DELTA_FORCE_UINT32 = 0x7fffffff +} zet_intel_metric_df_gpu_delta_function_type_t; + +////////////////////////////////////////////////////////////////////////////////// +// zet_intel_metric_df_gpu_metric_type_t +////////////////////////////////////////////////////////////////////////////////// +typedef enum _zet_intel_metric_df_gpu_metric_type_t { + ZET_INTEL_METRIC_DF_METRIC_TYPE_DURATION = 0, + ZET_INTEL_METRIC_DF_METRIC_TYPE_EVENT, + ZET_INTEL_METRIC_DF_METRIC_TYPE_EVENT_WITH_RANGE, + ZET_INTEL_METRIC_DF_METRIC_TYPE_THROUGHPUT, + ZET_INTEL_METRIC_DF_METRIC_TYPE_TIMESTAMP, + ZET_INTEL_METRIC_DF_METRIC_TYPE_FLAG, + ZET_INTEL_METRIC_DF_METRIC_TYPE_RATIO, + ZET_INTEL_METRIC_DF_METRIC_TYPE_RAW, + ZET_INTEL_METRIC_DF_METRIC_TYPE_FORCE_UINT32 = 0x7fffffff +} zet_intel_metric_df_gpu_metric_type_t; + +////////////////////////////////////////////////////////////////////////////////// +// zet_intel_metric_df_gpu_delta_function_0_1_t +////////////////////////////////////////////////////////////////////////////////// +typedef struct _zet_intel_metric_df_gpu_delta_function_0_1_t { + zet_intel_metric_df_gpu_delta_function_type_t functionType; + union { + uint32_t bitsCount; // Used for DELTA_N_BITS to specify bits count + }; +} zet_intel_metric_df_gpu_delta_function_0_1_t; + +////////////////////////////////////////////////////////////////////////////////// +// zet_intel_metric_df_gpu_metric_params_0_1_t +////////////////////////////////////////////////////////////////////////////////// +typedef struct _zet_intel_metric_df_gpu_metric_params_0_1_t { + cstring_offset_t symbolName; // Symbol name, used in equations + cstring_offset_t shortName; // Consistent metric name, not changed platform to platform + cstring_offset_t groupName; // VertexShader for example + cstring_offset_t longName; // Hint about the metric shown to users + uint32_t idInSet; // Position in set (may change after SetApiFiltering) + uint32_t apiMask; // + cstring_offset_t metricResultUnits; // + zet_intel_metric_df_gpu_metric_type_t metricType; // + zet_intel_metric_df_gpu_equation_0_1_t ioReadEquation; // Read equation specification for IO stream (accessing raw values potentially spread in report in several locations) + zet_intel_metric_df_gpu_equation_0_1_t queryReadEquation; // Read equation specification for query (accessing calculated delta values) + zet_intel_metric_df_gpu_delta_function_0_1_t deltaFunction; // + zet_intel_metric_df_gpu_equation_0_1_t normEquation; // Normalization equation to get normalized value to bytes transfered or to a percentage of utilization + zet_intel_metric_df_gpu_equation_0_1_t maxValueEquation; // To calculate metrics max value as a function of other metrics and device parameters (e.g. 100 for percentage) + uint32_t usageFlagsMask; + zet_intel_metric_df_gpu_metric_result_type_t resultType; +} zet_intel_metric_df_gpu_metric_params_0_1_t; + +////////////////////////////////////////////////////////////////////////////////// +// zet_intel_metric_df_gpu_information_type_t +////////////////////////////////////////////////////////////////////////////////// +typedef enum _zet_intel_metric_df_gpu_information_type_t { + ZET_INTEL_METRIC_DF_INFORMATION_TYPE_REPORT_REASON = 0, + ZET_INTEL_METRIC_DF_INFORMATION_TYPE_VALUE, + ZET_INTEL_METRIC_DF_INFORMATION_TYPE_FLAG, + ZET_INTEL_METRIC_DF_INFORMATION_TYPE_TIMESTAMP, + ZET_INTEL_METRIC_DF_INFORMATION_TYPE_CONTEXT_ID_TAG, + ZET_INTEL_METRIC_DF_INFORMATION_TYPE_SAMPLE_PHASE, + ZET_INTEL_METRIC_DF_INFORMATION_TYPE_GPU_NODE, + ZET_INTEL_METRIC_DF_INFORMATION_TYPE_FORCE_UINT32 = 0x7fffffff +} zet_intel_metric_df_gpu_information_type_t; + +////////////////////////////////////////////////////////////////////////////////// +// zet_intel_metric_df_gpu_information_params_0_1_t +////////////////////////////////////////////////////////////////////////////////// +typedef struct _zet_intel_metric_df_gpu_information_params_0_1_t { + cstring_offset_t symbolName; // Symbol name, used in equations + cstring_offset_t shortName; // Consistent name, not changed platform to platform + cstring_offset_t groupName; // Some more global context of the information + cstring_offset_t longName; // Hint about the information shown to users + uint32_t idInSet; + uint32_t apiMask; // + zet_intel_metric_df_gpu_information_type_t infoType; // + cstring_offset_t infoUnits; // + zet_intel_metric_df_gpu_equation_0_1_t ioReadEquation; // Read equation specification for IO stream (accessing raw values potentially spread in report in several locations) + zet_intel_metric_df_gpu_equation_0_1_t queryReadEquation; // Read equation specification for query (accessing calculated delta values) + zet_intel_metric_df_gpu_delta_function_0_1_t overflowFunction; // +} zet_intel_metric_df_gpu_information_params_0_1_t; + +////////////////////////////////////////////////////////////////////////////////// +// zet_intel_metric_df_gpu_metric_set_params_0_1_t +////////////////////////////////////////////////////////////////////////////////// +typedef struct _zet_intel_metric_df_gpu_metric_set_params_0_1_t { + cstring_offset_t symbolName; // For example "Dx11Tessellation" + cstring_offset_t shortName; // For example "DX11 Tessellation Metrics Set" + uint32_t apiMask; + uint32_t metricsCount; + uint32_t informationCount; + cstring_offset_t availabilityEquation; +} zet_intel_metric_df_gpu_metric_set_params_0_1_t; + +////////////////////////////////////////////////////////////////////////////////// +// zet_intel_metric_df_gpu_concurrent_group_params_0_1_t +////////////////////////////////////////////////////////////////////////////////// +typedef struct _zet_intel_metric_df_gpu_concurrent_group_params_0_1_t { + cstring_offset_t symbolName; // For example "OA" or "OAM0" or "PipeStats" + cstring_offset_t description; // For example "OA Unit Metrics" + uint32_t ioMeasurementInformationCount; + uint32_t ioGpuContextInformationCount; +} zet_intel_metric_df_gpu_concurrent_group_params_0_1_t; + +////////////////////////////////////////////////////////////////////////////////// +// zet_intel_metric_df_gpu_concurrent_group_0_1_t +////////////////////////////////////////////////////////////////////////////////// +typedef struct _zet_intel_metric_df_gpu_concurrent_group_0_1_t { + zet_intel_metric_df_gpu_concurrent_group_params_0_1_t params; + zet_intel_metric_df_gpu_information_params_0_1_offset_t ioMeasurementInformation; + zet_intel_metric_df_gpu_information_params_0_1_offset_t ioGpuContextInformation; +} zet_intel_metric_df_gpu_concurrent_group_0_1_t; + +////////////////////////////////////////////////////////////////////////////////// +// zet_intel_metric_df_gpu_metric_set_0_1_t +////////////////////////////////////////////////////////////////////////////////// +typedef struct _zet_intel_metric_df_gpu_metric_set_0_1_t { + zet_intel_metric_df_gpu_metric_set_params_0_1_t params; + zet_intel_metric_df_gpu_information_params_0_1_offset_t informationParams; + zet_intel_metric_df_gpu_metric_params_0_1_offset_t metricParams; +} zet_intel_metric_df_gpu_metric_set_0_1_t; + +////////////////////////////////////////////////////////////////////////////////// +// zet_intel_metric_df_gpu_metric_oa_calc_0_1_t +////////////////////////////////////////////////////////////////////////////////// +typedef struct _zet_intel_metric_df_gpu_metric_oa_calc_0_1_t { + zet_intel_metric_df_gpu_metrics_device_params_0_1_t deviceParams; + zet_intel_metric_df_gpu_global_symbol_0_1_offset_t globalSymbols; + zet_intel_metric_df_gpu_adapter_params_0_1_t adapterParams; + zet_intel_metric_df_gpu_concurrent_group_0_1_t concurrentGroup; + zet_intel_metric_df_gpu_metric_set_0_1_t metricSet; +} zet_intel_metric_df_gpu_metric_oa_calc_0_1_t; + +////////////////////////////////////////////////////////////////////////////////// +// zet_intel_metric_df_gpu_export_data_format_0_1_t +////////////////////////////////////////////////////////////////////////////////// +typedef struct _zet_intel_metric_df_gpu_export_data_format_0_1_t { + union { + zet_intel_metric_df_gpu_metric_oa_calc_0_1_t oaData; + }; +} zet_intel_metric_df_gpu_export_data_format_0_1_t; + +////////////////////////////////////////////////////////////////////////////////// +// zet_intel_metric_df_gpu_metric_source_type_t +////////////////////////////////////////////////////////////////////////////////// +typedef enum _zet_intel_metric_df_gpu_metric_source_type_t { + ZET_INTEL_METRIC_DF_SOURCE_TYPE_OA = 0, + ZET_INTEL_METRIC_DF_SOURCE_TYPE_IPSAMPLING, + ZET_INTEL_METRIC_DF_SOURCE_TYPE_FORCE_UINT32 = 0x7fffffff +} zet_intel_metric_df_gpu_metric_source_type_t; + +////////////////////////////////////////////////////////////////////////////////// +// zet_intel_metric_df_gpu_metric_version_t +////////////////////////////////////////////////////////////////////////////////// +typedef struct _zet_intel_metric_df_gpu_metric_version_t { + uint32_t major; + uint32_t minor; + uint32_t reserved[2]; +} zet_intel_metric_df_gpu_metric_version_t; + +////////////////////////////////////////////////////////////////////////////////// +// zet_intel_metric_df_gpu_header_t +////////////////////////////////////////////////////////////////////////////////// +typedef struct _zet_intel_metric_df_gpu_header_t { + zet_intel_metric_df_gpu_metric_source_type_t type; + zet_intel_metric_df_gpu_metric_version_t version; + ze_device_type_t deviceType; + uint64_t rawDataOffset; + uint64_t rawDataSize; + uint8_t reserved[256]; +} zet_intel_metric_df_gpu_header_t; + +////////////////////////////////////////////////////////////////////////////////// +// zet_intel_metric_df_gpu_export_data_format_t +////////////////////////////////////////////////////////////////////////////////// +typedef struct _zet_intel_metric_df_gpu_export_data_format_t { + zet_intel_metric_df_gpu_header_t header; + zet_intel_metric_df_gpu_export_data_format_0_1_t format01; +} zet_intel_metric_df_gpu_export_data_format_t; + +#define offset_to_pointer(offset, base) (ZET_INTEL_GPU_METRIC_INVALID_OFFSET == offset ? nullptr : (uint8_t *)base + offset) +#define uint8_offset_t_to_pointer(offset, base) (uint8_t *)offset_to_pointer(offset, base) +#define cstring_offset_t_to_pointer(offset, base) (const char *)offset_to_pointer(offset, base) +#define zet_intel_metric_df_gpu_equation_element_0_1_offset_t_to_pointer(offset, base) (zet_intel_metric_df_gpu_equation_element_0_1_t *)offset_to_pointer(offset, base) +#define zet_intel_metric_df_gpu_information_params_0_1_offset_t_to_pointer(offset, base) (zet_intel_metric_df_gpu_information_params_0_1_t *)offset_to_pointer(offset, base) +#define zet_intel_metric_df_gpu_metric_params_0_1_offset_t_to_pointer(offset, base) (zet_intel_metric_df_gpu_metric_params_0_1_t *)offset_to_pointer(offset, base) +#define zet_intel_metric_df_gpu_global_symbol_0_1_offset_t_to_pointer(offset, base) (zet_intel_metric_df_gpu_global_symbol_0_1_t *)offset_to_pointer(offset, base) + +#pragma pack(pop) + +#if defined(__cplusplus) +} // extern "C" +#endif + +#endif // _ZET_INTEL_GPU_METRIC_H \ No newline at end of file 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 35c83be279..8b5e1b0bf5 100644 --- a/level_zero/tools/source/metrics/metric_ip_sampling_source.cpp +++ b/level_zero/tools/source/metrics/metric_ip_sampling_source.cpp @@ -12,11 +12,11 @@ #include "shared/source/helpers/hw_info.h" #include "shared/source/helpers/string.h" -#include "level_zero/api/driver_experimental/public/zex_metric.h" #include "level_zero/core/source/device/device.h" #include "level_zero/core/source/device/device_imp.h" #include "level_zero/core/source/gfx_core_helpers/l0_gfx_core_helper.h" #include "level_zero/include/zet_intel_gpu_metric.h" +#include "level_zero/include/zet_intel_gpu_metric_export.h" #include "level_zero/tools/source/metrics/metric.h" #include "level_zero/tools/source/metrics/metric_ip_sampling_streamer.h" #include "level_zero/tools/source/metrics/os_interface_metric.h" @@ -179,8 +179,8 @@ ze_result_t IpSamplingMetricGroupBase::getExportData(const uint8_t *pRawData, si zet_intel_metric_df_gpu_export_data_format_t *exportData = reinterpret_cast(pExportData); exportData->header.type = ZET_INTEL_METRIC_DF_SOURCE_TYPE_IPSAMPLING; - exportData->header.version.major = ZET_INTEL_GPU_METRIC_VERSION_MAJOR; - exportData->header.version.minor = ZET_INTEL_GPU_METRIC_VERSION_MINOR; + exportData->header.version.major = ZET_INTEL_GPU_METRIC_EXPORT_VERSION_MAJOR; + exportData->header.version.minor = ZET_INTEL_GPU_METRIC_EXPORT_VERSION_MINOR; exportData->header.rawDataOffset = sizeof(zet_intel_metric_df_gpu_export_data_format_t); exportData->header.rawDataSize = rawDataSize; diff --git a/level_zero/tools/source/metrics/metric_oa_export_data.cpp b/level_zero/tools/source/metrics/metric_oa_export_data.cpp index 2d33b609eb..35d19d73d3 100644 --- a/level_zero/tools/source/metrics/metric_oa_export_data.cpp +++ b/level_zero/tools/source/metrics/metric_oa_export_data.cpp @@ -769,8 +769,8 @@ ze_result_t OaMetricGroupImp::getExportData(const uint8_t *pRawData, // Update header after updating the export data exportData->header.type = ZET_INTEL_METRIC_DF_SOURCE_TYPE_OA; - exportData->header.version.major = ZET_INTEL_GPU_METRIC_VERSION_MAJOR; - exportData->header.version.minor = ZET_INTEL_GPU_METRIC_VERSION_MINOR; + exportData->header.version.major = ZET_INTEL_GPU_METRIC_EXPORT_VERSION_MAJOR; + exportData->header.version.minor = ZET_INTEL_GPU_METRIC_EXPORT_VERSION_MINOR; exportData->header.rawDataOffset = sizeof(zet_intel_metric_df_gpu_export_data_format_t) + memoryTracker.getUsedBytes(); exportData->header.rawDataSize = rawDataSize; diff --git a/level_zero/tools/source/metrics/metric_oa_export_data.h b/level_zero/tools/source/metrics/metric_oa_export_data.h index a8552c35cd..ceb9894e94 100644 --- a/level_zero/tools/source/metrics/metric_oa_export_data.h +++ b/level_zero/tools/source/metrics/metric_oa_export_data.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2023 Intel Corporation + * Copyright (C) 2023-2024 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -7,7 +7,7 @@ #pragma once -#include "level_zero/include/zet_intel_gpu_metric.h" +#include "level_zero/include/zet_intel_gpu_metric_export.h" #include #include "metrics_discovery_api.h" diff --git a/level_zero/tools/source/metrics/metric_oa_source.cpp b/level_zero/tools/source/metrics/metric_oa_source.cpp index 6d4a9a6683..1db7dacdb0 100644 --- a/level_zero/tools/source/metrics/metric_oa_source.cpp +++ b/level_zero/tools/source/metrics/metric_oa_source.cpp @@ -9,9 +9,9 @@ #include "shared/source/os_interface/os_library.h" -#include "level_zero/api/driver_experimental/public/zex_metric.h" #include "level_zero/core/source/cmdlist/cmdlist.h" #include "level_zero/core/source/device/device_imp.h" +#include "level_zero/include/zet_intel_gpu_metric.h" #include "level_zero/tools/source/metrics/metric.h" #include "level_zero/tools/source/metrics/metric_oa_enumeration_imp.h" #include "level_zero/tools/source/metrics/metric_oa_query_imp.h" diff --git a/level_zero/tools/test/black_box_tests/zello_metrics/zello_metrics_export.cpp b/level_zero/tools/test/black_box_tests/zello_metrics/zello_metrics_export.cpp index c6d3abd6af..7929637728 100644 --- a/level_zero/tools/test/black_box_tests/zello_metrics/zello_metrics_export.cpp +++ b/level_zero/tools/test/black_box_tests/zello_metrics/zello_metrics_export.cpp @@ -1,11 +1,11 @@ /* - * Copyright (C) 2023 Intel Corporation + * Copyright (C) 2023-2024 Intel Corporation * * SPDX-License-Identifier: MIT * */ -#include "level_zero/include/zet_intel_gpu_metric.h" +#include "level_zero/include/zet_intel_gpu_metric_export.h" #include "level_zero/tools/test/black_box_tests/zello_metrics/zello_metrics.h" #include "level_zero/tools/test/black_box_tests/zello_metrics/zello_metrics_util.h" 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 247614d7ed..5ed56911e0 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 @@ -9,10 +9,10 @@ #include "shared/test/common/test_macros/hw_test.h" #include "shared/test/common/test_macros/test_base.h" -#include "level_zero/api/driver_experimental/public/zex_metric.h" #include "level_zero/core/source/cmdlist/cmdlist.h" #include "level_zero/core/test/unit_tests/fixtures/device_fixture.h" #include "level_zero/include/zet_intel_gpu_metric.h" +#include "level_zero/include/zet_intel_gpu_metric_export.h" #include "level_zero/tools/source/metrics/metric_ip_sampling_source.h" #include "level_zero/tools/source/metrics/metric_oa_source.h" #include "level_zero/tools/source/metrics/os_interface_metric.h" 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 4e0a932704..5c1812761f 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 @@ -8,9 +8,9 @@ #include "shared/test/common/mocks/mock_device.h" #include "shared/test/common/test_macros/test.h" -#include "level_zero/api/driver_experimental/public/zex_metric.h" #include "level_zero/core/source/device/device_imp.h" #include "level_zero/core/test/unit_tests/mocks/mock_driver.h" +#include "level_zero/include/zet_intel_gpu_metric.h" #include "level_zero/tools/source/metrics/metric_oa_source.h" #include "level_zero/tools/test/unit_tests/sources/metrics/mock_metric_oa.h" diff --git a/level_zero/tools/test/unit_tests/sources/metrics/test_metric_oa_export.cpp b/level_zero/tools/test/unit_tests/sources/metrics/test_metric_oa_export.cpp index cc7a190584..0749304a7a 100644 --- a/level_zero/tools/test/unit_tests/sources/metrics/test_metric_oa_export.cpp +++ b/level_zero/tools/test/unit_tests/sources/metrics/test_metric_oa_export.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2023 Intel Corporation + * Copyright (C) 2023-2024 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -9,7 +9,7 @@ #include "level_zero/core/source/device/device_imp.h" #include "level_zero/core/test/unit_tests/mocks/mock_driver.h" -#include "level_zero/include/zet_intel_gpu_metric.h" +#include "level_zero/include/zet_intel_gpu_metric_export.h" #include "level_zero/tools/source/metrics/metric_oa_source.h" #include "level_zero/tools/test/unit_tests/sources/metrics/mock_metric_oa.h"