From b0bce6eba90e88bc5e091b9cd19db189b7bcd127 Mon Sep 17 00:00:00 2001 From: Eric Crawford Date: Tue, 18 Nov 2025 10:48:12 -0800 Subject: [PATCH] CVS-175504 Fix mixing weight shared and non-shared models --- .../core/providers/openvino/onnx_ctx_model_helper.cc | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/onnxruntime/core/providers/openvino/onnx_ctx_model_helper.cc b/onnxruntime/core/providers/openvino/onnx_ctx_model_helper.cc index 8f47155d34fa1..60a461f7159f3 100644 --- a/onnxruntime/core/providers/openvino/onnx_ctx_model_helper.cc +++ b/onnxruntime/core/providers/openvino/onnx_ctx_model_helper.cc @@ -253,9 +253,14 @@ std::shared_ptr EPCtxHandler::Initialize(const std::vectorGetOrCreateActiveSharedContext(session_context.GetOutputBinPath()); + if (session_context.so_context_enable && session_context.so_share_ep_contexts) { + // We're creating a shared ep context model get or create the active context. + shared_context = shared_context_manager_->GetOrCreateActiveSharedContext(session_context.GetOutputBinPath()); + } else { + shared_context = shared_context_manager_->GetOrCreateSharedContext(session_context.GetOutputBinPath()); + } } return shared_context;