From b9ec3a9457ee14374c4dbbfec39bbbab85937f62 Mon Sep 17 00:00:00 2001 From: shubham kumar Date: Tue, 7 Jan 2025 13:31:16 +0530 Subject: [PATCH] test: Make streamer test to use concurrent metric groups (#123) Related-To: VLCLJ-2375 Signed-off-by: shubham kumar --- .../tools/include/test_harness_metric.hpp | 3 ++ .../tools/src/test_harness_metric.cpp | 41 ++++++++++++++++++- 2 files changed, 43 insertions(+), 1 deletion(-) diff --git a/utils/test_harness/tools/include/test_harness_metric.hpp b/utils/test_harness/tools/include/test_harness_metric.hpp index 9d0394b2..1f8b9aec 100644 --- a/utils/test_harness/tools/include/test_harness_metric.hpp +++ b/utils/test_harness/tools/include/test_harness_metric.hpp @@ -254,6 +254,9 @@ void generate_metric_handles_list_from_param_values( void destroy_metric_handles_list( std::vector &metric_handles); +std::vector get_concurrent_metric_group( + ze_device_handle_t device, + std::vector &metricGroupHandleList); }; // namespace level_zero_tests #endif /* TEST_HARNESS_SYSMAN_METRIC_HPP */ diff --git a/utils/test_harness/tools/src/test_harness_metric.cpp b/utils/test_harness/tools/src/test_harness_metric.cpp index cae944e2..9f130c14 100644 --- a/utils/test_harness/tools/src/test_harness_metric.cpp +++ b/utils/test_harness/tools/src/test_harness_metric.cpp @@ -197,6 +197,31 @@ bool check_metric_type_ip(ze_device_handle_t device, std::string groupName, return check_metric_type_ip(groupHandle, includeExpFeature); } +std::vector get_concurrent_metric_group( + ze_device_handle_t device, + std::vector &metricGroupHandleList) { + + uint32_t concurrentGroupCount = 0; + EXPECT_EQ(ZE_RESULT_SUCCESS, + zetDeviceGetConcurrentMetricGroupsExp( + device, metricGroupHandleList.size(), + metricGroupHandleList.data(), nullptr, &concurrentGroupCount)); + std::vector countPerConcurrentGroup(concurrentGroupCount); + EXPECT_EQ(ZE_RESULT_SUCCESS, + zetDeviceGetConcurrentMetricGroupsExp( + device, metricGroupHandleList.size(), + metricGroupHandleList.data(), countPerConcurrentGroup.data(), + &concurrentGroupCount)); + + std::vector concurrentMetricGroupList; + uint32_t metricGroupCountInConcurrentGroup = countPerConcurrentGroup[0]; + + for (uint32_t i = 0; i < metricGroupCountInConcurrentGroup; i++) { + concurrentMetricGroupList.push_back(metricGroupHandleList[i]); + } + return concurrentMetricGroupList; +} + std::vector optimize_metric_group_info_list( std::vector &metricGroupInfoList, uint32_t percentOfMetricGroupForTest, const char *metricGroupName) { @@ -271,6 +296,7 @@ get_metric_group_info(ze_device_handle_t device, get_metric_group_handles(device); std::vector matchedGroupsInfo; + std::vector concurrentMetricGroupHandles; for (auto metricGroupHandle : metricGroupHandles) { zet_metric_group_properties_t metricGroupProp = {}; @@ -289,12 +315,25 @@ get_metric_group_info(ze_device_handle_t device, continue; } + concurrentMetricGroupHandles.push_back(metricGroupHandle); matchedGroupsInfo.emplace_back( metricGroupHandle, metricGroupProp.name, metricGroupProp.description, metricGroupProp.domain, metricGroupProp.metricCount); } - return matchedGroupsInfo; + concurrentMetricGroupHandles = + get_concurrent_metric_group(device, concurrentMetricGroupHandles); + std::vector concurrentMatchedGroupsInfo; + + for (auto groupsInfo : matchedGroupsInfo) { + if (count(concurrentMetricGroupHandles.begin(), + concurrentMetricGroupHandles.end(), + groupsInfo.metricGroupHandle)) { + concurrentMatchedGroupsInfo.push_back(groupsInfo); + } + } + + return concurrentMatchedGroupsInfo; } std::vector get_metric_type_ip_group_info(