Skip to content

Commit

Permalink
test: Make streamer test to use concurrent metric groups (#123)
Browse files Browse the repository at this point in the history
Related-To: VLCLJ-2375

Signed-off-by: shubham kumar <[email protected]>
  • Loading branch information
shubskmr authored Jan 7, 2025
1 parent 04b3781 commit b9ec3a9
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 1 deletion.
3 changes: 3 additions & 0 deletions utils/test_harness/tools/include/test_harness_metric.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -254,6 +254,9 @@ void generate_metric_handles_list_from_param_values(
void destroy_metric_handles_list(
std::vector<zet_metric_handle_t> &metric_handles);

std::vector<zet_metric_group_handle_t> get_concurrent_metric_group(
ze_device_handle_t device,
std::vector<zet_metric_group_handle_t> &metricGroupHandleList);
}; // namespace level_zero_tests

#endif /* TEST_HARNESS_SYSMAN_METRIC_HPP */
41 changes: 40 additions & 1 deletion utils/test_harness/tools/src/test_harness_metric.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<zet_metric_group_handle_t> get_concurrent_metric_group(
ze_device_handle_t device,
std::vector<zet_metric_group_handle_t> &metricGroupHandleList) {

uint32_t concurrentGroupCount = 0;
EXPECT_EQ(ZE_RESULT_SUCCESS,
zetDeviceGetConcurrentMetricGroupsExp(
device, metricGroupHandleList.size(),
metricGroupHandleList.data(), nullptr, &concurrentGroupCount));
std::vector<uint32_t> countPerConcurrentGroup(concurrentGroupCount);
EXPECT_EQ(ZE_RESULT_SUCCESS,
zetDeviceGetConcurrentMetricGroupsExp(
device, metricGroupHandleList.size(),
metricGroupHandleList.data(), countPerConcurrentGroup.data(),
&concurrentGroupCount));

std::vector<zet_metric_group_handle_t> concurrentMetricGroupList;
uint32_t metricGroupCountInConcurrentGroup = countPerConcurrentGroup[0];

for (uint32_t i = 0; i < metricGroupCountInConcurrentGroup; i++) {
concurrentMetricGroupList.push_back(metricGroupHandleList[i]);
}
return concurrentMetricGroupList;
}

std::vector<metricGroupInfo_t> optimize_metric_group_info_list(
std::vector<metricGroupInfo_t> &metricGroupInfoList,
uint32_t percentOfMetricGroupForTest, const char *metricGroupName) {
Expand Down Expand Up @@ -271,6 +296,7 @@ get_metric_group_info(ze_device_handle_t device,
get_metric_group_handles(device);

std::vector<metricGroupInfo_t> matchedGroupsInfo;
std::vector<zet_metric_group_handle_t> concurrentMetricGroupHandles;

for (auto metricGroupHandle : metricGroupHandles) {
zet_metric_group_properties_t metricGroupProp = {};
Expand All @@ -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<metricGroupInfo_t> concurrentMatchedGroupsInfo;

for (auto groupsInfo : matchedGroupsInfo) {
if (count(concurrentMetricGroupHandles.begin(),
concurrentMetricGroupHandles.end(),
groupsInfo.metricGroupHandle)) {
concurrentMatchedGroupsInfo.push_back(groupsInfo);
}
}

return concurrentMatchedGroupsInfo;
}

std::vector<metricGroupInfo_t> get_metric_type_ip_group_info(
Expand Down

0 comments on commit b9ec3a9

Please sign in to comment.