diff --git a/level_zero/api/tools/zet_metric.cpp b/level_zero/api/tools/zet_metric.cpp index 34b62ed2b3b1d..f72264b3c73e8 100644 --- a/level_zero/api/tools/zet_metric.cpp +++ b/level_zero/api/tools/zet_metric.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2020-2021 Intel Corporation + * Copyright (C) 2020-2022 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -30,7 +30,7 @@ zetMetricGet( zet_metric_group_handle_t hMetricGroup, uint32_t *pCount, zet_metric_handle_t *phMetrics) { - return L0::MetricGroup::fromHandle(hMetricGroup)->getMetric(pCount, phMetrics); + return L0::MetricGroup::fromHandle(hMetricGroup)->metricGet(pCount, phMetrics); } ZE_DLLEXPORT ze_result_t ZE_APICALL diff --git a/level_zero/tools/source/metrics/metric.cpp b/level_zero/tools/source/metrics/metric.cpp index aa111c60ddef0..3d1efd98910c1 100644 --- a/level_zero/tools/source/metrics/metric.cpp +++ b/level_zero/tools/source/metrics/metric.cpp @@ -236,7 +236,9 @@ ze_result_t MetricDeviceContext::activateMetricGroupsDeferred(uint32_t count, ze for (auto index = 0u; index < count; index++) { zet_metric_group_handle_t hMetricGroup = MetricGroup::fromHandle(phMetricGroups[index])->getMetricGroupForSubDevice(subDeviceIndex); - auto domain = MetricGroup::getProperties(hMetricGroup).domain; + zet_metric_group_properties_t properties = {ZET_STRUCTURE_TYPE_METRIC_GROUP_PROPERTIES}; + MetricGroup::fromHandle(hMetricGroup)->getProperties(&properties); + auto domain = properties.domain; // Domain already associated with the same handle. if (domains[domain].first == hMetricGroup) { continue; @@ -370,8 +372,7 @@ ze_result_t metricGroupGet(zet_device_handle_t hDevice, uint32_t *pCount, zet_me ze_result_t metricStreamerOpen(zet_context_handle_t hContext, zet_device_handle_t hDevice, zet_metric_group_handle_t hMetricGroup, zet_metric_streamer_desc_t *pDesc, ze_event_handle_t hNotificationEvent, zet_metric_streamer_handle_t *phMetricStreamer) { - - return MetricStreamer::open(hContext, hDevice, hMetricGroup, *pDesc, hNotificationEvent, phMetricStreamer); + return MetricGroup::fromHandle(hMetricGroup)->streamerOpen(hContext, hDevice, pDesc, hNotificationEvent, phMetricStreamer); } template <> diff --git a/level_zero/tools/source/metrics/metric.h b/level_zero/tools/source/metrics/metric.h index 2c11f95ea98a8..ae658d8007d3f 100644 --- a/level_zero/tools/source/metrics/metric.h +++ b/level_zero/tools/source/metrics/metric.h @@ -81,7 +81,7 @@ struct MetricGroup : _zet_metric_group_handle_t { virtual ~MetricGroup() = default; virtual ze_result_t getProperties(zet_metric_group_properties_t *pProperties) = 0; - virtual ze_result_t getMetric(uint32_t *pCount, zet_metric_handle_t *phMetrics) = 0; + virtual ze_result_t metricGet(uint32_t *pCount, zet_metric_handle_t *phMetrics) = 0; virtual ze_result_t calculateMetricValues(const zet_metric_group_calculation_type_t type, size_t rawDataSize, const uint8_t *pRawData, uint32_t *pMetricValueCount, zet_typed_value_t *pMetricValues) = 0; @@ -89,29 +89,24 @@ struct MetricGroup : _zet_metric_group_handle_t { const uint8_t *pRawData, uint32_t *pSetCount, uint32_t *pTotalMetricValueCount, uint32_t *pMetricCounts, zet_typed_value_t *pMetricValues) = 0; - - static MetricGroup *create(zet_metric_group_properties_t &properties, - MetricsDiscovery::IMetricSet_1_5 &metricSet, - MetricsDiscovery::IConcurrentGroup_1_5 &concurrentGroup, - const std::vector &metrics, - MetricSource &metricSource); static MetricGroup *fromHandle(zet_metric_group_handle_t handle) { return static_cast(handle); } - static zet_metric_group_properties_t getProperties(const zet_metric_group_handle_t handle); - zet_metric_group_handle_t toHandle() { return this; } - - virtual uint32_t getRawReportSize() = 0; - virtual bool activate() = 0; virtual bool deactivate() = 0; virtual zet_metric_group_handle_t getMetricGroupForSubDevice(const uint32_t subDeviceIndex) = 0; - - virtual ze_result_t openIoStream(uint32_t &timerPeriodNs, uint32_t &oaBufferSize) = 0; - virtual ze_result_t waitForReports(const uint32_t timeoutMs) = 0; - virtual ze_result_t readIoStream(uint32_t &reportCount, uint8_t &reportData) = 0; - virtual ze_result_t closeIoStream() = 0; + virtual ze_result_t streamerOpen( + zet_context_handle_t hContext, + zet_device_handle_t hDevice, + zet_metric_streamer_desc_t *desc, + ze_event_handle_t hNotificationEvent, + zet_metric_streamer_handle_t *phMetricStreamer) = 0; + virtual ze_result_t metricQueryPoolCreate( + zet_context_handle_t hContext, + zet_device_handle_t hDevice, + const zet_metric_query_pool_desc_t *desc, + zet_metric_query_pool_handle_t *phMetricQueryPool) = 0; }; struct MetricGroupCalculateHeader { @@ -126,19 +121,12 @@ struct MetricGroupCalculateHeader { struct MetricStreamer : _zet_metric_streamer_handle_t { virtual ~MetricStreamer() = default; - virtual ze_result_t readData(uint32_t maxReportCount, size_t *pRawDataSize, uint8_t *pRawData) = 0; virtual ze_result_t close() = 0; - static ze_result_t openForDevice(Device *pDevice, zet_metric_group_handle_t hMetricGroup, - zet_metric_streamer_desc_t &desc, - zet_metric_streamer_handle_t *phMetricStreamer); - static ze_result_t open(zet_context_handle_t hContext, zet_device_handle_t hDevice, zet_metric_group_handle_t hMetricGroup, - zet_metric_streamer_desc_t &desc, ze_event_handle_t hNotificationEvent, zet_metric_streamer_handle_t *phMetricStreamer); static MetricStreamer *fromHandle(zet_metric_streamer_handle_t handle) { return static_cast(handle); } - virtual Event::State getNotificationState() = 0; inline zet_metric_streamer_handle_t toHandle() { return this; } }; diff --git a/level_zero/tools/source/metrics/metric_enumeration_imp.cpp b/level_zero/tools/source/metrics/metric_enumeration_imp.cpp index 50871ce427483..e0a4c1ab622fa 100644 --- a/level_zero/tools/source/metrics/metric_enumeration_imp.cpp +++ b/level_zero/tools/source/metrics/metric_enumeration_imp.cpp @@ -313,7 +313,7 @@ MetricEnumeration::cacheMetricGroup(MetricsDiscovery::IMetricSet_1_5 &metricSet, std::vector metrics; createMetrics(metricSet, metrics); - auto pMetricGroup = MetricGroup::create(properties, metricSet, concurrentGroup, metrics, metricSource); + auto pMetricGroup = OaMetricGroupImp::create(properties, metricSet, concurrentGroup, metrics, metricSource); DEBUG_BREAK_IF(pMetricGroup == nullptr); metricGroups.push_back(pMetricGroup); @@ -485,14 +485,14 @@ OaMetricGroupImp ::~OaMetricGroupImp() { ze_result_t OaMetricGroupImp::getProperties(zet_metric_group_properties_t *pProperties) { if (metricGroups.size() > 0) { - *pProperties = MetricGroup::getProperties(metricGroups[0]); + *pProperties = OaMetricGroupImp::getProperties(metricGroups[0]); } else { copyProperties(properties, *pProperties); } return ZE_RESULT_SUCCESS; } -zet_metric_group_properties_t MetricGroup::getProperties(const zet_metric_group_handle_t handle) { +zet_metric_group_properties_t OaMetricGroupImp::getProperties(const zet_metric_group_handle_t handle) { auto metricGroup = MetricGroup::fromHandle(handle); UNRECOVERABLE_IF(!metricGroup); @@ -502,11 +502,11 @@ zet_metric_group_properties_t MetricGroup::getProperties(const zet_metric_group_ return properties; } -ze_result_t OaMetricGroupImp::getMetric(uint32_t *pCount, zet_metric_handle_t *phMetrics) { +ze_result_t OaMetricGroupImp::metricGet(uint32_t *pCount, zet_metric_handle_t *phMetrics) { if (metricGroups.size() > 0) { auto metricGroupSubDevice = MetricGroup::fromHandle(metricGroups[0]); - return metricGroupSubDevice->getMetric(pCount, phMetrics); + return metricGroupSubDevice->metricGet(pCount, phMetrics); } if (*pCount == 0) { @@ -916,11 +916,11 @@ void OaMetricImp::copyProperties(const zet_metric_properties_t &source, source.resultUnits, sizeof(destination.resultUnits)); } -MetricGroup *MetricGroup::create(zet_metric_group_properties_t &properties, - MetricsDiscovery::IMetricSet_1_5 &metricSet, - MetricsDiscovery::IConcurrentGroup_1_5 &concurrentGroup, - const std::vector &metrics, - MetricSource &metricSource) { +MetricGroup *OaMetricGroupImp::create(zet_metric_group_properties_t &properties, + MetricsDiscovery::IMetricSet_1_5 &metricSet, + MetricsDiscovery::IConcurrentGroup_1_5 &concurrentGroup, + const std::vector &metrics, + MetricSource &metricSource) { auto pMetricGroup = new OaMetricGroupImp(); UNRECOVERABLE_IF(pMetricGroup == nullptr); pMetricGroup->initialize(properties, metricSet, concurrentGroup, metrics, static_cast(metricSource)); diff --git a/level_zero/tools/source/metrics/metric_enumeration_imp.h b/level_zero/tools/source/metrics/metric_enumeration_imp.h index 4282808078488..8aa3885ce4595 100644 --- a/level_zero/tools/source/metrics/metric_enumeration_imp.h +++ b/level_zero/tools/source/metrics/metric_enumeration_imp.h @@ -77,7 +77,7 @@ struct OaMetricGroupImp : MetricGroup { ~OaMetricGroupImp() override; ze_result_t getProperties(zet_metric_group_properties_t *pProperties) override; - ze_result_t getMetric(uint32_t *pCount, zet_metric_handle_t *phMetrics) override; + ze_result_t metricGet(uint32_t *pCount, zet_metric_handle_t *phMetrics) override; ze_result_t calculateMetricValues(const zet_metric_group_calculation_type_t type, size_t rawDataSize, const uint8_t *pRawData, uint32_t *pMetricValueCount, zet_typed_value_t *pCalculatedData) override; @@ -91,8 +91,6 @@ struct OaMetricGroupImp : MetricGroup { const std::vector &groupMetrics, OaMetricSourceImp &metricSource); - uint32_t getRawReportSize() override; - bool activate() override; bool deactivate() override; @@ -103,12 +101,31 @@ struct OaMetricGroupImp : MetricGroup { zet_metric_group_handle_t getMetricGroupForSubDevice(const uint32_t subDeviceIndex) override; // Time based measurements. - ze_result_t openIoStream(uint32_t &timerPeriodNs, uint32_t &oaBufferSize) override; - ze_result_t waitForReports(const uint32_t timeoutMs) override; - ze_result_t readIoStream(uint32_t &reportCount, uint8_t &reportData) override; - ze_result_t closeIoStream() override; + ze_result_t openIoStream(uint32_t &timerPeriodNs, uint32_t &oaBufferSize); + ze_result_t waitForReports(const uint32_t timeoutMs); + ze_result_t readIoStream(uint32_t &reportCount, uint8_t &reportData); + ze_result_t closeIoStream(); std::vector &getMetricGroups(); + ze_result_t streamerOpen( + zet_context_handle_t hContext, + zet_device_handle_t hDevice, + zet_metric_streamer_desc_t *desc, + ze_event_handle_t hNotificationEvent, + zet_metric_streamer_handle_t *phMetricStreamer) override; + + ze_result_t metricQueryPoolCreate( + zet_context_handle_t hContext, + zet_device_handle_t hDevice, + const zet_metric_query_pool_desc_t *desc, + zet_metric_query_pool_handle_t *phMetricQueryPool) override; + static MetricGroup *create(zet_metric_group_properties_t &properties, + MetricsDiscovery::IMetricSet_1_5 &metricSet, + MetricsDiscovery::IConcurrentGroup_1_5 &concurrentGroup, + const std::vector &metrics, + MetricSource &metricSource); + static zet_metric_group_properties_t getProperties(const zet_metric_group_handle_t handle); + uint32_t getRawReportSize(); protected: void copyProperties(const zet_metric_group_properties_t &source, @@ -134,6 +151,10 @@ struct OaMetricGroupImp : MetricGroup { std::vector metricGroups; OaMetricSourceImp *metricSource; + + private: + ze_result_t openForDevice(Device *pDevice, zet_metric_streamer_desc_t &desc, + zet_metric_streamer_handle_t *phMetricStreamer); }; struct OaMetricImp : Metric { diff --git a/level_zero/tools/source/metrics/metric_query_imp.cpp b/level_zero/tools/source/metrics/metric_query_imp.cpp index eb421a826f91a..856fc696ab138 100644 --- a/level_zero/tools/source/metrics/metric_query_imp.cpp +++ b/level_zero/tools/source/metrics/metric_query_imp.cpp @@ -395,7 +395,7 @@ ConfigurationHandle_1_0 MetricsLibrary::addConfiguration(zet_metric_group_handle // Create metrics library configuration. auto metricGroup = MetricGroup::fromHandle(handle); - auto properties = MetricGroup::getProperties(handle); + auto properties = OaMetricGroupImp::getProperties(handle); auto configuration = createConfiguration(metricGroup, properties); // Cache configuration if valid. @@ -421,9 +421,17 @@ void MetricsLibrary::deleteAllConfigurations() { configurations.clear(); } -ze_result_t metricQueryPoolCreate(zet_context_handle_t hContext, zet_device_handle_t hDevice, zet_metric_group_handle_t hMetricGroup, - const zet_metric_query_pool_desc_t *pDesc, zet_metric_query_pool_handle_t *phMetricQueryPool) { +ze_result_t OaMetricGroupImp::metricQueryPoolCreate( + zet_context_handle_t hContext, + zet_device_handle_t hDevice, + const zet_metric_query_pool_desc_t *desc, + zet_metric_query_pool_handle_t *phMetricQueryPool) { + + return OaMetricQueryPoolImp::metricQueryPoolCreate(hContext, hDevice, toHandle(), desc, phMetricQueryPool); +} +ze_result_t OaMetricQueryPoolImp::metricQueryPoolCreate(zet_context_handle_t hContext, zet_device_handle_t hDevice, zet_metric_group_handle_t hMetricGroup, + const zet_metric_query_pool_desc_t *pDesc, zet_metric_query_pool_handle_t *phMetricQueryPool) { auto device = Device::fromHandle(hDevice); auto &metricSource = device->getMetricDeviceContext().getMetricSource(); @@ -440,6 +448,7 @@ ze_result_t metricQueryPoolCreate(zet_context_handle_t hContext, zet_device_hand if (metricSource.isImplicitScalingCapable()) { auto emptyMetricGroups = std::vector(); + auto &metricGroups = hMetricGroup ? static_cast(MetricGroup::fromHandle(hMetricGroup))->getMetricGroups() : emptyMetricGroups; @@ -498,6 +507,17 @@ ze_result_t metricQueryPoolCreate(zet_context_handle_t hContext, zet_device_hand return ZE_RESULT_SUCCESS; } +ze_result_t metricQueryPoolCreate(zet_context_handle_t hContext, zet_device_handle_t hDevice, zet_metric_group_handle_t hMetricGroup, + const zet_metric_query_pool_desc_t *pDesc, zet_metric_query_pool_handle_t *phMetricQueryPool) { + + if (pDesc->type == ZET_METRIC_QUERY_POOL_TYPE_EXECUTION) { + return OaMetricQueryPoolImp::metricQueryPoolCreate(hContext, hDevice, hMetricGroup, pDesc, phMetricQueryPool); + } else { + UNRECOVERABLE_IF(hMetricGroup == nullptr); + return MetricGroup::fromHandle(hMetricGroup)->metricQueryPoolCreate(hContext, hDevice, pDesc, phMetricQueryPool); + } +} + OaMetricQueryPoolImp::OaMetricQueryPoolImp(OaMetricSourceImp &metricSourceInput, zet_metric_group_handle_t hEventMetricGroupInput, const zet_metric_query_pool_desc_t &poolDescription) @@ -584,7 +604,7 @@ bool OaMetricQueryPoolImp::allocateGpuMemory() { bool OaMetricQueryPoolImp::createMetricQueryPool() { // Validate metric group query - only event based is supported. - auto metricGroupProperites = MetricGroup::getProperties(hMetricGroup); + auto metricGroupProperites = OaMetricGroupImp::getProperties(hMetricGroup); const bool validMetricGroup = metricGroupProperites.samplingType == ZET_METRIC_GROUP_SAMPLING_TYPE_FLAG_EVENT_BASED; if (!validMetricGroup) { diff --git a/level_zero/tools/source/metrics/metric_query_imp.h b/level_zero/tools/source/metrics/metric_query_imp.h index f78c0eba4d24f..a2293db2dfed7 100644 --- a/level_zero/tools/source/metrics/metric_query_imp.h +++ b/level_zero/tools/source/metrics/metric_query_imp.h @@ -151,6 +151,9 @@ struct OaMetricQueryPoolImp : MetricQueryPool { std::vector &getMetricQueryPools(); + static ze_result_t metricQueryPoolCreate(zet_context_handle_t hContext, zet_device_handle_t hDevice, zet_metric_group_handle_t hMetricGroup, + const zet_metric_query_pool_desc_t *pDesc, zet_metric_query_pool_handle_t *phMetricQueryPool); + protected: bool createMetricQueryPool(); bool createSkipExecutionQueryPool(); diff --git a/level_zero/tools/source/metrics/metric_streamer_imp.cpp b/level_zero/tools/source/metrics/metric_streamer_imp.cpp index 2857b5ede40f7..580545a5c3a43 100644 --- a/level_zero/tools/source/metrics/metric_streamer_imp.cpp +++ b/level_zero/tools/source/metrics/metric_streamer_imp.cpp @@ -67,7 +67,7 @@ ze_result_t OaMetricStreamerImp::readData(uint32_t maxReportCount, size_t *pRawD } else { DEBUG_BREAK_IF(rawReportSize == 0); - auto metricGroup = MetricGroup::fromHandle(hMetricGroup); + auto metricGroup = static_cast(MetricGroup::fromHandle(hMetricGroup)); // Return required size if requested. if (*pRawDataSize == 0) { @@ -141,7 +141,7 @@ ze_result_t OaMetricStreamerImp::initialize(ze_device_handle_t hDevice, this->hDevice = hDevice; this->hMetricGroup = hMetricGroup; - auto metricGroup = MetricGroup::fromHandle(this->hMetricGroup); + auto metricGroup = static_cast(MetricGroup::fromHandle(this->hMetricGroup)); rawReportSize = metricGroup->getRawReportSize(); return ZE_RESULT_SUCCESS; @@ -149,7 +149,7 @@ ze_result_t OaMetricStreamerImp::initialize(ze_device_handle_t hDevice, ze_result_t OaMetricStreamerImp::startMeasurements(uint32_t ¬ifyEveryNReports, uint32_t &samplingPeriodNs) { - auto metricGroup = MetricGroup::fromHandle(hMetricGroup); + auto metricGroup = static_cast(MetricGroup::fromHandle(hMetricGroup)); uint32_t requestedOaBufferSize = getOaBufferSize(notifyEveryNReports); const ze_result_t result = metricGroup->openIoStream(samplingPeriodNs, requestedOaBufferSize); @@ -179,7 +179,7 @@ void OaMetricStreamerImp::detachEvent() { } ze_result_t OaMetricStreamerImp::stopMeasurements() { - auto metricGroup = MetricGroup::fromHandle(hMetricGroup); + auto metricGroup = static_cast(MetricGroup::fromHandle(hMetricGroup)); const ze_result_t result = metricGroup->closeIoStream(); if (result == ZE_RESULT_SUCCESS) { @@ -213,7 +213,7 @@ Event::State OaMetricStreamerImp::getNotificationState() { return Event::State::STATE_INITIAL; } - auto metricGroup = MetricGroup::fromHandle(hMetricGroup); + auto metricGroup = static_cast(MetricGroup::fromHandle(hMetricGroup)); bool reportsReady = metricGroup->waitForReports(0) == ZE_RESULT_SUCCESS; return reportsReady @@ -234,8 +234,8 @@ uint32_t OaMetricStreamerImp::getRequiredBufferSize(const uint32_t maxReportCoun : maxReportCount * rawReportSize; } -ze_result_t MetricStreamer::openForDevice(Device *pDevice, zet_metric_group_handle_t hMetricGroup, - zet_metric_streamer_desc_t &desc, zet_metric_streamer_handle_t *phMetricStreamer) { +ze_result_t OaMetricGroupImp::openForDevice(Device *pDevice, zet_metric_streamer_desc_t &desc, + zet_metric_streamer_handle_t *phMetricStreamer) { auto &metricSource = pDevice->getMetricDeviceContext().getMetricSource(); @@ -260,19 +260,20 @@ ze_result_t MetricStreamer::openForDevice(Device *pDevice, zet_metric_group_hand } // Check metric group sampling type. - auto metricGroupProperties = MetricGroup::getProperties(hMetricGroup); + zet_metric_group_properties_t metricGroupProperties = {ZET_STRUCTURE_TYPE_METRIC_GROUP_PROPERTIES}; + getProperties(&metricGroupProperties); if (metricGroupProperties.samplingType != ZET_METRIC_GROUP_SAMPLING_TYPE_FLAG_TIME_BASED) { return ZE_RESULT_ERROR_INVALID_ARGUMENT; } // Check whether metric group is activated. - if (!metricSource.isMetricGroupActivated(hMetricGroup)) { + if (!metricSource.isMetricGroupActivated(toHandle())) { return ZE_RESULT_NOT_READY; } auto pMetricStreamer = new OaMetricStreamerImp(); UNRECOVERABLE_IF(pMetricStreamer == nullptr); - pMetricStreamer->initialize(pDevice->toHandle(), hMetricGroup); + pMetricStreamer->initialize(pDevice->toHandle(), toHandle()); const ze_result_t result = pMetricStreamer->startMeasurements( desc.notifyEveryNReports, desc.samplingPeriod); @@ -288,9 +289,12 @@ ze_result_t MetricStreamer::openForDevice(Device *pDevice, zet_metric_group_hand return ZE_RESULT_SUCCESS; } -ze_result_t MetricStreamer::open(zet_context_handle_t hContext, zet_device_handle_t hDevice, zet_metric_group_handle_t hMetricGroup, - zet_metric_streamer_desc_t &desc, ze_event_handle_t hNotificationEvent, - zet_metric_streamer_handle_t *phMetricStreamer) { +ze_result_t OaMetricGroupImp::streamerOpen( + zet_context_handle_t hContext, + zet_device_handle_t hDevice, + zet_metric_streamer_desc_t *desc, + ze_event_handle_t hNotificationEvent, + zet_metric_streamer_handle_t *phMetricStreamer) { ze_result_t result = ZE_RESULT_SUCCESS; auto pDevice = Device::fromHandle(hDevice); @@ -303,12 +307,11 @@ ze_result_t MetricStreamer::open(zet_context_handle_t hContext, zet_device_handl auto &metricStreamers = pMetricStreamer->getMetricStreamers(); metricStreamers.resize(subDeviceCount); - auto metricGroupRootDevice = static_cast(MetricGroup::fromHandle(hMetricGroup)); for (uint32_t i = 0; i < subDeviceCount; i++) { - auto metricGroupsSubDevice = metricGroupRootDevice->getMetricGroups()[i]; - result = openForDevice(pDeviceImp->subDevices[i], metricGroupsSubDevice, desc, &metricStreamers[i]); + auto metricGroupsSubDevice = static_cast(MetricGroup::fromHandle(getMetricGroups()[i])); + result = metricGroupsSubDevice->openForDevice(pDeviceImp->subDevices[i], *desc, &metricStreamers[i]); if (result != ZE_RESULT_SUCCESS) { for (uint32_t j = 0; j < i; j++) { auto metricStreamerSubDevice = MetricStreamer::fromHandle(metricStreamers[j]); @@ -322,7 +325,7 @@ ze_result_t MetricStreamer::open(zet_context_handle_t hContext, zet_device_handl *phMetricStreamer = pMetricStreamer->toHandle(); } else { - result = openForDevice(pDevice, hMetricGroup, desc, phMetricStreamer); + result = openForDevice(pDevice, *desc, phMetricStreamer); } if (result == ZE_RESULT_SUCCESS) { diff --git a/level_zero/tools/test/unit_tests/sources/metrics/mock_metric_enumeration.h b/level_zero/tools/test/unit_tests/sources/metrics/mock_metric_enumeration.h index c77dccc224191..1295568d4722c 100644 --- a/level_zero/tools/test/unit_tests/sources/metrics/mock_metric_enumeration.h +++ b/level_zero/tools/test/unit_tests/sources/metrics/mock_metric_enumeration.h @@ -196,23 +196,22 @@ struct Mock : public MetricEnumeration { }; template <> -struct Mock : public MetricGroup { +struct Mock : public OaMetricGroupImp { Mock() {} - MOCK_METHOD(ze_result_t, getMetric, (uint32_t *, zet_metric_handle_t *), (override)); + MOCK_METHOD(ze_result_t, metricGet, (uint32_t *, zet_metric_handle_t *), (override)); MOCK_METHOD(ze_result_t, calculateMetricValues, (const zet_metric_group_calculation_type_t, size_t, const uint8_t *, uint32_t *, zet_typed_value_t *), (override)); MOCK_METHOD(ze_result_t, calculateMetricValuesExp, (const zet_metric_group_calculation_type_t, size_t, const uint8_t *, uint32_t *, uint32_t *, uint32_t *, zet_typed_value_t *), (override)); MOCK_METHOD(ze_result_t, getProperties, (zet_metric_group_properties_t * properties), (override)); - MOCK_METHOD(uint32_t, getRawReportSize, (), (override)); MOCK_METHOD(bool, activate, (), (override)); MOCK_METHOD(bool, deactivate, (), (override)); - MOCK_METHOD(ze_result_t, waitForReports, (const uint32_t), (override)); - MOCK_METHOD(ze_result_t, openIoStream, (uint32_t &, uint32_t &), (override)); - MOCK_METHOD(ze_result_t, readIoStream, (uint32_t &, uint8_t &), (override)); - MOCK_METHOD(ze_result_t, closeIoStream, (), (override)); zet_metric_group_handle_t getMetricGroupForSubDevice(const uint32_t subDeviceIndex) override { return nullptr; } + MOCK_METHOD(ze_result_t, waitForReports, (const uint32_t)); + MOCK_METHOD(ze_result_t, openIoStream, (uint32_t &, uint32_t &)); + MOCK_METHOD(ze_result_t, readIoStream, (uint32_t &, uint8_t &)); + MOCK_METHOD(ze_result_t, closeIoStream, ()); }; struct MetricGroupImpTest : public OaMetricGroupImp { diff --git a/level_zero/tools/test/unit_tests/sources/metrics/test_metric_query_pool_3.cpp b/level_zero/tools/test/unit_tests/sources/metrics/test_metric_query_pool_3.cpp index 3c5bcf9477727..291a3ea5ddda8 100644 --- a/level_zero/tools/test/unit_tests/sources/metrics/test_metric_query_pool_3.cpp +++ b/level_zero/tools/test/unit_tests/sources/metrics/test_metric_query_pool_3.cpp @@ -557,7 +557,6 @@ TEST_F(MultiDeviceMetricQueryPoolTest, givenFailedMetricsLibraryContextWhenZetMe } TEST_F(MultiDeviceMetricQueryPoolTest, givenExecutionQueryTypeWhenZetMetricQueryPoolCreateIsCalledThenQueryPoolIsObtained) { - zet_device_handle_t metricDevice = devices[0]->toHandle(); zet_metric_query_pool_handle_t poolHandle = {};