mirror of
https://github.com/intel/compute-runtime.git
synced 2026-01-06 19:32:25 +08:00
feature: support metrics calculable property
Resolves: NEO-13994 Signed-off-by: Matias Cabral <matias.a.cabral@intel.com>
This commit is contained in:
committed by
Compute-Runtime-Automation
parent
91f25ef990
commit
0bb8591e79
@@ -47,6 +47,7 @@ using zes_structure_type_ext_t = uint32_t;
|
||||
#define ZET_INTEL_STRUCTURE_TYPE_METRIC_CALCULATION_DESC_EXP static_cast<zet_structure_type_ext_t>(0x00010009)
|
||||
#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)
|
||||
#define ZET_INTEL_STRUCTURE_TYPE_METRIC_CALCULABLE_PROPERTIES_EXP static_cast<zet_structure_type_ext_t>(0x0001000c)
|
||||
|
||||
// Sysman structure types
|
||||
#define ZES_INTEL_PCI_LINK_SPEED_DOWNGRADE_EXP_STATE static_cast<zes_structure_type_ext_t>(0x00040001)
|
||||
|
||||
@@ -243,12 +243,13 @@ ze_result_t ZE_APICALL zetIntelMetricScopeGetPropertiesExp(
|
||||
/// @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_1_1 = ZE_MAKE_VERSION(1, 1), ///< version 1.1
|
||||
ZET_INTEL_METRIC_CALCULATION_EXP_VERSION_CURRENT = ZET_INTEL_METRIC_CALCULATION_EXP_VERSION_1_1, ///< latest known version
|
||||
ZET_INTEL_METRIC_CALCULATION_EXP_VERSION_FORCE_UINT32 = 0x7fffffff
|
||||
} zet_intel_metric_calculation_exp_version_t;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief Query an metric group calculation properties
|
||||
/// @brief Query metric group calculation properties
|
||||
/// This structure can be passed in the 'pNext' of zet_metric_group_properties_t
|
||||
typedef struct _zet_intel_metric_group_calculation_properties_exp_t {
|
||||
zet_structure_type_ext_t stype; ///< [in] type of this structure
|
||||
@@ -258,6 +259,16 @@ typedef struct _zet_intel_metric_group_calculation_properties_exp_t {
|
||||
///< metrics calculation.
|
||||
} zet_intel_metric_group_calculation_properties_exp_t;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief Query a metric calculable property
|
||||
/// This structure can be passed in the 'pNext' of zet_metric_properties_t
|
||||
typedef struct _zet_intel_metric_calculable_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 isCalculable; ///< [out] Flag to indicate if the metric supports calculation.
|
||||
} zet_intel_metric_calculable_properties_exp_t;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief Handle of metric calculation operation
|
||||
struct _zet_intel_metric_calculation_operation_exp_handle_t {};
|
||||
|
||||
@@ -669,7 +669,19 @@ IpSamplingMetricImp::IpSamplingMetricImp(MetricSource &metricSource, zet_metric_
|
||||
}
|
||||
|
||||
ze_result_t IpSamplingMetricImp::getProperties(zet_metric_properties_t *pProperties) {
|
||||
auto pNext = pProperties->pNext;
|
||||
*pProperties = properties;
|
||||
|
||||
while (pNext != nullptr) {
|
||||
auto extendedProperties = reinterpret_cast<zet_base_properties_t *>(pNext);
|
||||
if (static_cast<uint32_t>(extendedProperties->stype) == ZET_INTEL_STRUCTURE_TYPE_METRIC_CALCULABLE_PROPERTIES_EXP) {
|
||||
auto calculableProperties = reinterpret_cast<zet_intel_metric_calculable_properties_exp_t *>(extendedProperties);
|
||||
// All metrics are calculable in IP Sampling
|
||||
calculableProperties->isCalculable = true;
|
||||
}
|
||||
pNext = extendedProperties->pNext;
|
||||
}
|
||||
|
||||
return ZE_RESULT_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
@@ -245,6 +245,42 @@ HWTEST2_F(MetricIpSamplingEnumerationTest, GivenDependenciesAvailableWhenMetricG
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
HWTEST2_F(MetricIpSamplingEnumerationTest, GivenIpSamplingMetricsCalculablePropertyIsAlwaysTrue, EustallSupportedPlatforms) {
|
||||
|
||||
EXPECT_EQ(ZE_RESULT_SUCCESS, testDevices[0]->getMetricDeviceContext().enableMetricApi());
|
||||
for (auto device : testDevices) {
|
||||
|
||||
uint32_t metricGroupCount = 0;
|
||||
zetMetricGroupGet(device->toHandle(), &metricGroupCount, nullptr);
|
||||
EXPECT_EQ(metricGroupCount, 1u);
|
||||
std::vector<zet_metric_group_handle_t> metricGroups(metricGroupCount);
|
||||
zetMetricGroupGet(device->toHandle(), &metricGroupCount, metricGroups.data());
|
||||
ASSERT_NE(metricGroups[0], nullptr);
|
||||
|
||||
uint32_t metricCount = 0;
|
||||
EXPECT_EQ(zetMetricGet(metricGroups[0], &metricCount, nullptr), ZE_RESULT_SUCCESS);
|
||||
std::vector<zet_metric_handle_t> metricHandles(metricCount);
|
||||
EXPECT_EQ(zetMetricGet(metricGroups[0], &metricCount, metricHandles.data()), ZE_RESULT_SUCCESS);
|
||||
|
||||
zet_metric_properties_t ipSamplingMetricProperties = {};
|
||||
zet_intel_metric_calculable_properties_exp_t calculableProperties{};
|
||||
calculableProperties.stype = ZET_INTEL_STRUCTURE_TYPE_METRIC_CALCULABLE_PROPERTIES_EXP;
|
||||
calculableProperties.pNext = nullptr;
|
||||
ipSamplingMetricProperties.pNext = &calculableProperties;
|
||||
|
||||
for (auto &metricHandle : metricHandles) {
|
||||
EXPECT_EQ(zetMetricGetProperties(metricHandle, &ipSamplingMetricProperties), ZE_RESULT_SUCCESS);
|
||||
EXPECT_TRUE(calculableProperties.isCalculable);
|
||||
}
|
||||
|
||||
// Check that invalid structure is handled gracefully
|
||||
zet_metric_group_properties_t metricGroupProperties = {ZET_STRUCTURE_TYPE_METRIC_GROUP_PROPERTIES, nullptr};
|
||||
ipSamplingMetricProperties.pNext = &metricGroupProperties;
|
||||
EXPECT_EQ(zetMetricGetProperties(metricHandles[0], &ipSamplingMetricProperties), ZE_RESULT_SUCCESS);
|
||||
}
|
||||
}
|
||||
|
||||
using IsNotGen9ThruPVC = IsNotWithinProducts<IGFX_SKYLAKE, IGFX_PVC>;
|
||||
HWTEST2_F(MetricIpSamplingEnumerationTest, GivenEnableMetricAPIOnUnsupportedPlatformsThenFailureIsReturned, IsNotGen9ThruPVC) {
|
||||
EXPECT_EQ(ZE_RESULT_SUCCESS, testDevices[0]->getMetricDeviceContext().enableMetricApi());
|
||||
|
||||
Reference in New Issue
Block a user