Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Optimize Device Availability Check #604

Open
wants to merge 2 commits into
base: ovep-develop
Choose a base branch
from

Conversation

saurabhkale17
Copy link

@saurabhkale17 saurabhkale17 commented Mar 6, 2025

Description

This PR optimizes the device availability check in OVEP by removing redundant calls to get_available_devices(), which is an expensive function causing memory regression and high execution time.

Removed unnecessary get_available_devices() call in ParseDeviceType and openvino_execution_provider.cc.
Introduced a global vector to store the available devices at OVEP initialization.
The cached device list will persist throughout OVEP’s lifetime, preventing repeated calls to get_available_devices().

Motivation and Context

Performance Improvement: Avoids multiple redundant calls to get_available_devices(), reducing initialization overhead.
Memory Optimization: Prevents unnecessary memory allocations from repeated device queries.

https://jira.devtools.intel.com/browse/HAFP-2960

FYI: get_available_devices() takes approximately 300 to 350 milliseconds for each call.

@saurabhkale17 saurabhkale17 changed the title Saurabh/get devices Optimize Device Availability Check Mar 6, 2025
@saurabhkale17 saurabhkale17 marked this pull request as ready for review March 10, 2025 06:11
@saurabhkale17
Copy link
Author

Internal CI is in progress.

@@ -108,6 +108,7 @@ struct ProviderInfo {
struct SessionContext : ProviderInfo {
SessionContext(const ProviderInfo& info) : ProviderInfo{info} {}
std::vector<bool> deviceAvailableList = {true, true, true, true, true, true, true, true};
std::vector<std::string> available_devices; // this vector will be used to validate available devices thoughout OVEP lifetime

Choose a reason for hiding this comment

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

Please run cpp lint

Copy link

@sfatimar sfatimar left a comment

Choose a reason for hiding this comment

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

Please run cpp lint before merging.

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.

2 participants