mirror of
https://github.com/intel/compute-runtime.git
synced 2026-01-09 22:43:00 +08:00
refactor: change type of stype member in L0 tools driver extensions
use uint32_t-alias type to avoid casting out of zet_structure_type_t enum range Related-To: NEO-12901 Signed-off-by: Mateusz Jablonski <mateusz.jablonski@intel.com>
This commit is contained in:
committed by
Compute-Runtime-Automation
parent
d28fcdb55b
commit
ef4ed582fa
@@ -13,6 +13,7 @@
|
|||||||
|
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
using ze_structure_type_ext_t = uint32_t;
|
using ze_structure_type_ext_t = uint32_t;
|
||||||
|
using zet_structure_type_ext_t = uint32_t;
|
||||||
|
|
||||||
#define ZE_STRUCTURE_TYPE_SYNCHRONIZED_DISPATCH_EXP_DESC static_cast<ze_structure_type_ext_t>(0x00020020)
|
#define ZE_STRUCTURE_TYPE_SYNCHRONIZED_DISPATCH_EXP_DESC static_cast<ze_structure_type_ext_t>(0x00020020)
|
||||||
#define ZE_STRUCTURE_TYPE_INTEL_MEDIA_COMMUNICATION_DESC static_cast<ze_structure_type_ext_t>(0x00020021)
|
#define ZE_STRUCTURE_TYPE_INTEL_MEDIA_COMMUNICATION_DESC static_cast<ze_structure_type_ext_t>(0x00020021)
|
||||||
@@ -32,8 +33,9 @@ using ze_structure_type_ext_t = uint32_t;
|
|||||||
#define ZEX_STRUCTURE_COUNTER_BASED_EVENT_EXTERNAL_STORAGE_ALLOC_PROPERTIES static_cast<ze_structure_type_ext_t>(0x00030027)
|
#define ZEX_STRUCTURE_COUNTER_BASED_EVENT_EXTERNAL_STORAGE_ALLOC_PROPERTIES static_cast<ze_structure_type_ext_t>(0x00030027)
|
||||||
|
|
||||||
// Metric structure types
|
// Metric structure types
|
||||||
#define ZET_INTEL_STRUCTURE_TYPE_METRIC_SOURCE_ID_EXP (zet_structure_type_t)0x0001000a // NOLINT(clang-analyzer-optin.core.EnumCastOutOfRange), NEO-12901
|
#define ZET_INTEL_STRUCTURE_TYPE_METRIC_GROUP_CALCULATE_EXP_PROPERTIES static_cast<zet_structure_type_ext_t>(0x00010008)
|
||||||
#define ZET_INTEL_STRUCTURE_TYPE_METRIC_CALCULATE_DESC_EXP (zet_structure_type_t)0x00010009 // NOLINT(clang-analyzer-optin.core.EnumCastOutOfRange), NEO-12901
|
#define ZET_INTEL_STRUCTURE_TYPE_METRIC_CALCULATE_DESC_EXP static_cast<zet_structure_type_ext_t>(0x00010009)
|
||||||
#define ZET_INTEL_STRUCTURE_TYPE_METRIC_GROUP_CALCULATE_EXP_PROPERTIES (zet_structure_type_t)0x00010008 // NOLINT(clang-analyzer-optin.core.EnumCastOutOfRange), NEO-12901
|
#define ZET_INTEL_STRUCTURE_TYPE_METRIC_SOURCE_ID_EXP static_cast<zet_structure_type_ext_t>(0x0001000a)
|
||||||
|
#define ZET_INTEL_STRUCTURE_TYPE_METRIC_DECODED_BUFFER_PROPERTIES_EXP static_cast<zet_structure_type_ext_t>(0x0001000b)
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -40,10 +40,10 @@ typedef enum _zet_intel_metric_source_id_exp_version_t {
|
|||||||
/// @brief Query an unique identifier representing the source of a metric group
|
/// @brief Query an unique identifier representing the source of a metric group
|
||||||
/// This structure can be passed in the 'pNext' of zet_metric_group_properties_t
|
/// This structure can be passed in the 'pNext' of zet_metric_group_properties_t
|
||||||
typedef struct _zet_intel_metric_source_id_exp_t {
|
typedef struct _zet_intel_metric_source_id_exp_t {
|
||||||
zet_structure_type_t stype; ///< [in] type of this structure
|
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
|
const void *pNext; ///< [in][optional] must be null or a pointer to an extension-specific
|
||||||
///< structure (i.e. contains stype and pNext).
|
///< structure (i.e. contains stype and pNext).
|
||||||
uint32_t sourceId; ///< [out] Returns an unique source Id of the metric group
|
uint32_t sourceId; ///< [out] Returns an unique source Id of the metric group
|
||||||
} zet_intel_metric_source_id_exp_t;
|
} zet_intel_metric_source_id_exp_t;
|
||||||
|
|
||||||
#ifndef ZET_INTEL_METRIC_APPEND_MARKER_EXP_NAME
|
#ifndef ZET_INTEL_METRIC_APPEND_MARKER_EXP_NAME
|
||||||
@@ -207,11 +207,11 @@ typedef enum _zet_intel_metric_calculate_exp_version_t {
|
|||||||
/// @brief Query an metric group calculate properties
|
/// @brief Query an metric group calculate properties
|
||||||
/// This structure can be passed in the 'pNext' of zet_metric_group_properties_t
|
/// 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_calculate_properties_exp_t {
|
||||||
zet_structure_type_t stype; ///< [in] type of this structure
|
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
|
void *pNext; ///< [in][optional] must be null or a pointer to an extension-specific
|
||||||
///< structure (i.e. contains stype and pNext).
|
///< structure (i.e. contains stype and pNext).
|
||||||
bool isTimeFilterSupported; ///< [out] Flag to indicate if the metric group supports time filtering for
|
bool isTimeFilterSupported; ///< [out] Flag to indicate if the metric group supports time filtering for
|
||||||
///< metrics calculation.
|
///< metrics calculation.
|
||||||
} zet_intel_metric_group_calculate_properties_exp_t;
|
} zet_intel_metric_group_calculate_properties_exp_t;
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
@@ -227,7 +227,7 @@ typedef struct _zet_intel_metric_calculate_time_window_exp_t {
|
|||||||
} zet_intel_metric_calculate_time_window_exp_t;
|
} zet_intel_metric_calculate_time_window_exp_t;
|
||||||
|
|
||||||
typedef struct _zet_intel_metric_calculate_exp_desc_t {
|
typedef struct _zet_intel_metric_calculate_exp_desc_t {
|
||||||
zet_structure_type_t stype; ///< [in] type of this structure
|
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
|
const void *pNext; ///< [in][optional] must be null or a pointer to an extension-specific
|
||||||
///< structure (i.e. contains stype and pNext).
|
///< structure (i.e. contains stype and pNext).
|
||||||
uint32_t metricGroupCount; ///< [in] [in] count for metric group handles in metric hMetricGroups array.
|
uint32_t metricGroupCount; ///< [in] [in] count for metric group handles in metric hMetricGroups array.
|
||||||
@@ -268,11 +268,11 @@ typedef struct _zet_intel_metric_result_exp_t {
|
|||||||
zet_intel_metric_calculate_result_status_exp_t resultStatus; ///< [out] type of the result for the filters applied to the calculation.
|
zet_intel_metric_calculate_result_status_exp_t resultStatus; ///< [out] type of the result for the filters applied to the calculation.
|
||||||
} zet_intel_metric_result_exp_t;
|
} zet_intel_metric_result_exp_t;
|
||||||
typedef struct _zet_intel_metric_decoded_buffer_exp_properties_t {
|
typedef struct _zet_intel_metric_decoded_buffer_exp_properties_t {
|
||||||
zet_structure_type_t stype; ///< [in] type of this structure
|
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
|
void *pNext; ///< [in][optional] must be null or a pointer to an extension-specific
|
||||||
///< structure (i.e. contains stype and pNext).
|
///< structure (i.e. contains stype and pNext).
|
||||||
uint64_t minTimeStamp; ///< [out] minimum timestamp contained in the raw data buffer
|
uint64_t minTimeStamp; ///< [out] minimum timestamp contained in the raw data buffer
|
||||||
uint64_t maxTimeStamp; ///< [out] maximum timestamp contained in the raw data buffer
|
uint64_t maxTimeStamp; ///< [out] maximum timestamp contained in the raw data buffer
|
||||||
} zet_intel_metric_decoded_buffer_exp_properties_t;
|
} zet_intel_metric_decoded_buffer_exp_properties_t;
|
||||||
|
|
||||||
ze_result_t ZE_APICALL
|
ze_result_t ZE_APICALL
|
||||||
|
|||||||
@@ -217,7 +217,7 @@ ze_result_t IpSamplingMetricSourceImp::handleMetricGroupExtendedProperties(zet_m
|
|||||||
while (pNext) {
|
while (pNext) {
|
||||||
auto extendedProperties = reinterpret_cast<zet_base_properties_t *>(pNext);
|
auto extendedProperties = reinterpret_cast<zet_base_properties_t *>(pNext);
|
||||||
|
|
||||||
if (extendedProperties->stype == ZET_INTEL_STRUCTURE_TYPE_METRIC_SOURCE_ID_EXP) {
|
if (static_cast<uint32_t>(extendedProperties->stype) == ZET_INTEL_STRUCTURE_TYPE_METRIC_SOURCE_ID_EXP) {
|
||||||
|
|
||||||
getMetricGroupSourceIdProperty(extendedProperties);
|
getMetricGroupSourceIdProperty(extendedProperties);
|
||||||
retVal = ZE_RESULT_SUCCESS;
|
retVal = ZE_RESULT_SUCCESS;
|
||||||
@@ -233,7 +233,7 @@ ze_result_t IpSamplingMetricSourceImp::handleMetricGroupExtendedProperties(zet_m
|
|||||||
zet_metric_group_type_exp_t *groupType = reinterpret_cast<zet_metric_group_type_exp_t *>(extendedProperties);
|
zet_metric_group_type_exp_t *groupType = reinterpret_cast<zet_metric_group_type_exp_t *>(extendedProperties);
|
||||||
groupType->type = ZET_METRIC_GROUP_TYPE_EXP_FLAG_OTHER;
|
groupType->type = ZET_METRIC_GROUP_TYPE_EXP_FLAG_OTHER;
|
||||||
retVal = ZE_RESULT_SUCCESS;
|
retVal = ZE_RESULT_SUCCESS;
|
||||||
} else if (extendedProperties->stype == ZET_INTEL_STRUCTURE_TYPE_METRIC_GROUP_CALCULATE_EXP_PROPERTIES) {
|
} else if (static_cast<uint32_t>(extendedProperties->stype) == ZET_INTEL_STRUCTURE_TYPE_METRIC_GROUP_CALCULATE_EXP_PROPERTIES) {
|
||||||
auto calcProperties = reinterpret_cast<zet_intel_metric_group_calculate_properties_exp_t *>(extendedProperties);
|
auto calcProperties = reinterpret_cast<zet_intel_metric_group_calculate_properties_exp_t *>(extendedProperties);
|
||||||
calcProperties->isTimeFilterSupported = false;
|
calcProperties->isTimeFilterSupported = false;
|
||||||
retVal = ZE_RESULT_SUCCESS;
|
retVal = ZE_RESULT_SUCCESS;
|
||||||
|
|||||||
@@ -189,7 +189,7 @@ ze_result_t OaMetricSourceImp::handleMetricGroupExtendedProperties(zet_metric_gr
|
|||||||
while (pNext) {
|
while (pNext) {
|
||||||
auto extendedProperties = reinterpret_cast<zet_base_properties_t *>(pNext);
|
auto extendedProperties = reinterpret_cast<zet_base_properties_t *>(pNext);
|
||||||
|
|
||||||
if (extendedProperties->stype == ZET_INTEL_STRUCTURE_TYPE_METRIC_SOURCE_ID_EXP) {
|
if (static_cast<uint32_t>(extendedProperties->stype) == ZET_INTEL_STRUCTURE_TYPE_METRIC_SOURCE_ID_EXP) {
|
||||||
|
|
||||||
getMetricGroupSourceIdProperty(extendedProperties);
|
getMetricGroupSourceIdProperty(extendedProperties);
|
||||||
retVal = ZE_RESULT_SUCCESS;
|
retVal = ZE_RESULT_SUCCESS;
|
||||||
@@ -211,7 +211,7 @@ ze_result_t OaMetricSourceImp::handleMetricGroupExtendedProperties(zet_metric_gr
|
|||||||
zet_metric_group_type_exp_t *groupType = reinterpret_cast<zet_metric_group_type_exp_t *>(extendedProperties);
|
zet_metric_group_type_exp_t *groupType = reinterpret_cast<zet_metric_group_type_exp_t *>(extendedProperties);
|
||||||
groupType->type = ZET_METRIC_GROUP_TYPE_EXP_FLAG_OTHER;
|
groupType->type = ZET_METRIC_GROUP_TYPE_EXP_FLAG_OTHER;
|
||||||
retVal = ZE_RESULT_SUCCESS;
|
retVal = ZE_RESULT_SUCCESS;
|
||||||
} else if (extendedProperties->stype == ZET_INTEL_STRUCTURE_TYPE_METRIC_GROUP_CALCULATE_EXP_PROPERTIES) {
|
} else if (static_cast<uint32_t>(extendedProperties->stype) == ZET_INTEL_STRUCTURE_TYPE_METRIC_GROUP_CALCULATE_EXP_PROPERTIES) {
|
||||||
auto calcProperties = reinterpret_cast<zet_intel_metric_group_calculate_properties_exp_t *>(extendedProperties);
|
auto calcProperties = reinterpret_cast<zet_intel_metric_group_calculate_properties_exp_t *>(extendedProperties);
|
||||||
if (pBaseProperties->samplingType == ZET_METRIC_GROUP_SAMPLING_TYPE_FLAG_TIME_BASED) {
|
if (pBaseProperties->samplingType == ZET_METRIC_GROUP_SAMPLING_TYPE_FLAG_TIME_BASED) {
|
||||||
calcProperties->isTimeFilterSupported = true;
|
calcProperties->isTimeFilterSupported = true;
|
||||||
|
|||||||
@@ -395,7 +395,7 @@ HWTEST2_F(MetricIpSamplingEnumerationTest, GivenEnumerationIsSuccessfulWhenQuery
|
|||||||
ASSERT_NE(metricGroups[0], nullptr);
|
ASSERT_NE(metricGroups[0], nullptr);
|
||||||
|
|
||||||
zet_metric_group_type_exp_t metricGroupType{};
|
zet_metric_group_type_exp_t metricGroupType{};
|
||||||
metricGroupType.stype = static_cast<zet_structure_type_t>(ZET_INTEL_STRUCTURE_TYPE_METRIC_SOURCE_ID_EXP + 1); // NOLINT(clang-analyzer-optin.core.EnumCastOutOfRange), NEO-12901
|
metricGroupType.stype = ZET_STRUCTURE_TYPE_METRIC_GROUP_PROPERTIES;
|
||||||
metricGroupType.pNext = nullptr;
|
metricGroupType.pNext = nullptr;
|
||||||
metricGroupType.type = ZET_METRIC_GROUP_TYPE_EXP_FLAG_FORCE_UINT32;
|
metricGroupType.type = ZET_METRIC_GROUP_TYPE_EXP_FLAG_FORCE_UINT32;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user