Skip to content

Conversation

@ericcraw
Copy link

Description

Fixes plugin -> bridge ep importing. Modifies stop logic to keep existing shared context alive instead of clearing it (a new shared context will be created after stop).

@ericcraw ericcraw force-pushed the single_bin_upstream_continued branch from b699a31 to eef7dba Compare November 14, 2025 22:43
@MayureshV1 MayureshV1 requested a review from Copilot November 17, 2025 18:49
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 simplifies shared context management and fixes EP context importing in the OpenVINO execution provider. The changes remove the Clear() method from shared context components and modify the stop logic to keep the existing shared context alive rather than clearing it after serialization. Additionally, it consolidates shared context handling by making EP context handler responsible for creating or retrieving the shared context during initialization.

Key Changes:

  • Removed Clear() methods from SharedContext and BinManager classes, replacing context clearing with context removal from the manager
  • Refactored EPCtxHandler::Initialize() to return a SharedContext and moved shared context creation logic from BackendManager to the EP context handler
  • Updated BackendManager to accept SharedContext& reference instead of managing it via SharedContextManager&

Reviewed Changes

Copilot reviewed 11 out of 11 changed files in this pull request and generated no comments.

Show a summary per file
File Description
ov_shared_context.h Removed Clear() method declaration; added active_context_path_ member and logic to erase context from map on clear
ov_shared_context.cc Removed Clear() method implementation
ov_bin_manager.h Removed Clear() and ShouldSerialize() method declarations; added DeserializeImpl()
ov_bin_manager.cc Removed Clear() and ShouldSerialize() implementations; simplified Serialize() logic; added error handling wrapper in Deserialize()
openvino_execution_provider.h Added shared_context_ member variable
openvino_execution_provider.cc Modified to initialize and store shared context from EPCtxHandler::Initialize(); removed Clear() call on stop
onnx_ctx_model_helper.h Changed Initialize() to return SharedContext; removed GetSharedContextForEpContextSubgraph() declaration; updated includes
onnx_ctx_model_helper.cc Implemented shared context creation/retrieval in Initialize(); removed GetSharedContextForEpContextSubgraph()
contexts.h Added GetOutputModelPath() helper; refactored GetOutputBinPath() to use it
backend_manager.h Changed to accept SharedContext& reference instead of SharedContextManager&
backend_manager.cc Removed shared context creation logic; changed member from pointer to reference

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

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.

LGTM !

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

Copilot reviewed 11 out of 11 changed files in this pull request and generated 1 comment.


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

try {
DeserializeImpl(stream, shared_context);
} catch (const std::exception& e) {
ORT_THROW(e.what(), "\nCould not deserialize binary data. This could mean the bin is corrupted or incompatible. Try re-generating ep context cache.");
Copy link

Copilot AI Nov 17, 2025

Choose a reason for hiding this comment

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

The error message construction is incorrect. ORT_THROW typically takes a single string message, but this call passes two arguments separated by a comma. This should likely be a string concatenation using + or formatting the message as a single string literal.

Suggested change
ORT_THROW(e.what(), "\nCould not deserialize binary data. This could mean the bin is corrupted or incompatible. Try re-generating ep context cache.");
ORT_THROW(std::string(e.what()) + "\nCould not deserialize binary data. This could mean the bin is corrupted or incompatible. Try re-generating ep context cache.");

Copilot uses AI. Check for mistakes.
@MayureshV1 MayureshV1 changed the title Additional single bin simplifications + fixes CVS-175504: Additional single bin simplifications + fixes for bi-directional compatibility Nov 17, 2025
@MayureshV1 MayureshV1 merged commit d951954 into intel:ovep-develop Nov 17, 2025
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.

2 participants