From 79d3833020cc63097b42a2e24c89281fd00bedcd Mon Sep 17 00:00:00 2001 From: "Bagria, Narendra" Date: Thu, 31 Oct 2024 03:26:38 +0530 Subject: [PATCH 1/3] fix: update metric tests Related to VLCLJ-2321 Signed-off-by: Bagria, Narendra --- .../tools/metrics/src/test_metric.cpp | 40 ++++++++++----- .../tools/src/test_harness_metric.cpp | 51 +++++++++++++------ 2 files changed, 62 insertions(+), 29 deletions(-) diff --git a/conformance_tests/tools/metrics/src/test_metric.cpp b/conformance_tests/tools/metrics/src/test_metric.cpp index fe924dd6..442f8082 100644 --- a/conformance_tests/tools/metrics/src/test_metric.cpp +++ b/conformance_tests/tools/metrics/src/test_metric.cpp @@ -1,6 +1,6 @@ /* * - * Copyright (C) 2020-2022 Intel Corporation + * Copyright (C) 2020-2024 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -432,17 +432,18 @@ TEST_F( class zetMetricQueryTest : public zetMetricGroupTest { protected: - zet_metric_query_pool_handle_t metricQueryPoolHandle; - zet_metric_query_handle_t metricQueryHandle; + zet_metric_query_pool_handle_t metricQueryPoolHandle{}; + zet_metric_query_handle_t metricQueryHandle{}; std::vector groupNameList; - zet_metric_group_handle_t matchedGroupHandle; + zet_metric_group_handle_t matchedGroupHandle{}; std::string groupName; - zetMetricQueryTest() { - + void zetMetricQueryInitialize() { groupNameList = lzt::get_metric_group_name_list( device, ZET_METRIC_GROUP_SAMPLING_TYPE_FLAG_EVENT_BASED, false); + ASSERT_GT(groupNameList.size(), 0u) + << "metric group name list cannot be empty"; groupName = groupNameList[0]; matchedGroupHandle = lzt::find_metric_group( @@ -454,26 +455,32 @@ class zetMetricQueryTest : public zetMetricGroupTest { metricQueryHandle = lzt::metric_query_create(metricQueryPoolHandle); } void TearDown() override { - lzt::destroy_metric_query(metricQueryHandle); - lzt::destroy_metric_query_pool(metricQueryPoolHandle); + if (metricQueryHandle != nullptr) { + lzt::destroy_metric_query(metricQueryHandle); + } + if (metricQueryPoolHandle != nullptr) { + lzt::destroy_metric_query_pool(metricQueryPoolHandle); + } } }; TEST_F( zetMetricQueryTest, GivenValidMetricQueryPoolWhenValidMetricGroupIsPassedThenExpectQueryhandle) { + zetMetricQueryInitialize(); EXPECT_NE(nullptr, metricQueryHandle); } TEST_F(zetMetricQueryTest, GivenValidMetricQueryHandleWhenResettingQueryHandleThenExpectSuccess) { + zetMetricQueryInitialize(); lzt::reset_metric_query(metricQueryHandle); } TEST_F( zetMetricQueryTest, GivenOnlyMetricQueryWhenCommandListIsCreatedThenExpectCommandListToExecuteSucessfully) { - + zetMetricQueryInitialize(); zet_command_list_handle_t commandList = lzt::create_command_list(); lzt::activate_metric_groups(device, 1, &matchedGroupHandle); lzt::append_metric_query_begin(commandList, metricQueryHandle); @@ -490,6 +497,7 @@ TEST_F( TEST_F( zetMetricQueryTest, GivenOnlyMetricQueryWithMetricMemoryBarrierWhenCommandListIsCreatedThenExpectCommandListToExecuteSucessfully) { + zetMetricQueryInitialize(); zet_command_list_handle_t commandList = lzt::create_command_list(); lzt::activate_metric_groups(device, 1, &matchedGroupHandle); lzt::append_metric_query_begin(commandList, metricQueryHandle); @@ -536,7 +544,8 @@ TEST_F( auto metricGroupInfo = lzt::get_metric_group_info( device, ZET_METRIC_GROUP_SAMPLING_TYPE_FLAG_EVENT_BASED, false); metricGroupInfo = lzt::optimize_metric_group_info_list(metricGroupInfo); - + ASSERT_GT(metricGroupInfo.size(), 0u) + << "metric group info list cannot be empty"; for (auto groupInfo : metricGroupInfo) { LOG_INFO << "test metricGroup name " << groupInfo.metricGroupName; @@ -631,7 +640,8 @@ void run_test(const ze_device_handle_t &device, device, ZET_METRIC_GROUP_SAMPLING_TYPE_FLAG_EVENT_BASED, false); metricGroupInfo = lzt::optimize_metric_group_info_list(metricGroupInfo, reset ? 1 : 20); - + ASSERT_GT(metricGroupInfo.size(), 0u) + << "metric group info list cannot be empty"; for (auto groupInfo : metricGroupInfo) { LOG_INFO << "test metricGroup name " << groupInfo.metricGroupName; @@ -802,9 +812,12 @@ void run_multi_device_query_load_test( auto metric_group_info_0 = lzt::get_metric_group_info( device_0, ZET_METRIC_GROUP_SAMPLING_TYPE_FLAG_EVENT_BASED, true); + ASSERT_GT(metric_group_info_0.size(), 0u) + << "metric group info list cannot be empty"; auto metric_group_info_1 = lzt::get_metric_group_info( device_1, ZET_METRIC_GROUP_SAMPLING_TYPE_FLAG_EVENT_BASED, true); - + ASSERT_GT(metric_group_info_1.size(), 0u) + << "metric group info list cannot be empty"; metric_group_info_0 = lzt::optimize_metric_group_info_list(metric_group_info_0); metric_group_info_1 = @@ -971,7 +984,8 @@ TEST_F( auto metricGroupInfo = lzt::get_metric_group_info( device, ZET_METRIC_GROUP_SAMPLING_TYPE_FLAG_EVENT_BASED, false); metricGroupInfo = lzt::optimize_metric_group_info_list(metricGroupInfo, 1); - + ASSERT_GT(metricGroupInfo.size(), 0u) + << "metric group info list cannot be empty"; for (auto groupInfo : metricGroupInfo) { LOG_INFO << "test metricGroup name " << groupInfo.metricGroupName; diff --git a/utils/test_harness/tools/src/test_harness_metric.cpp b/utils/test_harness/tools/src/test_harness_metric.cpp index ad5ff3f4..cb442ff9 100644 --- a/utils/test_harness/tools/src/test_harness_metric.cpp +++ b/utils/test_harness/tools/src/test_harness_metric.cpp @@ -1,6 +1,6 @@ /* * - * Copyright (C) 2019 Intel Corporation + * Copyright (C) 2019-2024 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -252,6 +252,8 @@ std::vector optimize_metric_group_info_list( LOG_INFO << "size of optimizedList based on percentage " << optimizedList.size(); + EXPECT_GT(optimizedList.size(), 0u) + << "optimized metric group info list cannot be empty"; return optimizedList; } @@ -292,7 +294,8 @@ get_metric_group_info(ze_device_handle_t device, metricGroupHandle, metricGroupProp.name, metricGroupProp.description, metricGroupProp.domain, metricGroupProp.metricCount); } - + EXPECT_GT(matchedGroupsInfo.size(), 0u) + << "metric group info list cannot be empty"; return matchedGroupsInfo; } @@ -332,7 +335,8 @@ std::vector get_metric_type_ip_group_info( metricGroupProp.domain, metricGroupProp.metricCount); continue; } - + EXPECT_GT(matchedGroupsInfo.size(), 0u) + << "metric type ip group info list cannot be empty"; return matchedGroupsInfo; } @@ -360,6 +364,8 @@ get_metric_group_name_list(ze_device_handle_t device, } groupPropName.push_back(strItem); } + EXPECT_GT(groupPropName.size(), 0u) + << "metric group name list cannot be empty"; return groupPropName; } @@ -468,11 +474,15 @@ metric_query_create(zet_metric_query_pool_handle_t metricQueryPoolHandle) { } void destroy_metric_query(zet_metric_query_handle_t metricQueryHandle) { - EXPECT_EQ(ZE_RESULT_SUCCESS, zetMetricQueryDestroy(metricQueryHandle)); + if (metricQueryHandle != nullptr) { + EXPECT_EQ(ZE_RESULT_SUCCESS, zetMetricQueryDestroy(metricQueryHandle)); + } } void reset_metric_query(zet_metric_query_handle_t &metricQueryHandle) { - EXPECT_EQ(ZE_RESULT_SUCCESS, zetMetricQueryReset(metricQueryHandle)); + if (metricQueryHandle != nullptr) { + EXPECT_EQ(ZE_RESULT_SUCCESS, zetMetricQueryReset(metricQueryHandle)); + } } size_t metric_query_get_data_size(zet_metric_query_handle_t metricQueryHandle) { @@ -580,11 +590,14 @@ void metric_streamer_read_data( } void activate_metric_groups(ze_device_handle_t device, uint32_t count, - zet_metric_group_handle_t *matchedGroupHandle) { - EXPECT_EQ(ZE_RESULT_SUCCESS, - zetContextActivateMetricGroups(lzt::get_default_context(), device, - count, matchedGroupHandle)); + zet_metric_group_handle_t *pMatchedGroupHandle) { + if (*pMatchedGroupHandle != nullptr) { + EXPECT_EQ(ZE_RESULT_SUCCESS, + zetContextActivateMetricGroups(lzt::get_default_context(), device, + count, pMatchedGroupHandle)); + } } + void deactivate_metric_groups(ze_device_handle_t device) { EXPECT_EQ(ZE_RESULT_SUCCESS, zetContextActivateMetricGroups(lzt::get_default_context(), device, @@ -593,15 +606,19 @@ void deactivate_metric_groups(ze_device_handle_t device) { void append_metric_query_begin(zet_command_list_handle_t commandList, zet_metric_query_handle_t metricQueryHandle) { - EXPECT_EQ(ZE_RESULT_SUCCESS, zetCommandListAppendMetricQueryBegin( - commandList, metricQueryHandle)); + if (metricQueryHandle != nullptr) { + EXPECT_EQ(ZE_RESULT_SUCCESS, zetCommandListAppendMetricQueryBegin( + commandList, metricQueryHandle)); + } } void append_metric_query_end(zet_command_list_handle_t commandList, zet_metric_query_handle_t metricQueryHandle, ze_event_handle_t eventHandle) { - append_metric_query_end(commandList, metricQueryHandle, eventHandle, 0, - nullptr); + if (metricQueryHandle != nullptr) { + append_metric_query_end(commandList, metricQueryHandle, eventHandle, 0, + nullptr); + } } void append_metric_query_end(zet_command_list_handle_t commandList, @@ -609,9 +626,11 @@ void append_metric_query_end(zet_command_list_handle_t commandList, ze_event_handle_t eventHandle, uint32_t numWaitEvents, ze_event_handle_t *waitEvents) { - EXPECT_EQ(ZE_RESULT_SUCCESS, zetCommandListAppendMetricQueryEnd( - commandList, metricQueryHandle, eventHandle, - numWaitEvents, waitEvents)); + if (metricQueryHandle != nullptr) { + EXPECT_EQ(ZE_RESULT_SUCCESS, zetCommandListAppendMetricQueryEnd( + commandList, metricQueryHandle, + eventHandle, numWaitEvents, waitEvents)); + } } void append_metric_memory_barrier(zet_command_list_handle_t commandList) { From 190183c2236f39e247bc475db141994a8eca5e51 Mon Sep 17 00:00:00 2001 From: "Bagria, Narendra" Date: Sat, 2 Nov 2024 02:32:58 +0530 Subject: [PATCH 2/3] fix: update metric tests Resolves: VLCLJ-2321 Signed-off-by: Bagria, Narendra --- .../tools/metrics/src/test_metric.cpp | 43 ++++++--------- .../tools/src/test_harness_metric.cpp | 52 +++++++------------ 2 files changed, 37 insertions(+), 58 deletions(-) diff --git a/conformance_tests/tools/metrics/src/test_metric.cpp b/conformance_tests/tools/metrics/src/test_metric.cpp index 442f8082..28028490 100644 --- a/conformance_tests/tools/metrics/src/test_metric.cpp +++ b/conformance_tests/tools/metrics/src/test_metric.cpp @@ -438,49 +438,42 @@ class zetMetricQueryTest : public zetMetricGroupTest { std::vector groupNameList; zet_metric_group_handle_t matchedGroupHandle{}; std::string groupName; - - void zetMetricQueryInitialize() { + void SetUp() override { groupNameList = lzt::get_metric_group_name_list( device, ZET_METRIC_GROUP_SAMPLING_TYPE_FLAG_EVENT_BASED, false); - ASSERT_GT(groupNameList.size(), 0u) - << "metric group name list cannot be empty"; + ASSERT_GT(groupNameList.size(), 0u) << "No query metric groups found"; groupName = groupNameList[0]; matchedGroupHandle = lzt::find_metric_group( device, groupName, ZET_METRIC_GROUP_SAMPLING_TYPE_FLAG_EVENT_BASED); - EXPECT_NE(nullptr, matchedGroupHandle); + ASSERT_NE(nullptr, matchedGroupHandle); metricQueryPoolHandle = lzt::create_metric_query_pool( 1000, ZET_METRIC_QUERY_POOL_TYPE_PERFORMANCE, matchedGroupHandle); - EXPECT_NE(nullptr, metricQueryPoolHandle); + ASSERT_NE(nullptr, metricQueryPoolHandle); metricQueryHandle = lzt::metric_query_create(metricQueryPoolHandle); } void TearDown() override { - if (metricQueryHandle != nullptr) { - lzt::destroy_metric_query(metricQueryHandle); - } - if (metricQueryPoolHandle != nullptr) { - lzt::destroy_metric_query_pool(metricQueryPoolHandle); - } + ASSERT_NE(nullptr, matchedGroupHandle); + lzt::destroy_metric_query(metricQueryHandle); + ASSERT_NE(nullptr, metricQueryPoolHandle); + lzt::destroy_metric_query_pool(metricQueryPoolHandle); } }; TEST_F( zetMetricQueryTest, GivenValidMetricQueryPoolWhenValidMetricGroupIsPassedThenExpectQueryhandle) { - zetMetricQueryInitialize(); EXPECT_NE(nullptr, metricQueryHandle); } TEST_F(zetMetricQueryTest, GivenValidMetricQueryHandleWhenResettingQueryHandleThenExpectSuccess) { - zetMetricQueryInitialize(); lzt::reset_metric_query(metricQueryHandle); } TEST_F( zetMetricQueryTest, GivenOnlyMetricQueryWhenCommandListIsCreatedThenExpectCommandListToExecuteSucessfully) { - zetMetricQueryInitialize(); zet_command_list_handle_t commandList = lzt::create_command_list(); lzt::activate_metric_groups(device, 1, &matchedGroupHandle); lzt::append_metric_query_begin(commandList, metricQueryHandle); @@ -497,7 +490,6 @@ TEST_F( TEST_F( zetMetricQueryTest, GivenOnlyMetricQueryWithMetricMemoryBarrierWhenCommandListIsCreatedThenExpectCommandListToExecuteSucessfully) { - zetMetricQueryInitialize(); zet_command_list_handle_t commandList = lzt::create_command_list(); lzt::activate_metric_groups(device, 1, &matchedGroupHandle); lzt::append_metric_query_begin(commandList, metricQueryHandle); @@ -543,9 +535,9 @@ TEST_F( auto metricGroupInfo = lzt::get_metric_group_info( device, ZET_METRIC_GROUP_SAMPLING_TYPE_FLAG_EVENT_BASED, false); + ASSERT_GT(metricGroupInfo.size(), 0u) << "No query metric groups found"; metricGroupInfo = lzt::optimize_metric_group_info_list(metricGroupInfo); - ASSERT_GT(metricGroupInfo.size(), 0u) - << "metric group info list cannot be empty"; + for (auto groupInfo : metricGroupInfo) { LOG_INFO << "test metricGroup name " << groupInfo.metricGroupName; @@ -638,10 +630,10 @@ void run_test(const ze_device_handle_t &device, } auto metricGroupInfo = lzt::get_metric_group_info( device, ZET_METRIC_GROUP_SAMPLING_TYPE_FLAG_EVENT_BASED, false); + ASSERT_GT(metricGroupInfo.size(), 0u) << "No query metric groups found"; metricGroupInfo = lzt::optimize_metric_group_info_list(metricGroupInfo, reset ? 1 : 20); - ASSERT_GT(metricGroupInfo.size(), 0u) - << "metric group info list cannot be empty"; + for (auto groupInfo : metricGroupInfo) { LOG_INFO << "test metricGroup name " << groupInfo.metricGroupName; @@ -812,12 +804,11 @@ void run_multi_device_query_load_test( auto metric_group_info_0 = lzt::get_metric_group_info( device_0, ZET_METRIC_GROUP_SAMPLING_TYPE_FLAG_EVENT_BASED, true); - ASSERT_GT(metric_group_info_0.size(), 0u) - << "metric group info list cannot be empty"; + ASSERT_GT(metric_group_info_0.size(), 0u) << "No query metric groups found"; auto metric_group_info_1 = lzt::get_metric_group_info( device_1, ZET_METRIC_GROUP_SAMPLING_TYPE_FLAG_EVENT_BASED, true); - ASSERT_GT(metric_group_info_1.size(), 0u) - << "metric group info list cannot be empty"; + ASSERT_GT(metric_group_info_1.size(), 0u) << "No query metric groups found"; + metric_group_info_0 = lzt::optimize_metric_group_info_list(metric_group_info_0); metric_group_info_1 = @@ -983,9 +974,9 @@ TEST_F( auto metricGroupInfo = lzt::get_metric_group_info( device, ZET_METRIC_GROUP_SAMPLING_TYPE_FLAG_EVENT_BASED, false); + ASSERT_GT(metricGroupInfo.size(), 0u) << "No query metric groups found"; metricGroupInfo = lzt::optimize_metric_group_info_list(metricGroupInfo, 1); - ASSERT_GT(metricGroupInfo.size(), 0u) - << "metric group info list cannot be empty"; + for (auto groupInfo : metricGroupInfo) { LOG_INFO << "test metricGroup name " << groupInfo.metricGroupName; diff --git a/utils/test_harness/tools/src/test_harness_metric.cpp b/utils/test_harness/tools/src/test_harness_metric.cpp index cb442ff9..00ccf285 100644 --- a/utils/test_harness/tools/src/test_harness_metric.cpp +++ b/utils/test_harness/tools/src/test_harness_metric.cpp @@ -252,8 +252,6 @@ std::vector optimize_metric_group_info_list( LOG_INFO << "size of optimizedList based on percentage " << optimizedList.size(); - EXPECT_GT(optimizedList.size(), 0u) - << "optimized metric group info list cannot be empty"; return optimizedList; } @@ -294,8 +292,7 @@ get_metric_group_info(ze_device_handle_t device, metricGroupHandle, metricGroupProp.name, metricGroupProp.description, metricGroupProp.domain, metricGroupProp.metricCount); } - EXPECT_GT(matchedGroupsInfo.size(), 0u) - << "metric group info list cannot be empty"; + return matchedGroupsInfo; } @@ -335,8 +332,7 @@ std::vector get_metric_type_ip_group_info( metricGroupProp.domain, metricGroupProp.metricCount); continue; } - EXPECT_GT(matchedGroupsInfo.size(), 0u) - << "metric type ip group info list cannot be empty"; + return matchedGroupsInfo; } @@ -364,8 +360,6 @@ get_metric_group_name_list(ze_device_handle_t device, } groupPropName.push_back(strItem); } - EXPECT_GT(groupPropName.size(), 0u) - << "metric group name list cannot be empty"; return groupPropName; } @@ -474,15 +468,13 @@ metric_query_create(zet_metric_query_pool_handle_t metricQueryPoolHandle) { } void destroy_metric_query(zet_metric_query_handle_t metricQueryHandle) { - if (metricQueryHandle != nullptr) { - EXPECT_EQ(ZE_RESULT_SUCCESS, zetMetricQueryDestroy(metricQueryHandle)); - } + ASSERT_NE(nullptr, metricQueryHandle); + EXPECT_EQ(ZE_RESULT_SUCCESS, zetMetricQueryDestroy(metricQueryHandle)); } void reset_metric_query(zet_metric_query_handle_t &metricQueryHandle) { - if (metricQueryHandle != nullptr) { - EXPECT_EQ(ZE_RESULT_SUCCESS, zetMetricQueryReset(metricQueryHandle)); - } + ASSERT_NE(nullptr, metricQueryHandle); + EXPECT_EQ(ZE_RESULT_SUCCESS, zetMetricQueryReset(metricQueryHandle)); } size_t metric_query_get_data_size(zet_metric_query_handle_t metricQueryHandle) { @@ -591,11 +583,10 @@ void metric_streamer_read_data( void activate_metric_groups(ze_device_handle_t device, uint32_t count, zet_metric_group_handle_t *pMatchedGroupHandle) { - if (*pMatchedGroupHandle != nullptr) { - EXPECT_EQ(ZE_RESULT_SUCCESS, - zetContextActivateMetricGroups(lzt::get_default_context(), device, - count, pMatchedGroupHandle)); - } + ASSERT_NE(nullptr, *pMatchedGroupHandle); + EXPECT_EQ(ZE_RESULT_SUCCESS, + zetContextActivateMetricGroups(lzt::get_default_context(), device, + count, pMatchedGroupHandle)); } void deactivate_metric_groups(ze_device_handle_t device) { @@ -606,19 +597,17 @@ void deactivate_metric_groups(ze_device_handle_t device) { void append_metric_query_begin(zet_command_list_handle_t commandList, zet_metric_query_handle_t metricQueryHandle) { - if (metricQueryHandle != nullptr) { - EXPECT_EQ(ZE_RESULT_SUCCESS, zetCommandListAppendMetricQueryBegin( - commandList, metricQueryHandle)); - } + ASSERT_NE(nullptr, metricQueryHandle); + EXPECT_EQ(ZE_RESULT_SUCCESS, zetCommandListAppendMetricQueryBegin( + commandList, metricQueryHandle)); } void append_metric_query_end(zet_command_list_handle_t commandList, zet_metric_query_handle_t metricQueryHandle, ze_event_handle_t eventHandle) { - if (metricQueryHandle != nullptr) { - append_metric_query_end(commandList, metricQueryHandle, eventHandle, 0, - nullptr); - } + ASSERT_NE(nullptr, metricQueryHandle); + append_metric_query_end(commandList, metricQueryHandle, eventHandle, 0, + nullptr); } void append_metric_query_end(zet_command_list_handle_t commandList, @@ -626,11 +615,10 @@ void append_metric_query_end(zet_command_list_handle_t commandList, ze_event_handle_t eventHandle, uint32_t numWaitEvents, ze_event_handle_t *waitEvents) { - if (metricQueryHandle != nullptr) { - EXPECT_EQ(ZE_RESULT_SUCCESS, zetCommandListAppendMetricQueryEnd( - commandList, metricQueryHandle, - eventHandle, numWaitEvents, waitEvents)); - } + ASSERT_NE(nullptr, metricQueryHandle); + EXPECT_EQ(ZE_RESULT_SUCCESS, zetCommandListAppendMetricQueryEnd( + commandList, metricQueryHandle, eventHandle, + numWaitEvents, waitEvents)); } void append_metric_memory_barrier(zet_command_list_handle_t commandList) { From b4182642f58c4ca4e456f4c8346464e432d3d1c7 Mon Sep 17 00:00:00 2001 From: "Bagria, Narendra" Date: Mon, 4 Nov 2024 12:44:20 +0530 Subject: [PATCH 3/3] fix: update metric tests Resolves: VLCLJ-2321 Signed-off-by: Bagria, Narendra --- conformance_tests/tools/metrics/src/test_metric.cpp | 10 ++++++---- .../test_harness/tools/include/test_harness_metric.hpp | 5 +++-- utils/test_harness/tools/src/test_harness_metric.cpp | 9 +++++---- 3 files changed, 14 insertions(+), 10 deletions(-) diff --git a/conformance_tests/tools/metrics/src/test_metric.cpp b/conformance_tests/tools/metrics/src/test_metric.cpp index 28028490..7a9d6d52 100644 --- a/conformance_tests/tools/metrics/src/test_metric.cpp +++ b/conformance_tests/tools/metrics/src/test_metric.cpp @@ -453,10 +453,12 @@ class zetMetricQueryTest : public zetMetricGroupTest { metricQueryHandle = lzt::metric_query_create(metricQueryPoolHandle); } void TearDown() override { - ASSERT_NE(nullptr, matchedGroupHandle); - lzt::destroy_metric_query(metricQueryHandle); - ASSERT_NE(nullptr, metricQueryPoolHandle); - lzt::destroy_metric_query_pool(metricQueryPoolHandle); + if (metricQueryHandle != nullptr) { + lzt::destroy_metric_query(metricQueryHandle); + } + if (metricQueryPoolHandle != nullptr) { + lzt::destroy_metric_query_pool(metricQueryPoolHandle); + } } }; diff --git a/utils/test_harness/tools/include/test_harness_metric.hpp b/utils/test_harness/tools/include/test_harness_metric.hpp index 25ce77e5..ced99adf 100644 --- a/utils/test_harness/tools/include/test_harness_metric.hpp +++ b/utils/test_harness/tools/include/test_harness_metric.hpp @@ -103,8 +103,9 @@ size_t metric_streamer_read_data_size( void metric_streamer_read_data( zet_metric_streamer_handle_t metricStreamerHandle, std::vector *metricData); -void activate_metric_groups(ze_device_handle_t device, uint32_t count, - zet_metric_group_handle_t *matchedGroupHandle); +void activate_metric_groups( + ze_device_handle_t device, uint32_t count, + zet_metric_group_handle_t *ptr_matched_group_handle); void deactivate_metric_groups(ze_device_handle_t device); void append_metric_query_begin(zet_command_list_handle_t commandList, zet_metric_query_handle_t metricQueryHandle); diff --git a/utils/test_harness/tools/src/test_harness_metric.cpp b/utils/test_harness/tools/src/test_harness_metric.cpp index 00ccf285..33789613 100644 --- a/utils/test_harness/tools/src/test_harness_metric.cpp +++ b/utils/test_harness/tools/src/test_harness_metric.cpp @@ -581,12 +581,13 @@ void metric_streamer_read_data( rawDataSize = metricSize; } -void activate_metric_groups(ze_device_handle_t device, uint32_t count, - zet_metric_group_handle_t *pMatchedGroupHandle) { - ASSERT_NE(nullptr, *pMatchedGroupHandle); +void activate_metric_groups( + ze_device_handle_t device, uint32_t count, + zet_metric_group_handle_t *ptr_matched_group_handle) { + ASSERT_NE(nullptr, *ptr_matched_group_handle); EXPECT_EQ(ZE_RESULT_SUCCESS, zetContextActivateMetricGroups(lzt::get_default_context(), device, - count, pMatchedGroupHandle)); + count, ptr_matched_group_handle)); } void deactivate_metric_groups(ze_device_handle_t device) {