Skip to content

Conversation

@jnagi-intel
Copy link

@jnagi-intel jnagi-intel commented Jan 5, 2026

Fix for AUTO device type, to honor the ordering of the passed devices.

CVS-178131

@jnagi-intel jnagi-intel closed this Jan 5, 2026
@jnagi-intel jnagi-intel reopened this Jan 5, 2026
@jnagi-intel jnagi-intel changed the base branch from master to ovep-develop January 5, 2026 21:59
@jnagi-intel jnagi-intel force-pushed the fix-metadata-entries-traversal branch from e599630 to c6c1d5d Compare January 5, 2026 22:02
@MayureshV1 MayureshV1 requested a review from Copilot January 7, 2026 08:28
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR optimizes the device filtering logic in the perftest by reordering nested loops. The key change moves the iteration over metadata key-value pairs to the outer loop, with device iteration in the inner loop, which should improve performance when there are many devices but few filter criteria.

  • Swapped loop order: metadata key-value pairs are now iterated in the outer loop instead of the inner loop
Comments suppressed due to low confidence (1)

onnxruntime/test/perftest/ort_test_session.cc:1

  • The reordered loops now cause GetKeyValuePairs() to be called repeatedly for the same device when there are multiple filter criteria. This could be less efficient than the original code if GetKeyValuePairs() is expensive. Consider caching these values outside the outer loop or ensuring the original loop order is maintained if metadata retrieval has significant overhead.
// Copyright (c) Microsoft Corporation. All rights reserved.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@MayureshV1 MayureshV1 changed the title perftest: iterate over the metadata entries first in filter_ep_devices CVS-178131: perftest: iterate over the metadata entries first in filter_ep_devices Jan 7, 2026
auto device = ep_devices[index];
if (ep_set.find(std::string(device.EpName())) == ep_set.end())
continue;
for (const auto& kv : performance_test_config.filter_ep_device_kv_pairs) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changes look good. I would only recommend updating the usage documentation for this option to explicitly define what the expected matching order should be.

Perhaps a simple example like:
--filter_ep_devices "ov_device|NPU ov_device|CPU" means that an NPU device, if available, will be added first before one with cpu.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

updated, also skipped if the device already added.

@jnagi-intel jnagi-intel force-pushed the fix-metadata-entries-traversal branch from b8f475d to 20035c0 Compare January 9, 2026 00:42
@jnagi-intel jnagi-intel force-pushed the fix-metadata-entries-traversal branch from 20035c0 to adfee3d Compare January 9, 2026 00:44
Copy link

@MayureshV1 MayureshV1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to merge !

@MayureshV1 MayureshV1 merged commit bc3ccde into intel:ovep-develop Jan 9, 2026
3 of 5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants