mirror of
https://github.com/intel/compute-runtime.git
synced 2025-12-30 01:35:20 +08:00
refactor: update final param in calculate API
Resolves: NEO-16569 Signed-off-by: Matias Cabral <matias.a.cabral@intel.com>
This commit is contained in:
committed by
Compute-Runtime-Automation
parent
45bbb7d6c4
commit
9cd5da1a87
@@ -754,8 +754,8 @@ ze_result_t MultiDeviceMetricImp::getProperties(zet_metric_properties_t *pProper
|
||||
return subDeviceMetrics[0]->getProperties(pProperties);
|
||||
}
|
||||
|
||||
MultiDeviceMetricImp *MultiDeviceMetricImp::create(MetricSource &metricSource, std::vector<MetricImp *> &subDeviceMetrics) {
|
||||
return new (std::nothrow) MultiDeviceMetricImp(metricSource, subDeviceMetrics);
|
||||
MultiDeviceMetricImp *MultiDeviceMetricImp::create(MetricSource &metricSource, std::vector<MetricImp *> &subDeviceMetrics, std::vector<MetricScopeImp *> &metricScopes) {
|
||||
return new (std::nothrow) MultiDeviceMetricImp(metricSource, subDeviceMetrics, metricScopes);
|
||||
}
|
||||
|
||||
MetricImp *MultiDeviceMetricImp::getMetricAtSubDeviceIndex(uint32_t index) {
|
||||
@@ -767,13 +767,13 @@ MetricImp *MultiDeviceMetricImp::getMetricAtSubDeviceIndex(uint32_t index) {
|
||||
|
||||
ze_result_t MetricImp::getScopes(uint32_t *pCount, zet_intel_metric_scope_exp_handle_t *phScopes) {
|
||||
if (*pCount == 0) {
|
||||
*pCount = static_cast<uint32_t>(scopes.size());
|
||||
*pCount = static_cast<uint32_t>(metricScopes.size());
|
||||
return ZE_RESULT_SUCCESS;
|
||||
}
|
||||
|
||||
*pCount = std::min(*pCount, static_cast<uint32_t>(scopes.size()));
|
||||
*pCount = std::min(*pCount, static_cast<uint32_t>(metricScopes.size()));
|
||||
for (uint32_t i = 0; i < *pCount; i++) {
|
||||
phScopes[i] = scopes[i];
|
||||
phScopes[i] = metricScopes[i]->toHandle();
|
||||
}
|
||||
return ZE_RESULT_SUCCESS;
|
||||
}
|
||||
@@ -1007,7 +1007,8 @@ ze_result_t HomogeneousMultiDeviceMetricProgrammable::createMetric(zet_metric_pr
|
||||
for (auto &metricHandlesPerSubdevice : metricHandlesPerSubDeviceList) {
|
||||
homogenousMetricList.push_back(static_cast<MetricImp *>(Metric::fromHandle(metricHandlesPerSubdevice[index])));
|
||||
}
|
||||
phMetricHandles[index] = HomogeneousMultiDeviceMetricCreated::create(metricSource, homogenousMetricList)->toHandle();
|
||||
std::vector<MetricScopeImp *> metricScopes{};
|
||||
phMetricHandles[index] = HomogeneousMultiDeviceMetricCreated::create(metricSource, homogenousMetricList, metricScopes)->toHandle();
|
||||
}
|
||||
|
||||
*pMetricHandleCount = static_cast<uint32_t>(metricHandlesPerSubDeviceList[0].size());
|
||||
@@ -1033,8 +1034,8 @@ ze_result_t HomogeneousMultiDeviceMetricCreated::destroy() {
|
||||
return status;
|
||||
}
|
||||
|
||||
MetricImp *HomogeneousMultiDeviceMetricCreated::create(MetricSource &metricSource, std::vector<MetricImp *> &subDeviceMetrics) {
|
||||
return new (std::nothrow) HomogeneousMultiDeviceMetricCreated(metricSource, subDeviceMetrics);
|
||||
MetricImp *HomogeneousMultiDeviceMetricCreated::create(MetricSource &metricSource, std::vector<MetricImp *> &subDeviceMetrics, std::vector<MetricScopeImp *> &metricScopes) {
|
||||
return new (std::nothrow) HomogeneousMultiDeviceMetricCreated(metricSource, subDeviceMetrics, metricScopes);
|
||||
}
|
||||
|
||||
ze_result_t MetricCalcOpImp::getMetricsFromCalcOp(uint32_t *pCount, zet_metric_handle_t *phMetrics, bool isExcludedMetrics, zet_intel_metric_scope_exp_handle_t *phMetricScopes) {
|
||||
|
||||
@@ -245,7 +245,7 @@ struct MetricImp : public Metric {
|
||||
return metricSource;
|
||||
}
|
||||
~MetricImp() override = default;
|
||||
MetricImp(MetricSource &metricSource) : metricSource(metricSource) {}
|
||||
MetricImp(MetricSource &metricSource, std::vector<MetricScopeImp *> &metricScopes) : metricSource(metricSource), metricScopes(metricScopes) {}
|
||||
bool isImmutable() { return isPredefined; }
|
||||
bool isRootDevice() { return isMultiDevice; }
|
||||
|
||||
@@ -259,7 +259,7 @@ struct MetricImp : public Metric {
|
||||
bool isPredefined = true;
|
||||
bool isMultiDevice = false;
|
||||
MultiDeviceMetricImp *rootDeviceMetricImp = nullptr;
|
||||
std::vector<zet_intel_metric_scope_exp_handle_t> scopes = {};
|
||||
std::vector<MetricScopeImp *> metricScopes = {};
|
||||
|
||||
public:
|
||||
ze_result_t getScopes(uint32_t *pCount, zet_intel_metric_scope_exp_handle_t *phScopes);
|
||||
@@ -267,7 +267,8 @@ struct MetricImp : public Metric {
|
||||
|
||||
struct MultiDeviceMetricImp : public MetricImp {
|
||||
~MultiDeviceMetricImp() override = default;
|
||||
MultiDeviceMetricImp(MetricSource &metricSource, std::vector<MetricImp *> &subDeviceMetrics) : MetricImp(metricSource), subDeviceMetrics(subDeviceMetrics) {
|
||||
MultiDeviceMetricImp(MetricSource &metricSource, std::vector<MetricImp *> &subDeviceMetrics, std::vector<MetricScopeImp *> &metricScopes)
|
||||
: MetricImp(metricSource, metricScopes), subDeviceMetrics(subDeviceMetrics) {
|
||||
isPredefined = true;
|
||||
isMultiDevice = true;
|
||||
rootDeviceMetricImp = nullptr;
|
||||
@@ -279,7 +280,7 @@ struct MultiDeviceMetricImp : public MetricImp {
|
||||
|
||||
ze_result_t destroy() override { return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; }
|
||||
ze_result_t getProperties(zet_metric_properties_t *pProperties) override;
|
||||
static MultiDeviceMetricImp *create(MetricSource &metricSource, std::vector<MetricImp *> &subDeviceMetrics);
|
||||
static MultiDeviceMetricImp *create(MetricSource &metricSource, std::vector<MetricImp *> &subDeviceMetrics, std::vector<MetricScopeImp *> &metricScopes);
|
||||
MetricImp *getMetricAtSubDeviceIndex(uint32_t index);
|
||||
|
||||
protected:
|
||||
@@ -460,12 +461,13 @@ struct HomogeneousMultiDeviceMetricProgrammable : public MetricProgrammable {
|
||||
|
||||
struct HomogeneousMultiDeviceMetricCreated : public MultiDeviceMetricImp {
|
||||
~HomogeneousMultiDeviceMetricCreated() override {}
|
||||
HomogeneousMultiDeviceMetricCreated(MetricSource &metricSource, std::vector<MetricImp *> &subDeviceMetrics) : MultiDeviceMetricImp(metricSource, subDeviceMetrics) {
|
||||
HomogeneousMultiDeviceMetricCreated(MetricSource &metricSource, std::vector<MetricImp *> &subDeviceMetrics, std::vector<MetricScopeImp *> &metricScopes)
|
||||
: MultiDeviceMetricImp(metricSource, subDeviceMetrics, metricScopes) {
|
||||
isPredefined = false;
|
||||
isMultiDevice = true;
|
||||
}
|
||||
ze_result_t destroy() override;
|
||||
static MetricImp *create(MetricSource &metricSource, std::vector<MetricImp *> &subDeviceMetrics);
|
||||
static MetricImp *create(MetricSource &metricSource, std::vector<MetricImp *> &subDeviceMetrics, std::vector<MetricScopeImp *> &metricScopes);
|
||||
};
|
||||
|
||||
struct MetricCalcOp : _zet_intel_metric_calculation_operation_exp_handle_t {
|
||||
@@ -525,7 +527,7 @@ struct MetricScopeImp : public MetricScope {
|
||||
private:
|
||||
zet_intel_metric_scope_properties_exp_t properties;
|
||||
bool aggregated = false;
|
||||
uint32_t computeSubDevIndex = 0; // valid for compute scopes when aggregated is false
|
||||
uint32_t computeSubDevIndex = 0; // valid for compute metricScopes when aggregated is false
|
||||
};
|
||||
struct MetricCalcOpImp : public MetricCalcOp {
|
||||
~MetricCalcOpImp() override = default;
|
||||
|
||||
@@ -113,7 +113,8 @@ ze_result_t IpSamplingMetricSourceImp::cacheMetricGroup() {
|
||||
strcpy_s(metricProperties.description, ZET_MAX_METRIC_DESCRIPTION, "IP address");
|
||||
metricProperties.metricType = ZET_METRIC_TYPE_IP;
|
||||
strcpy_s(metricProperties.resultUnits, ZET_MAX_METRIC_RESULT_UNITS, "Address");
|
||||
metrics.push_back(IpSamplingMetricImp(*this, metricProperties));
|
||||
std::vector<MetricScopeImp *> scopes{};
|
||||
metrics.push_back(IpSamplingMetricImp(*this, metricProperties, scopes));
|
||||
|
||||
std::vector<std::pair<const char *, const char *>> stallSamplingReportList = l0GfxCoreHelper.getStallSamplingReportMetrics();
|
||||
|
||||
@@ -124,7 +125,7 @@ ze_result_t IpSamplingMetricSourceImp::cacheMetricGroup() {
|
||||
for (auto &property : stallSamplingReportList) {
|
||||
strcpy_s(metricProperties.name, ZET_MAX_METRIC_NAME, property.first);
|
||||
strcpy_s(metricProperties.description, ZET_MAX_METRIC_DESCRIPTION, property.second);
|
||||
metrics.push_back(IpSamplingMetricImp(*this, metricProperties));
|
||||
metrics.push_back(IpSamplingMetricImp(*this, metricProperties, scopes));
|
||||
}
|
||||
|
||||
cachedMetricGroup = IpSamplingMetricGroupImp::create(*this, metrics);
|
||||
@@ -511,7 +512,8 @@ std::unique_ptr<MultiDeviceIpSamplingMetricGroupImp> MultiDeviceIpSamplingMetric
|
||||
return std::unique_ptr<MultiDeviceIpSamplingMetricGroupImp>(new (std::nothrow) MultiDeviceIpSamplingMetricGroupImp(metricSource, subDeviceMetricGroup));
|
||||
}
|
||||
|
||||
IpSamplingMetricImp::IpSamplingMetricImp(MetricSource &metricSource, zet_metric_properties_t &properties) : MetricImp(metricSource), properties(properties) {
|
||||
IpSamplingMetricImp::IpSamplingMetricImp(MetricSource &metricSource, zet_metric_properties_t &properties, std::vector<MetricScopeImp *> &scopes)
|
||||
: MetricImp(metricSource, scopes), properties(properties) {
|
||||
}
|
||||
|
||||
ze_result_t IpSamplingMetricImp::getProperties(zet_metric_properties_t *pProperties) {
|
||||
|
||||
@@ -173,7 +173,7 @@ struct MultiDeviceIpSamplingMetricGroupImp : public IpSamplingMetricGroupBase {
|
||||
|
||||
struct IpSamplingMetricImp : public MetricImp {
|
||||
~IpSamplingMetricImp() override = default;
|
||||
IpSamplingMetricImp(MetricSource &metricSource, zet_metric_properties_t &properties);
|
||||
IpSamplingMetricImp(MetricSource &metricSource, zet_metric_properties_t &properties, std::vector<MetricScopeImp *> &scopes);
|
||||
ze_result_t getProperties(zet_metric_properties_t *pProperties) override;
|
||||
ze_result_t destroy() override {
|
||||
return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE;
|
||||
|
||||
@@ -475,7 +475,7 @@ ze_result_t IpSamplingMetricCalcOpImp::metricCalculateValues(const size_t rawDat
|
||||
|
||||
status = updateCachesForMultiScopes(dataSize, rawDataStart, newData, dataOverflow);
|
||||
if (status != ZE_RESULT_SUCCESS) {
|
||||
// clearScopesCaches();
|
||||
clearScopesCaches();
|
||||
METRICS_LOG_ERR("%s", "Failed to update stall data map");
|
||||
return status;
|
||||
}
|
||||
|
||||
@@ -187,7 +187,8 @@ ze_result_t MultiDeviceCreatedMetricGroupManager::close() {
|
||||
subDeviceMetrics[subDeviceIndex] = static_cast<MetricImp *>(
|
||||
Metric::fromHandle(subDeviceMetricHandles[subDeviceIndex][index]));
|
||||
}
|
||||
arrangedMetricHandles[index] = MultiDeviceMetricImp::create(metricSource, subDeviceMetrics);
|
||||
std::vector<MetricScopeImp *> scopes{};
|
||||
arrangedMetricHandles[index] = MultiDeviceMetricImp::create(metricSource, subDeviceMetrics, scopes);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1230,7 +1230,8 @@ MetricGroup *OaMetricGroupImp::create(zet_metric_group_properties_t &properties,
|
||||
}
|
||||
|
||||
Metric *OaMetricImp::create(MetricSource &metricSource, zet_metric_properties_t &properties) {
|
||||
auto pMetric = new OaMetricImp(metricSource);
|
||||
std::vector<MetricScopeImp *> metricScopes{};
|
||||
auto pMetric = new OaMetricImp(metricSource, metricScopes);
|
||||
UNRECOVERABLE_IF(pMetric == nullptr);
|
||||
pMetric->initialize(properties);
|
||||
pMetric->isPredefined = true;
|
||||
|
||||
@@ -260,7 +260,7 @@ struct OaMetricGroupImp : public MetricGroupImp {
|
||||
struct OaMetricImp : public MetricImp {
|
||||
~OaMetricImp() override{};
|
||||
|
||||
OaMetricImp(MetricSource &metricSource) : MetricImp(metricSource) {}
|
||||
OaMetricImp(MetricSource &metricSource, std::vector<MetricScopeImp *> &metricScopes) : MetricImp(metricSource, metricScopes) {}
|
||||
|
||||
ze_result_t getProperties(zet_metric_properties_t *pProperties) override;
|
||||
|
||||
|
||||
@@ -280,7 +280,8 @@ Metric *OaMetricFromProgrammable::create(MetricSource &metricSource, zet_metric_
|
||||
MetricsDiscovery::IMetricPrototype_1_13 *pClonedPrototype,
|
||||
uint32_t domain,
|
||||
zet_metric_group_sampling_type_flags_t supportedSamplingTypes) {
|
||||
auto pMetric = new OaMetricFromProgrammable(metricSource);
|
||||
std::vector<MetricScopeImp *> scopes;
|
||||
auto pMetric = new OaMetricFromProgrammable(metricSource, scopes);
|
||||
UNRECOVERABLE_IF(pMetric == nullptr);
|
||||
pMetric->initialize(properties);
|
||||
pMetric->pClonedPrototype = pClonedPrototype;
|
||||
|
||||
@@ -48,7 +48,8 @@ struct OaMetricProgrammableImp : public MetricProgrammable {
|
||||
|
||||
struct OaMetricFromProgrammable : OaMetricImp, MetricCreated {
|
||||
~OaMetricFromProgrammable() override {}
|
||||
OaMetricFromProgrammable(MetricSource &metricSource) : OaMetricImp(metricSource) {}
|
||||
OaMetricFromProgrammable(MetricSource &metricSource, std::vector<MetricScopeImp *> &scopes)
|
||||
: OaMetricImp(metricSource, scopes) {}
|
||||
ze_result_t destroy() override;
|
||||
static Metric *create(MetricSource &metricSource, zet_metric_properties_t &properties,
|
||||
MetricsDiscovery::IMetricPrototype_1_13 *pClonedPrototype,
|
||||
|
||||
@@ -19,7 +19,8 @@ class MockMetric : public L0::MetricImp {
|
||||
public:
|
||||
ze_result_t destroyReturn = ZE_RESULT_ERROR_UNSUPPORTED_FEATURE;
|
||||
~MockMetric() override = default;
|
||||
MockMetric(MetricSource &metricSource) : L0::MetricImp(metricSource) {}
|
||||
MockMetric(MetricSource &metricSource, std::vector<MetricScopeImp *> &scopes)
|
||||
: L0::MetricImp(metricSource, scopes) {}
|
||||
ze_result_t getProperties(zet_metric_properties_t *pProperties) override {
|
||||
return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE;
|
||||
}
|
||||
@@ -62,6 +63,7 @@ class MockMetricCalcOp : public MetricCalcOpImp {
|
||||
return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE;
|
||||
};
|
||||
};
|
||||
|
||||
class MockMetricSource : public L0::MetricSource {
|
||||
public:
|
||||
~MockMetricSource() override = default;
|
||||
@@ -113,12 +115,12 @@ class MockMetricSource : public L0::MetricSource {
|
||||
// Only support metric groups, enough for ULT
|
||||
for (uint32_t i = 0; i < pCalculationDesc->metricGroupCount; i++) {
|
||||
MockMetricSource metricSource{};
|
||||
metrics.push_back(new MockMetric(metricSource));
|
||||
metrics.push_back(new MockMetric(metricSource, const_cast<std::vector<MetricScopeImp *> &>(metricScopes)));
|
||||
}
|
||||
|
||||
for (uint32_t i = 0; i < pCalculationDesc->metricCount; i++) {
|
||||
MockMetricSource metricSource{};
|
||||
metrics.push_back(new MockMetric(metricSource));
|
||||
metrics.push_back(new MockMetric(metricSource, const_cast<std::vector<MetricScopeImp *> &>(metricScopes)));
|
||||
}
|
||||
|
||||
// Map each metric scope to all metrics
|
||||
|
||||
@@ -21,13 +21,18 @@ namespace L0 {
|
||||
namespace ult {
|
||||
|
||||
TEST(MultidevMetric, GivenMultideviceMetricCreatedThenReferenceIsUpdatedSuccessfully) {
|
||||
MockMetricSource metricSource{};
|
||||
MockMetric mockMetric(metricSource);
|
||||
MockMetricSource mockMetricSource{};
|
||||
zet_intel_metric_scope_properties_exp_t scopeProperties{};
|
||||
scopeProperties.stype = ZET_STRUCTURE_TYPE_INTEL_METRIC_SCOPE_PROPERTIES_EXP;
|
||||
scopeProperties.pNext = nullptr;
|
||||
MockMetricScope mockMetricScope(scopeProperties, false, 0);
|
||||
std::vector<MetricScopeImp *> mockMetricScopes{&mockMetricScope};
|
||||
MockMetric mockMetric(mockMetricSource, mockMetricScopes);
|
||||
|
||||
std::vector<MetricImp *> subDeviceMetrics;
|
||||
subDeviceMetrics.push_back(&mockMetric);
|
||||
|
||||
MultiDeviceMetricImp *multiDevMetric = MultiDeviceMetricImp::create(metricSource, subDeviceMetrics);
|
||||
MultiDeviceMetricImp *multiDevMetric = MultiDeviceMetricImp::create(mockMetricSource, subDeviceMetrics, mockMetricScopes);
|
||||
EXPECT_EQ(ZE_RESULT_ERROR_UNSUPPORTED_FEATURE, multiDevMetric->destroy());
|
||||
|
||||
zet_metric_properties_t properties;
|
||||
@@ -56,6 +61,7 @@ class CalcOperationFixture : public DeviceFixture,
|
||||
|
||||
MockMetricScope *mockMetricScope;
|
||||
zet_intel_metric_scope_exp_handle_t hMetricScope = nullptr;
|
||||
std::vector<MetricScopeImp *> mockMetricScopes{};
|
||||
|
||||
DebugManagerStateRestore restorer;
|
||||
};
|
||||
@@ -70,6 +76,7 @@ void CalcOperationFixture::SetUp() {
|
||||
scopeProperties.pNext = nullptr;
|
||||
|
||||
mockMetricScope = new MockMetricScope(scopeProperties, false, 0);
|
||||
mockMetricScopes.push_back(mockMetricScope);
|
||||
hMetricScope = mockMetricScope->toHandle();
|
||||
}
|
||||
|
||||
@@ -79,6 +86,7 @@ void CalcOperationFixture::TearDown() {
|
||||
delete mockMetricScope;
|
||||
hMetricGroup = nullptr;
|
||||
hMetricScope = nullptr;
|
||||
mockMetricScopes.clear();
|
||||
}
|
||||
|
||||
class MetricScopesMultiDeviceFixture : public MultiDeviceFixture,
|
||||
@@ -94,7 +102,6 @@ class MetricScopesMultiDeviceFixture : public MultiDeviceFixture,
|
||||
|
||||
MockMetricDeviceContext *mockSubDeviceContext = nullptr;
|
||||
MockMetricSource *mockSubMetricSource = nullptr;
|
||||
|
||||
DebugManagerStateRestore restorer;
|
||||
};
|
||||
|
||||
@@ -195,8 +202,8 @@ TEST_F(CalcOperationFixture, WhenCreatingCalcOpWithMixedSourcesThenErrorIsReturn
|
||||
&hCalculationOperation));
|
||||
|
||||
// metrics from different source
|
||||
MockMetric mockMetric(mockMetricSource);
|
||||
MockMetric mockMetric2(mockMetricSource2);
|
||||
MockMetric mockMetric(mockMetricSource, mockMetricScopes);
|
||||
MockMetric mockMetric2(mockMetricSource2, mockMetricScopes);
|
||||
std::vector<zet_metric_handle_t> metrics{mockMetric.toHandle(), mockMetric2.toHandle()};
|
||||
|
||||
calculationDesc.metricGroupCount = 1;
|
||||
@@ -240,7 +247,7 @@ TEST_F(CalcOperationFixture, WhenCreatingCalcOpWithMixedHierarchiesThenErrorIsRe
|
||||
device->toHandle(), &calculationDesc,
|
||||
&hCalculationOperation));
|
||||
|
||||
MockMetric mockMetric(mockMetricSource), mockMetric2(mockMetricSource);
|
||||
MockMetric mockMetric(mockMetricSource, mockMetricScopes), mockMetric2(mockMetricSource, mockMetricScopes);
|
||||
mockMetric2.setMultiDevice(true);
|
||||
|
||||
std::vector<zet_metric_handle_t> metrics{mockMetric.toHandle(), mockMetric2.toHandle()};
|
||||
@@ -256,20 +263,20 @@ TEST_F(CalcOperationFixture, WhenCreatingCalcOpWithMixedHierarchiesThenErrorIsRe
|
||||
|
||||
TEST_F(CalcOperationFixture, WhenCreatingCalcSubDeviceOnlyAcceptsOneScope) {
|
||||
|
||||
std::vector<zet_intel_metric_scope_exp_handle_t> metricScopes{hMetricScope, hMetricScope};
|
||||
std::vector<zet_intel_metric_scope_exp_handle_t> mockMetricScopes{hMetricScope, hMetricScope};
|
||||
|
||||
zet_intel_metric_calculation_exp_desc_t calculationDesc{
|
||||
ZET_INTEL_STRUCTURE_TYPE_METRIC_CALCULATION_DESC_EXP,
|
||||
nullptr, // pNext
|
||||
1, // metricGroupCount
|
||||
&hMetricGroup, // phMetricGroups
|
||||
0, // metricCount
|
||||
nullptr, // phMetrics
|
||||
0, // timeWindowsCount
|
||||
nullptr, // pCalculationTimeWindows
|
||||
1000, // timeAggregationWindow
|
||||
2, // metricScopesCount
|
||||
metricScopes.data(), // phMetricScopes
|
||||
nullptr, // pNext
|
||||
1, // metricGroupCount
|
||||
&hMetricGroup, // phMetricGroups
|
||||
0, // metricCount
|
||||
nullptr, // phMetrics
|
||||
0, // timeWindowsCount
|
||||
nullptr, // pCalculationTimeWindows
|
||||
1000, // timeAggregationWindow
|
||||
2, // metricScopesCount
|
||||
mockMetricScopes.data(), // phMetricScopes
|
||||
};
|
||||
|
||||
zet_intel_metric_calculation_operation_exp_handle_t hCalculationOperation;
|
||||
@@ -304,7 +311,7 @@ TEST_F(CalcOperationFixture, WhenCreatingCalcOpUseTheSourceFromMetricGroupOrMetr
|
||||
EXPECT_NE(nullptr, hCalculationOperation);
|
||||
EXPECT_EQ(ZE_RESULT_SUCCESS, zetIntelMetricCalculationOperationDestroyExp(hCalculationOperation));
|
||||
|
||||
MockMetric mockMetric(mockMetricSource), mockMetric2(mockMetricSource);
|
||||
MockMetric mockMetric(mockMetricSource, mockMetricScopes), mockMetric2(mockMetricSource, mockMetricScopes);
|
||||
std::vector<zet_metric_handle_t> metrics{mockMetric.toHandle(), mockMetric.toHandle()};
|
||||
|
||||
calculationDesc.metricGroupCount = 0;
|
||||
@@ -322,9 +329,9 @@ TEST_F(CalcOperationFixture, WhenCreatingCalcOpObjectToAndFromHandleBaseClassWor
|
||||
std::vector<MetricImp *> mockMetricsInReport{};
|
||||
std::vector<MetricImp *> mockExcludedMetrics{};
|
||||
|
||||
std::vector<MetricScopeImp *> metricScopes{mockMetricScope};
|
||||
std::vector<MetricScopeImp *> mockMetricScopes{mockMetricScope};
|
||||
|
||||
MockMetricCalcOp mockMetricCalcOp(false, metricScopes, mockMetricsInReport, mockExcludedMetrics);
|
||||
MockMetricCalcOp mockMetricCalcOp(false, mockMetricScopes, mockMetricsInReport, mockExcludedMetrics);
|
||||
auto hMockCalcOp = mockMetricCalcOp.toHandle();
|
||||
|
||||
EXPECT_EQ(false, mockMetricCalcOp.isRootDevice());
|
||||
@@ -334,16 +341,16 @@ TEST_F(CalcOperationFixture, WhenCreatingCalcOpObjectToAndFromHandleBaseClassWor
|
||||
|
||||
TEST_F(CalcOperationFixture, WhenGettingMetricsInReportAndExcludedMetricsThenTheyAreReturnedCorrectly) {
|
||||
std::vector<MetricImp *> mockMetricsInReport{};
|
||||
MockMetric mockMetricInReport(mockMetricSource);
|
||||
MockMetric mockMetricInReport(mockMetricSource, mockMetricScopes);
|
||||
mockMetricsInReport.push_back(&mockMetricInReport);
|
||||
|
||||
std::vector<MetricImp *> mockExcludedMetrics{};
|
||||
MockMetric mockExcludedMetric(mockMetricSource);
|
||||
MockMetric mockExcludedMetric(mockMetricSource, mockMetricScopes);
|
||||
mockExcludedMetrics.push_back(&mockExcludedMetric);
|
||||
|
||||
std::vector<MetricScopeImp *> metricScopes{mockMetricScope};
|
||||
std::vector<MetricScopeImp *> mockMetricScopes{mockMetricScope};
|
||||
|
||||
MockMetricCalcOp mockMetricCalcOp(false, metricScopes, mockMetricsInReport, mockExcludedMetrics);
|
||||
MockMetricCalcOp mockMetricCalcOp(false, mockMetricScopes, mockMetricsInReport, mockExcludedMetrics);
|
||||
uint32_t metricCount = 0;
|
||||
EXPECT_EQ(ZE_RESULT_SUCCESS, zetIntelMetricCalculationOperationGetReportFormatExp(mockMetricCalcOp.toHandle(), &metricCount, nullptr, nullptr));
|
||||
EXPECT_EQ(metricCount, 1U);
|
||||
@@ -493,18 +500,18 @@ HWTEST_F(MetricScopesMultiDeviceFixture, GivenRootDeviceThatDoesNOTSupportsMetri
|
||||
&metricScopesCount,
|
||||
nullptr));
|
||||
EXPECT_EQ(metricScopesCount, numSubDevices);
|
||||
std::vector<zet_intel_metric_scope_exp_handle_t> metricScopes(metricScopesCount);
|
||||
std::vector<zet_intel_metric_scope_exp_handle_t> mockMetricScopes(metricScopesCount);
|
||||
EXPECT_EQ(ZE_RESULT_SUCCESS, zetIntelMetricScopesGetExp(context->toHandle(),
|
||||
rootDevice->toHandle(),
|
||||
&metricScopesCount,
|
||||
metricScopes.data()));
|
||||
mockMetricScopes.data()));
|
||||
EXPECT_EQ(metricScopesCount, numSubDevices);
|
||||
zet_intel_metric_scope_properties_exp_t scopeProperties{};
|
||||
scopeProperties.stype = ZET_STRUCTURE_TYPE_INTEL_METRIC_SCOPE_PROPERTIES_EXP;
|
||||
scopeProperties.pNext = nullptr;
|
||||
|
||||
for (uint32_t i = 0; i < metricScopesCount; i++) {
|
||||
EXPECT_EQ(ZE_RESULT_SUCCESS, zetIntelMetricScopeGetPropertiesExp(metricScopes[i],
|
||||
EXPECT_EQ(ZE_RESULT_SUCCESS, zetIntelMetricScopeGetPropertiesExp(mockMetricScopes[i],
|
||||
&scopeProperties));
|
||||
EXPECT_EQ(scopeProperties.iD, i);
|
||||
// ID of compute scopes should be sub-dev ID
|
||||
@@ -536,17 +543,17 @@ HWTEST_F(MetricScopesMultiDeviceFixture, GivenRootDeviceThatSupportsMetricsAggre
|
||||
&metricScopesCount,
|
||||
nullptr));
|
||||
EXPECT_EQ(metricScopesCount, numRootDevices + numSubDevices);
|
||||
std::vector<zet_intel_metric_scope_exp_handle_t> metricScopes(metricScopesCount);
|
||||
std::vector<zet_intel_metric_scope_exp_handle_t> mockMetricScopes(metricScopesCount);
|
||||
EXPECT_EQ(ZE_RESULT_SUCCESS, zetIntelMetricScopesGetExp(context->toHandle(),
|
||||
rootDevice->toHandle(),
|
||||
&metricScopesCount,
|
||||
metricScopes.data()));
|
||||
mockMetricScopes.data()));
|
||||
EXPECT_EQ(metricScopesCount, numRootDevices + numSubDevices);
|
||||
zet_intel_metric_scope_properties_exp_t scopeProperties{};
|
||||
scopeProperties.stype = ZET_STRUCTURE_TYPE_INTEL_METRIC_SCOPE_PROPERTIES_EXP;
|
||||
scopeProperties.pNext = nullptr;
|
||||
|
||||
EXPECT_EQ(ZE_RESULT_SUCCESS, zetIntelMetricScopeGetPropertiesExp(metricScopes[0],
|
||||
EXPECT_EQ(ZE_RESULT_SUCCESS, zetIntelMetricScopeGetPropertiesExp(mockMetricScopes[0],
|
||||
&scopeProperties));
|
||||
|
||||
// Aggregated scope must be first with ID 0
|
||||
@@ -555,7 +562,7 @@ HWTEST_F(MetricScopesMultiDeviceFixture, GivenRootDeviceThatSupportsMetricsAggre
|
||||
EXPECT_STREQ(scopeProperties.description, aggregatedScopeDescription.data());
|
||||
|
||||
for (uint32_t i = 1; i < metricScopesCount; i++) {
|
||||
EXPECT_EQ(ZE_RESULT_SUCCESS, zetIntelMetricScopeGetPropertiesExp(metricScopes[i],
|
||||
EXPECT_EQ(ZE_RESULT_SUCCESS, zetIntelMetricScopeGetPropertiesExp(mockMetricScopes[i],
|
||||
&scopeProperties));
|
||||
EXPECT_EQ(scopeProperties.iD, i);
|
||||
// ID of compute scopes should be sub-dev ID+1 (since aggregated scope is 0)
|
||||
@@ -581,11 +588,11 @@ HWTEST_F(MetricScopesMultiDeviceFixture, GivenMetricsAggregationIsSupportedWhenC
|
||||
&metricScopesCount,
|
||||
nullptr));
|
||||
EXPECT_EQ(metricScopesCount, numRootDevices + numSubDevices);
|
||||
std::vector<zet_intel_metric_scope_exp_handle_t> metricScopes(metricScopesCount);
|
||||
std::vector<zet_intel_metric_scope_exp_handle_t> mockMetricScopes(metricScopesCount);
|
||||
EXPECT_EQ(ZE_RESULT_SUCCESS, zetIntelMetricScopesGetExp(context->toHandle(),
|
||||
rootDevice->toHandle(),
|
||||
&metricScopesCount,
|
||||
metricScopes.data()));
|
||||
mockMetricScopes.data()));
|
||||
|
||||
EXPECT_EQ(metricScopesCount, numRootDevices + numSubDevices);
|
||||
|
||||
@@ -594,21 +601,21 @@ HWTEST_F(MetricScopesMultiDeviceFixture, GivenMetricsAggregationIsSupportedWhenC
|
||||
zet_metric_group_handle_t hMetricGroup = mockMetricGroup.toHandle();
|
||||
|
||||
// send aggregated scope last
|
||||
std::swap(metricScopes[0], metricScopes[metricScopesCount - 1]);
|
||||
std::swap(mockMetricScopes[0], mockMetricScopes[metricScopesCount - 1]);
|
||||
|
||||
// Aggregation window is zero
|
||||
zet_intel_metric_calculation_exp_desc_t calculationDesc{
|
||||
ZET_INTEL_STRUCTURE_TYPE_METRIC_CALCULATION_DESC_EXP,
|
||||
nullptr, // pNext
|
||||
1, // metricGroupCount
|
||||
&hMetricGroup, // phMetricGroups
|
||||
0, // metricCount
|
||||
nullptr, // phMetrics
|
||||
0, // timeWindowsCount
|
||||
nullptr, // pCalculationTimeWindows
|
||||
100, // timeAggregationWindow
|
||||
metricScopesCount, // metricScopesCount
|
||||
metricScopes.data(), // phMetricScopes
|
||||
nullptr, // pNext
|
||||
1, // metricGroupCount
|
||||
&hMetricGroup, // phMetricGroups
|
||||
0, // metricCount
|
||||
nullptr, // phMetrics
|
||||
0, // timeWindowsCount
|
||||
nullptr, // pCalculationTimeWindows
|
||||
100, // timeAggregationWindow
|
||||
metricScopesCount, // metricScopesCount
|
||||
mockMetricScopes.data(), // phMetricScopes
|
||||
};
|
||||
|
||||
zet_intel_metric_calculation_operation_exp_handle_t hCalculationOperation;
|
||||
@@ -672,15 +679,21 @@ TEST_F(MetricScopesMultiDeviceFixture, WhenCalcOperationCreateIsCalledWithDuplic
|
||||
std::vector<zet_intel_metric_scope_exp_handle_t> metricScopes = {
|
||||
availableScopes[0], availableScopes[1], availableScopes[1], availableScopes[0]};
|
||||
|
||||
std::vector<MetricScopeImp *> metricScopeImps = {
|
||||
static_cast<MetricScopeImp *>(MetricScope::fromHandle(availableScopes[0])),
|
||||
static_cast<MetricScopeImp *>(MetricScope::fromHandle(availableScopes[1])),
|
||||
static_cast<MetricScopeImp *>(MetricScope::fromHandle(availableScopes[1])),
|
||||
static_cast<MetricScopeImp *>(MetricScope::fromHandle(availableScopes[0]))};
|
||||
|
||||
// Create mock metric group for root device
|
||||
MockMetricGroup mockMetricGroup(*mockRootMetricSource);
|
||||
mockMetricGroup.isMultiDevice = true;
|
||||
zet_metric_group_handle_t hMetricGroup = mockMetricGroup.toHandle();
|
||||
|
||||
// Create mock metrics
|
||||
MockMetric mockMetric1(*mockRootMetricSource);
|
||||
MockMetric mockMetric2(*mockRootMetricSource);
|
||||
MockMetric mockMetric3(*mockRootMetricSource);
|
||||
MockMetric mockMetric1(*mockRootMetricSource, metricScopeImps);
|
||||
MockMetric mockMetric2(*mockRootMetricSource, metricScopeImps);
|
||||
MockMetric mockMetric3(*mockRootMetricSource, metricScopeImps);
|
||||
mockMetric1.setMultiDevice(true);
|
||||
mockMetric2.setMultiDevice(true);
|
||||
mockMetric3.setMultiDevice(true);
|
||||
|
||||
@@ -578,8 +578,8 @@ class MockMetricImp : public MetricImp {
|
||||
public:
|
||||
using MetricImp::MetricImp;
|
||||
|
||||
void setScopes(const std::vector<zet_intel_metric_scope_exp_handle_t> &newScopes) {
|
||||
scopes = newScopes;
|
||||
void setScopes(const std::vector<MetricScopeImp *> &newScopes) {
|
||||
metricScopes = newScopes;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -599,9 +599,9 @@ TEST_F(MetricIpSamplingMetricSupportedScopeTest, givenMetricWhenGettingSupported
|
||||
scopeProperties.stype = ZET_STRUCTURE_TYPE_INTEL_METRIC_SCOPE_PROPERTIES_EXP;
|
||||
scopeProperties.pNext = nullptr;
|
||||
|
||||
std::vector<zet_intel_metric_scope_exp_handle_t> metricScopesHandles;
|
||||
std::vector<MetricScopeImp *> metricScopesHandles;
|
||||
MockMetricScope *mockMetricScope = new MockMetricScope(scopeProperties, false, 0);
|
||||
metricScopesHandles.push_back(mockMetricScope->toHandle());
|
||||
metricScopesHandles.push_back(mockMetricScope);
|
||||
|
||||
auto metricImp = static_cast<MockMetricImp *>(Metric::fromHandle(phMetric));
|
||||
metricImp->setScopes(metricScopesHandles);
|
||||
|
||||
@@ -489,141 +489,140 @@ HWTEST2_F(MetricIpSamplingCalcAggregationTest, GivenIpSamplingCalcOpOnRootDevice
|
||||
MockRawDataHelper::addMultiSubDevHeader(rawDataWithHeader.data() + rawReportsBytesSize + sizeof(IpSamplingMultiDevDataHeader),
|
||||
rawDataWithHeader.size() - (rawReportsBytesSize + sizeof(IpSamplingMultiDevDataHeader)),
|
||||
reinterpret_cast<uint8_t *>(rawReports2.data()), rawReports2BytesSize, 1);
|
||||
/*
|
||||
uint32_t totalMetricReportCount = 0;
|
||||
bool final = false;
|
||||
size_t usedSize = 0;
|
||||
uint32_t metricsInReportCount = 0;
|
||||
zet_metric_properties_t ipSamplingMetricProperties = {};
|
||||
std::vector<zet_metric_handle_t> metricsInReport = {};
|
||||
std::vector<zet_intel_metric_scope_exp_handle_t> metricScopesInReport = {};
|
||||
std::vector<zet_intel_metric_result_exp_t> metricResults = {};
|
||||
|
||||
for (auto &calcOp : hCalcOps) {
|
||||
metricsInReportCount = 0;
|
||||
EXPECT_EQ(ZE_RESULT_SUCCESS, zetIntelMetricCalculationOperationGetReportFormatExp(calcOp, &metricsInReportCount, nullptr, nullptr));
|
||||
// Expect 10 metrics per scope included in the calcOp
|
||||
if (calcOp == hCalcOpCompScope1 || calcOp == hCalcOpCompScope2 || calcOp == hCalcOpAggScope) {
|
||||
EXPECT_EQ(metricsInReportCount, 10u);
|
||||
uint32_t totalMetricReportCount = 0;
|
||||
bool final = false;
|
||||
size_t usedSize = 0;
|
||||
uint32_t metricsInReportCount = 0;
|
||||
zet_metric_properties_t ipSamplingMetricProperties = {};
|
||||
std::vector<zet_metric_handle_t> metricsInReport = {};
|
||||
std::vector<zet_intel_metric_scope_exp_handle_t> metricScopesInReport = {};
|
||||
std::vector<zet_intel_metric_result_exp_t> metricResults = {};
|
||||
|
||||
for (auto &calcOp : hCalcOps) {
|
||||
metricsInReportCount = 0;
|
||||
EXPECT_EQ(ZE_RESULT_SUCCESS, zetIntelMetricCalculationOperationGetReportFormatExp(calcOp, &metricsInReportCount, nullptr, nullptr));
|
||||
// Expect 10 metrics per scope included in the calcOp
|
||||
if (calcOp == hCalcOpCompScope1 || calcOp == hCalcOpCompScope2 || calcOp == hCalcOpAggScope) {
|
||||
EXPECT_EQ(metricsInReportCount, 10u);
|
||||
} else if (calcOp == hCalcOpAllCompScopes) {
|
||||
EXPECT_EQ(metricsInReportCount, 20u);
|
||||
} else if (calcOp == hCalcOpAllScopes) {
|
||||
EXPECT_EQ(metricsInReportCount, 30u);
|
||||
}
|
||||
|
||||
metricsInReport.resize(metricsInReportCount);
|
||||
metricScopesInReport.resize(metricsInReportCount);
|
||||
EXPECT_EQ(ZE_RESULT_SUCCESS, zetIntelMetricCalculationOperationGetReportFormatExp(calcOp,
|
||||
&metricsInReportCount,
|
||||
metricsInReport.data(),
|
||||
metricScopesInReport.data()));
|
||||
for (uint32_t i = 0; i < metricsInReportCount; i++) {
|
||||
EXPECT_EQ(ZE_RESULT_SUCCESS, zetMetricGetProperties(metricsInReport[i], &ipSamplingMetricProperties));
|
||||
EXPECT_EQ(strcmp(ipSamplingMetricProperties.name, expectedMetricNamesInReport[i % expectedMetricNamesInReport.size()].c_str()), 0);
|
||||
|
||||
if (calcOp == hCalcOpCompScope1) {
|
||||
EXPECT_EQ(static_cast<MockMetricScope *>(MetricScope::fromHandle(metricScopesInReport[i])), mockMetricScopeCompute0);
|
||||
} else if (calcOp == hCalcOpCompScope2) {
|
||||
EXPECT_EQ(static_cast<MockMetricScope *>(MetricScope::fromHandle(metricScopesInReport[i])), mockMetricScopeCompute1);
|
||||
} else if (calcOp == hCalcOpAllCompScopes) {
|
||||
EXPECT_EQ(metricsInReportCount, 20u);
|
||||
} else if (calcOp == hCalcOpAllScopes) {
|
||||
EXPECT_EQ(metricsInReportCount, 30u);
|
||||
}
|
||||
|
||||
metricsInReport.resize(metricsInReportCount);
|
||||
metricScopesInReport.resize(metricsInReportCount);
|
||||
EXPECT_EQ(ZE_RESULT_SUCCESS, zetIntelMetricCalculationOperationGetReportFormatExp(calcOp,
|
||||
&metricsInReportCount,
|
||||
metricsInReport.data(),
|
||||
metricScopesInReport.data()));
|
||||
for (uint32_t i = 0; i < metricsInReportCount; i++) {
|
||||
EXPECT_EQ(ZE_RESULT_SUCCESS, zetMetricGetProperties(metricsInReport[i], &ipSamplingMetricProperties));
|
||||
EXPECT_EQ(strcmp(ipSamplingMetricProperties.name, expectedMetricNamesInReport[i % expectedMetricNamesInReport.size()].c_str()), 0);
|
||||
|
||||
if (calcOp == hCalcOpCompScope1) {
|
||||
if (i < 10) {
|
||||
EXPECT_EQ(static_cast<MockMetricScope *>(MetricScope::fromHandle(metricScopesInReport[i])), mockMetricScopeCompute0);
|
||||
} else if (calcOp == hCalcOpCompScope2) {
|
||||
} else {
|
||||
EXPECT_EQ(static_cast<MockMetricScope *>(MetricScope::fromHandle(metricScopesInReport[i])), mockMetricScopeCompute1);
|
||||
} else if (calcOp == hCalcOpAllCompScopes) {
|
||||
if (i < 10) {
|
||||
EXPECT_EQ(static_cast<MockMetricScope *>(MetricScope::fromHandle(metricScopesInReport[i])), mockMetricScopeCompute0);
|
||||
} else {
|
||||
EXPECT_EQ(static_cast<MockMetricScope *>(MetricScope::fromHandle(metricScopesInReport[i])), mockMetricScopeCompute1);
|
||||
}
|
||||
} else if (calcOp == hCalcOpAggScope) {
|
||||
}
|
||||
} else if (calcOp == hCalcOpAggScope) {
|
||||
EXPECT_EQ(static_cast<MockMetricScope *>(MetricScope::fromHandle(metricScopesInReport[i])), mockMetricScopeAggregated);
|
||||
} else if (calcOp == hCalcOpAllScopes) {
|
||||
if (i < 10) {
|
||||
// Expect aggregated scope first
|
||||
EXPECT_EQ(static_cast<MockMetricScope *>(MetricScope::fromHandle(metricScopesInReport[i])), mockMetricScopeAggregated);
|
||||
} else if (calcOp == hCalcOpAllScopes) {
|
||||
if (i < 10) {
|
||||
// Expect aggregated scope first
|
||||
EXPECT_EQ(static_cast<MockMetricScope *>(MetricScope::fromHandle(metricScopesInReport[i])), mockMetricScopeAggregated);
|
||||
} else if (i >= 10 && i < 20) {
|
||||
EXPECT_EQ(static_cast<MockMetricScope *>(MetricScope::fromHandle(metricScopesInReport[i])), mockMetricScopeCompute0);
|
||||
} else {
|
||||
EXPECT_EQ(static_cast<MockMetricScope *>(MetricScope::fromHandle(metricScopesInReport[i])), mockMetricScopeCompute1);
|
||||
}
|
||||
} else if (i >= 10 && i < 20) {
|
||||
EXPECT_EQ(static_cast<MockMetricScope *>(MetricScope::fromHandle(metricScopesInReport[i])), mockMetricScopeCompute0);
|
||||
} else {
|
||||
EXPECT_EQ(static_cast<MockMetricScope *>(MetricScope::fromHandle(metricScopesInReport[i])), mockMetricScopeCompute1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
totalMetricReportCount = 0;
|
||||
EXPECT_EQ(ZE_RESULT_SUCCESS, zetIntelMetricCalculateValuesExp(rawDataSize, reinterpret_cast<uint8_t *>(rawDataWithHeader.data()),
|
||||
calcOp, final, &usedSize,
|
||||
&totalMetricReportCount, nullptr));
|
||||
EXPECT_EQ(usedSize, 0U); // query only, no data processed
|
||||
if (calcOp == hCalcOpCompScope1 || calcOp == hCalcOpAllCompScopes) {
|
||||
// three IPs in raw data for sub-dev 0 (rawReports)
|
||||
EXPECT_EQ(totalMetricReportCount, 3U);
|
||||
} else if (calcOp == hCalcOpCompScope2) {
|
||||
// two IPs in raw data for sub-dev 1 (rawReports2)
|
||||
EXPECT_EQ(totalMetricReportCount, 2U);
|
||||
} else if (calcOp == hCalcOpAggScope || calcOp == hCalcOpAllScopes) {
|
||||
// When aggregated scope is included expect unique IPs from both sub-devices: IP1, IP2, IP10, IP100
|
||||
EXPECT_EQ(totalMetricReportCount, 4U);
|
||||
}
|
||||
totalMetricReportCount = 0;
|
||||
EXPECT_EQ(ZE_RESULT_SUCCESS, zetIntelMetricCalculateValuesExp(rawDataSize, reinterpret_cast<uint8_t *>(rawDataWithHeader.data()),
|
||||
calcOp, final, &usedSize,
|
||||
&totalMetricReportCount, nullptr));
|
||||
EXPECT_EQ(usedSize, 0U); // query only, no data processed
|
||||
if (calcOp == hCalcOpCompScope1 || calcOp == hCalcOpAllCompScopes) {
|
||||
// three IPs in raw data for sub-dev 0 (rawReports)
|
||||
EXPECT_EQ(totalMetricReportCount, 3U);
|
||||
} else if (calcOp == hCalcOpCompScope2) {
|
||||
// two IPs in raw data for sub-dev 1 (rawReports2)
|
||||
EXPECT_EQ(totalMetricReportCount, 2U);
|
||||
} else if (calcOp == hCalcOpAggScope || calcOp == hCalcOpAllScopes) {
|
||||
// When aggregated scope is included expect unique IPs from both sub-devices: IP1, IP2, IP10, IP100
|
||||
EXPECT_EQ(totalMetricReportCount, 4U);
|
||||
}
|
||||
|
||||
EXPECT_EQ(usedSize, 0U); // query only, no data processed
|
||||
metricResults.resize(totalMetricReportCount * metricsInReportCount);
|
||||
EXPECT_EQ(ZE_RESULT_SUCCESS, zetIntelMetricCalculateValuesExp(rawDataSize, reinterpret_cast<uint8_t *>(rawDataWithHeader.data()),
|
||||
calcOp, final, &usedSize,
|
||||
&totalMetricReportCount, metricResults.data()));
|
||||
EXPECT_EQ(usedSize, rawDataSize);
|
||||
if (calcOp == hCalcOpCompScope1 || calcOp == hCalcOpAllCompScopes) {
|
||||
// three IPs in raw data for sub-dev 0 (rawReports)
|
||||
EXPECT_EQ(totalMetricReportCount, 3U);
|
||||
} else if (calcOp == hCalcOpCompScope2) {
|
||||
// two IPs in raw data for sub-dev 1 (rawReports2)
|
||||
EXPECT_EQ(totalMetricReportCount, 2U);
|
||||
} else if (calcOp == hCalcOpAggScope || calcOp == hCalcOpAllScopes) {
|
||||
// When aggregated scope is included expect unique IPs from both sub-devices: IP1, IP2, IP10, IP100
|
||||
EXPECT_EQ(totalMetricReportCount, 4U);
|
||||
}
|
||||
EXPECT_EQ(usedSize, 0U); // query only, no data processed
|
||||
metricResults.resize(totalMetricReportCount * metricsInReportCount);
|
||||
EXPECT_EQ(ZE_RESULT_SUCCESS, zetIntelMetricCalculateValuesExp(rawDataSize, reinterpret_cast<uint8_t *>(rawDataWithHeader.data()),
|
||||
calcOp, final, &usedSize,
|
||||
&totalMetricReportCount, metricResults.data()));
|
||||
EXPECT_EQ(usedSize, rawDataSize);
|
||||
if (calcOp == hCalcOpCompScope1 || calcOp == hCalcOpAllCompScopes) {
|
||||
// three IPs in raw data for sub-dev 0 (rawReports)
|
||||
EXPECT_EQ(totalMetricReportCount, 3U);
|
||||
} else if (calcOp == hCalcOpCompScope2) {
|
||||
// two IPs in raw data for sub-dev 1 (rawReports2)
|
||||
EXPECT_EQ(totalMetricReportCount, 2U);
|
||||
} else if (calcOp == hCalcOpAggScope || calcOp == hCalcOpAllScopes) {
|
||||
// When aggregated scope is included expect unique IPs from both sub-devices: IP1, IP2, IP10, IP100
|
||||
EXPECT_EQ(totalMetricReportCount, 4U);
|
||||
}
|
||||
|
||||
// Data for sub dev 0 is from rawReports so expected results are from expectedMetricValues for IP1, IP10 and IP100
|
||||
for (uint32_t i = 0; i < totalMetricReportCount; i++) {
|
||||
for (uint32_t j = 0; j < metricsInReportCount; j++) {
|
||||
uint32_t resultIndex = i * metricsInReportCount + j;
|
||||
if (calcOp == hCalcOpCompScope1) {
|
||||
EXPECT_TRUE(metricResults[resultIndex].value.ui64 == expectedMetricValues[resultIndex].value.ui64);
|
||||
// Data for sub dev 0 is from rawReports so expected results are from expectedMetricValues for IP1, IP10 and IP100
|
||||
for (uint32_t i = 0; i < totalMetricReportCount; i++) {
|
||||
for (uint32_t j = 0; j < metricsInReportCount; j++) {
|
||||
uint32_t resultIndex = i * metricsInReportCount + j;
|
||||
if (calcOp == hCalcOpCompScope1) {
|
||||
EXPECT_TRUE(metricResults[resultIndex].value.ui64 == expectedMetricValues[resultIndex].value.ui64);
|
||||
EXPECT_TRUE(metricResults[resultIndex].resultStatus == ZET_INTEL_METRIC_CALCULATION_EXP_RESULT_VALID);
|
||||
} else if (calcOp == hCalcOpCompScope2) {
|
||||
EXPECT_TRUE(metricResults[resultIndex].value.ui64 == expectedMetricValues2[resultIndex].value.ui64);
|
||||
EXPECT_TRUE(metricResults[resultIndex].resultStatus == ZET_INTEL_METRIC_CALCULATION_EXP_RESULT_VALID);
|
||||
} else if (calcOp == hCalcOpAllCompScopes) {
|
||||
EXPECT_TRUE(metricResults[resultIndex].value.ui64 == expectedMetricValuesCalcOpAllCompScopes[resultIndex]);
|
||||
if (resultIndex < 50) {
|
||||
// First two result reports have valid entries in compute caches
|
||||
EXPECT_TRUE(metricResults[resultIndex].resultStatus == ZET_INTEL_METRIC_CALCULATION_EXP_RESULT_VALID);
|
||||
} else if (calcOp == hCalcOpCompScope2) {
|
||||
EXPECT_TRUE(metricResults[resultIndex].value.ui64 == expectedMetricValues2[resultIndex].value.ui64);
|
||||
EXPECT_TRUE(metricResults[resultIndex].resultStatus == ZET_INTEL_METRIC_CALCULATION_EXP_RESULT_VALID);
|
||||
} else if (calcOp == hCalcOpAllCompScopes) {
|
||||
EXPECT_TRUE(metricResults[resultIndex].value.ui64 == expectedMetricValuesCalcOpAllCompScopes[resultIndex]);
|
||||
if (resultIndex < 50) {
|
||||
// First two result reports have valid entries in compute caches
|
||||
EXPECT_TRUE(metricResults[resultIndex].resultStatus == ZET_INTEL_METRIC_CALCULATION_EXP_RESULT_VALID);
|
||||
} else {
|
||||
// Third result report does not have IPs for sub-dev 1 in the cache: 3 IPs for subdev 0, 2 IPs for subdev 1
|
||||
EXPECT_TRUE(metricResults[resultIndex].resultStatus == ZET_INTEL_METRIC_CALCULATION_EXP_RESULT_INVALID);
|
||||
}
|
||||
} else {
|
||||
// Third result report does not have IPs for sub-dev 1 in the cache: 3 IPs for subdev 0, 2 IPs for subdev 1
|
||||
EXPECT_TRUE(metricResults[resultIndex].resultStatus == ZET_INTEL_METRIC_CALCULATION_EXP_RESULT_INVALID);
|
||||
}
|
||||
|
||||
} else if (calcOp == hCalcOpAggScope) {
|
||||
// Expected results are the aggregation of both sub-devices
|
||||
EXPECT_TRUE(metricResults[resultIndex].value.ui64 == expectedMetricValuesCalcOpAggScope[resultIndex]);
|
||||
} else if (calcOp == hCalcOpAggScope) {
|
||||
// Expected results are the aggregation of both sub-devices
|
||||
EXPECT_TRUE(metricResults[resultIndex].value.ui64 == expectedMetricValuesCalcOpAggScope[resultIndex]);
|
||||
EXPECT_TRUE(metricResults[resultIndex].resultStatus == ZET_INTEL_METRIC_CALCULATION_EXP_RESULT_VALID);
|
||||
} else if (calcOp == hCalcOpAllScopes) {
|
||||
EXPECT_TRUE(metricResults[resultIndex].value.ui64 == expectedMetricValuesCalcOpAllScopes[resultIndex]);
|
||||
// Sub-dev 0 has 3 IPs, sub-dev 1 has 2 IPs, aggregated scope has 4 IPs
|
||||
if (resultIndex < 80) {
|
||||
// First two reports: all results are valid.
|
||||
// Third result report: aggregated scope cache has IPs, sub-dev 0 has IPs
|
||||
EXPECT_TRUE(metricResults[resultIndex].resultStatus == ZET_INTEL_METRIC_CALCULATION_EXP_RESULT_VALID);
|
||||
} else if (calcOp == hCalcOpAllScopes) {
|
||||
EXPECT_TRUE(metricResults[resultIndex].value.ui64 == expectedMetricValuesCalcOpAllScopes[resultIndex]);
|
||||
// Sub-dev 0 has 3 IPs, sub-dev 1 has 2 IPs, aggregated scope has 4 IPs
|
||||
if (resultIndex < 80) {
|
||||
// First two reports: all results are valid.
|
||||
// Third result report: aggregated scope cache has IPs, sub-dev 0 has IPs
|
||||
EXPECT_TRUE(metricResults[resultIndex].resultStatus == ZET_INTEL_METRIC_CALCULATION_EXP_RESULT_VALID);
|
||||
} else if (resultIndex >= 80 && resultIndex < 90) {
|
||||
// Third result report: sub-dev 1 cache ran out of IPs
|
||||
EXPECT_TRUE(metricResults[resultIndex].resultStatus == ZET_INTEL_METRIC_CALCULATION_EXP_RESULT_INVALID);
|
||||
} else if (resultIndex >= 90 && resultIndex < 100) {
|
||||
// Fourth result report: only aggregated scope cache has IPs
|
||||
EXPECT_TRUE(metricResults[resultIndex].resultStatus == ZET_INTEL_METRIC_CALCULATION_EXP_RESULT_VALID);
|
||||
} else {
|
||||
// Fourth result report: both sub-devices caches ran out of IPs
|
||||
EXPECT_TRUE(metricResults[resultIndex].resultStatus == ZET_INTEL_METRIC_CALCULATION_EXP_RESULT_INVALID);
|
||||
}
|
||||
} else if (resultIndex >= 80 && resultIndex < 90) {
|
||||
// Third result report: sub-dev 1 cache ran out of IPs
|
||||
EXPECT_TRUE(metricResults[resultIndex].resultStatus == ZET_INTEL_METRIC_CALCULATION_EXP_RESULT_INVALID);
|
||||
} else if (resultIndex >= 90 && resultIndex < 100) {
|
||||
// Fourth result report: only aggregated scope cache has IPs
|
||||
EXPECT_TRUE(metricResults[resultIndex].resultStatus == ZET_INTEL_METRIC_CALCULATION_EXP_RESULT_VALID);
|
||||
} else {
|
||||
// Fourth result report: both sub-devices caches ran out of IPs
|
||||
EXPECT_TRUE(metricResults[resultIndex].resultStatus == ZET_INTEL_METRIC_CALCULATION_EXP_RESULT_INVALID);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
*/
|
||||
}
|
||||
}
|
||||
|
||||
HWTEST2_F(MetricIpSamplingCalcAggregationTest, GivenIpSamplingCalcOpOnRootDeviceCalculatingConcatenatedDataExpectSuccess, EustallSupportedPlatforms) {
|
||||
@@ -978,7 +977,6 @@ HWTEST2_F(MetricIpSamplingCalcAggregationTest, GivenIpSamplingCalcOpOnRootDevice
|
||||
// Data for aggregated and both compute scopes
|
||||
EXPECT_TRUE(metricResults[j].value.ui64 == expectedMetricValuesCalcOpAllScopes[j]);
|
||||
}
|
||||
|
||||
EXPECT_TRUE(metricResults[j].resultStatus == ZET_INTEL_METRIC_CALCULATION_EXP_RESULT_VALID);
|
||||
}
|
||||
|
||||
|
||||
@@ -28,11 +28,16 @@ class OaMetricProgrammableFixture : public DeviceFixture,
|
||||
MockIAdapterGroup1x13 mockAdapterGroup{};
|
||||
void disableProgrammableMetricsSupport();
|
||||
DebugManagerStateRestore restorer;
|
||||
MockMetricScope *mockMetricScope = nullptr;
|
||||
std::vector<MetricScopeImp *> mockMetricScopes{};
|
||||
};
|
||||
|
||||
void OaMetricProgrammableFixture::TearDown() {
|
||||
DeviceFixture::tearDown();
|
||||
deviceContext.reset();
|
||||
delete mockMetricScope;
|
||||
mockMetricScope = nullptr;
|
||||
mockMetricScopes.clear();
|
||||
}
|
||||
|
||||
void OaMetricProgrammableFixture::SetUp() {
|
||||
@@ -48,6 +53,11 @@ void OaMetricProgrammableFixture::SetUp() {
|
||||
|
||||
oaMetricSource->setInitializationState(ZE_RESULT_SUCCESS);
|
||||
metricEnumeration->setInitializationState(ZE_RESULT_SUCCESS);
|
||||
zet_intel_metric_scope_properties_exp_t scopeProperties{};
|
||||
scopeProperties.stype = ZET_STRUCTURE_TYPE_INTEL_METRIC_SCOPE_PROPERTIES_EXP;
|
||||
scopeProperties.pNext = nullptr;
|
||||
mockMetricScope = new MockMetricScope(scopeProperties, false, 0);
|
||||
mockMetricScopes.push_back(mockMetricScope);
|
||||
}
|
||||
|
||||
void OaMetricProgrammableFixture::disableProgrammableMetricsSupport() {
|
||||
@@ -705,7 +715,7 @@ TEST_F(OaMetricProgrammableTests, givenValidMetricGroupWhenAddingOrRemovingMetri
|
||||
TEST_F(OaMetricProgrammableTests, givenInvalidMeticWhenMetricGroupIsCreatedThenErrorIsReturned) {
|
||||
MockMetricSource mockMetricSource{};
|
||||
mockMetricSource.isAvailableReturn = true;
|
||||
MockMetric mockMetric(mockMetricSource);
|
||||
MockMetric mockMetric(mockMetricSource, mockMetricScopes);
|
||||
uint32_t metricGroupCount = 0;
|
||||
auto metricHandle = mockMetric.toHandle();
|
||||
EXPECT_EQ(ZE_RESULT_ERROR_INVALID_ARGUMENT, deviceContext->createMetricGroupsFromMetrics(1, &metricHandle, "metricGroupName", "metricGroupDesc", &metricGroupCount, nullptr));
|
||||
@@ -1193,7 +1203,7 @@ TEST_F(OaMetricProgrammableTests, givenValidMetricGroupWhenAddingOrRemovingMetri
|
||||
|
||||
MockMetricSource mockMetricSource{};
|
||||
mockMetricSource.isAvailableReturn = true;
|
||||
MockMetric mockMetric(mockMetricSource);
|
||||
MockMetric mockMetric(mockMetricSource, mockMetricScopes);
|
||||
auto metricHandleIncorrectSource = mockMetric.toHandle();
|
||||
|
||||
EXPECT_EQ(ZE_RESULT_ERROR_INVALID_ARGUMENT, zetMetricGroupAddMetricExp(metricGroupHandle, metricHandleIncorrectSource, &errorStringSize, nullptr));
|
||||
@@ -1465,7 +1475,7 @@ TEST_F(OaMetricProgrammableTests, givenEnableProgrammableMetricsSupportIsNotSetW
|
||||
TEST_F(OaMetricProgrammableTests, givenCreateMetricGroupsFromMetricsWhenUnembargoedMetricSourceIsUsedThenSuccessIsReturned) {
|
||||
MockMetricSource mockMetricSource{};
|
||||
mockMetricSource.isAvailableReturn = true;
|
||||
MockMetric mockMetric(mockMetricSource);
|
||||
MockMetric mockMetric(mockMetricSource, mockMetricScopes);
|
||||
mockMetric.setPredefined(false);
|
||||
|
||||
uint32_t metricGroupCount = 0;
|
||||
@@ -1586,11 +1596,16 @@ class MultiSourceOaMetricProgrammableFixture : public DeviceFixture,
|
||||
MetricEnumeration *metricEnumeration = nullptr;
|
||||
MockIAdapterGroup1x13 mockAdapterGroup{};
|
||||
MockMetricIpSamplingSource *metricSource = nullptr;
|
||||
MockMetricScope *mockMetricScope = nullptr;
|
||||
std::vector<MetricScopeImp *> mockMetricScopes{};
|
||||
};
|
||||
|
||||
void MultiSourceOaMetricProgrammableFixture::TearDown() {
|
||||
DeviceFixture::tearDown();
|
||||
deviceContext.reset();
|
||||
delete mockMetricScope;
|
||||
mockMetricScope = nullptr;
|
||||
mockMetricScopes.clear();
|
||||
}
|
||||
|
||||
void MultiSourceOaMetricProgrammableFixture::SetUp() {
|
||||
@@ -1608,6 +1623,11 @@ void MultiSourceOaMetricProgrammableFixture::SetUp() {
|
||||
|
||||
metricSource = new MockMetricIpSamplingSource(*deviceContext);
|
||||
deviceContext->setMetricIpSamplingSource(metricSource);
|
||||
zet_intel_metric_scope_properties_exp_t scopeProperties{};
|
||||
scopeProperties.stype = ZET_STRUCTURE_TYPE_INTEL_METRIC_SCOPE_PROPERTIES_EXP;
|
||||
scopeProperties.pNext = nullptr;
|
||||
mockMetricScope = new MockMetricScope(scopeProperties, false, 0);
|
||||
mockMetricScopes.push_back(mockMetricScope);
|
||||
}
|
||||
|
||||
TEST_F(MultiSourceOaMetricProgrammableFixture, givenCreateMetricGroupsFromMetricsIsCalledAndOneMetricSourcesReturnsUnsupportedThenSuccessIsReturned) {
|
||||
@@ -1631,7 +1651,7 @@ TEST_F(MultiSourceOaMetricProgrammableFixture, givenCreateMetricGroupsFromMetric
|
||||
ASSERT_EQ(ZE_RESULT_SUCCESS, MetricProgrammable::fromHandle(programmable)->createMetric(¶meterValue, 1, metricName, metricDescription, &metricHandleCount, &metricHandle));
|
||||
|
||||
MockMetricIpSamplingSource mockMetricTraceSource(*deviceContext);
|
||||
MockMetric mockMetric(mockMetricTraceSource);
|
||||
MockMetric mockMetric(mockMetricTraceSource, mockMetricScopes);
|
||||
mockMetric.setPredefined(false);
|
||||
|
||||
zet_metric_handle_t metricHandles[] = {metricHandle, mockMetric.toHandle()};
|
||||
@@ -1674,7 +1694,7 @@ TEST_F(MultiSourceOaMetricProgrammableFixture, givenCreateMetricGroupsFromMetric
|
||||
ASSERT_EQ(ZE_RESULT_SUCCESS, MetricProgrammable::fromHandle(programmable)->createMetric(¶meterValue, 1, metricName, metricDescription, &metricHandleCount, &metricHandle));
|
||||
|
||||
MockMetricIpSamplingSource &mockMetricTraceSource = static_cast<MockMetricIpSamplingSource &>(deviceContext->getMetricSource<IpSamplingMetricSourceImp>());
|
||||
MockMetric mockMetric(mockMetricTraceSource);
|
||||
MockMetric mockMetric(mockMetricTraceSource, mockMetricScopes);
|
||||
mockMetric.setPredefined(false);
|
||||
|
||||
zet_metric_handle_t metricHandles[] = {metricHandle, mockMetric.toHandle()};
|
||||
@@ -1727,7 +1747,7 @@ TEST_F(MultiSourceOaMetricProgrammableFixture, givenCreateMetricGroupsFromMetric
|
||||
ASSERT_EQ(ZE_RESULT_SUCCESS, MetricProgrammable::fromHandle(programmable)->createMetric(¶meterValue, 1, metricName, metricDescription, &metricHandleCount, &metricHandle));
|
||||
|
||||
MockMetricIpSamplingSource &mockMetricTraceSource = static_cast<MockMetricIpSamplingSource &>(deviceContext->getMetricSource<IpSamplingMetricSourceImp>());
|
||||
MockMetric mockMetric(mockMetricTraceSource);
|
||||
MockMetric mockMetric(mockMetricTraceSource, mockMetricScopes);
|
||||
mockMetric.setPredefined(false);
|
||||
|
||||
zet_metric_handle_t metricHandles[] = {metricHandle, mockMetric.toHandle()};
|
||||
|
||||
@@ -29,6 +29,7 @@ class OaMultiDeviceMetricProgrammableFixture : public MultiDeviceFixture,
|
||||
Device *rootDevice = nullptr;
|
||||
DebugManagerStateRestore restorer;
|
||||
MockIConcurrentGroup1x13 mockConcurrentGroup{};
|
||||
MockMetricSource mockMetricSource{};
|
||||
|
||||
void getMetricProgrammable(zet_metric_programmable_exp_handle_t &programmable);
|
||||
void getMetricFromProgrammable(zet_metric_programmable_exp_handle_t programmable, zet_metric_handle_t &metricHandle);
|
||||
@@ -527,8 +528,13 @@ TEST_F(OaMultiDeviceMetricProgrammableTests, givenMultiDeviceMetricGroupWhenAddA
|
||||
std::vector<zet_metric_group_handle_t> metricGroups{};
|
||||
createMetricGroupFromMetric(metricHandle, metricGroups);
|
||||
|
||||
MockMetricSource metricSource{};
|
||||
MockMetric mockMetric(metricSource);
|
||||
zet_intel_metric_scope_properties_exp_t scopeProperties{};
|
||||
scopeProperties.stype = ZET_STRUCTURE_TYPE_INTEL_METRIC_SCOPE_PROPERTIES_EXP;
|
||||
scopeProperties.pNext = nullptr;
|
||||
MockMetricScope mockMetricScope(scopeProperties, false, 0);
|
||||
std::vector<MetricScopeImp *> mockMetricScopes{&mockMetricScope};
|
||||
MockMetric mockMetric(mockMetricSource, mockMetricScopes);
|
||||
|
||||
mockMetric.setMultiDevice(false);
|
||||
mockMetric.setPredefined(false);
|
||||
|
||||
@@ -762,12 +768,16 @@ struct MockMetricProgrammable : public MetricProgrammable {
|
||||
|
||||
MockMetricSource metricSource{};
|
||||
std::vector<MockMetric *> allocatedMetricObjects{};
|
||||
std::vector<MetricScopeImp *> mockMetricScopes{};
|
||||
|
||||
~MockMetricProgrammable() override {
|
||||
for (auto &metric : allocatedMetricObjects) {
|
||||
delete metric;
|
||||
delete mockMetricScopes.back();
|
||||
mockMetricScopes.pop_back();
|
||||
}
|
||||
allocatedMetricObjects.clear();
|
||||
mockMetricScopes.clear();
|
||||
}
|
||||
|
||||
ze_result_t createMetricReturnStatus = ZE_RESULT_SUCCESS;
|
||||
@@ -805,11 +815,17 @@ struct MockMetricProgrammable : public MetricProgrammable {
|
||||
|
||||
void prepareMetricObjects(uint32_t metricHandleCount) {
|
||||
|
||||
zet_intel_metric_scope_properties_exp_t scopeProperties{};
|
||||
scopeProperties.stype = ZET_STRUCTURE_TYPE_INTEL_METRIC_SCOPE_PROPERTIES_EXP;
|
||||
scopeProperties.pNext = nullptr;
|
||||
|
||||
bool additionalAllocationNecessary = metricHandleCount > static_cast<uint32_t>(allocatedMetricObjects.size());
|
||||
if (additionalAllocationNecessary) {
|
||||
uint32_t additionalAllocations = metricHandleCount - static_cast<uint32_t>(allocatedMetricObjects.size());
|
||||
for (uint32_t index = 0; index < additionalAllocations; index++) {
|
||||
auto mockMetric = new MockMetric(metricSource);
|
||||
auto mockMetricScope = new MockMetricScope(scopeProperties, false, 0);
|
||||
mockMetricScopes.push_back(mockMetricScope);
|
||||
auto mockMetric = new MockMetric(metricSource, mockMetricScopes);
|
||||
mockMetric->destroyReturn = ZE_RESULT_SUCCESS;
|
||||
allocatedMetricObjects.push_back(mockMetric);
|
||||
}
|
||||
@@ -910,11 +926,16 @@ TEST(HomogeneousMultiDeviceMetricProgrammableTest, givenSubDevicesReturnZeroMetr
|
||||
|
||||
TEST(HomogeneousMultiDeviceMetricTest, givenMultiDeviceMetricWhenDestroyIsCalledThenUnsupportedFeatureIsReturned) {
|
||||
|
||||
MockMetricSource mockSource;
|
||||
MockMetric mockMetric(mockSource);
|
||||
MockMetricSource mockMetricSource{};
|
||||
zet_intel_metric_scope_properties_exp_t scopeProperties{};
|
||||
scopeProperties.stype = ZET_STRUCTURE_TYPE_INTEL_METRIC_SCOPE_PROPERTIES_EXP;
|
||||
scopeProperties.pNext = nullptr;
|
||||
MockMetricScope mockMetricScope(scopeProperties, false, 0);
|
||||
std::vector<MetricScopeImp *> mockMetricScopes{&mockMetricScope};
|
||||
MockMetric mockMetric(mockMetricSource, mockMetricScopes);
|
||||
std::vector<MetricImp *> mockMetrics{&mockMetric};
|
||||
MultiDeviceMetricImp *multiDevMetric = static_cast<MultiDeviceMetricImp *>(
|
||||
MultiDeviceMetricImp::create(mockSource, mockMetrics));
|
||||
MultiDeviceMetricImp::create(mockMetricSource, mockMetrics, mockMetricScopes));
|
||||
EXPECT_EQ(ZE_RESULT_ERROR_UNSUPPORTED_FEATURE, multiDevMetric->destroy());
|
||||
delete multiDevMetric;
|
||||
}
|
||||
@@ -950,11 +971,16 @@ struct DummyMetricGroup : public MockMetricGroup {
|
||||
TEST_F(MultiDeviceCreatedMetricGroupManagerTest, givenMetricFromSubDeviceIsUsedWhenCreateMultipleFromHomogenousMetricsIsCalledThenErrorIsReturned) {
|
||||
|
||||
MockMetricSource mockMetricSource{};
|
||||
MockMetric metric(mockMetricSource);
|
||||
metric.setMultiDevice(false);
|
||||
zet_intel_metric_scope_properties_exp_t scopeProperties{};
|
||||
scopeProperties.stype = ZET_STRUCTURE_TYPE_INTEL_METRIC_SCOPE_PROPERTIES_EXP;
|
||||
scopeProperties.pNext = nullptr;
|
||||
MockMetricScope mockMetricScope(scopeProperties, false, 0);
|
||||
std::vector<MetricScopeImp *> mockMetricScopes{&mockMetricScope};
|
||||
MockMetric mockMetric(mockMetricSource, mockMetricScopes);
|
||||
mockMetric.setMultiDevice(false);
|
||||
|
||||
uint32_t metricGroupFromMetricsCount = 0;
|
||||
auto metricHandle = metric.toHandle();
|
||||
auto metricHandle = mockMetric.toHandle();
|
||||
std::vector<zet_metric_group_handle_t> metricGroups{};
|
||||
std::vector<zet_metric_handle_t> metrics(1);
|
||||
metrics[0] = metricHandle;
|
||||
|
||||
Reference in New Issue
Block a user