Skip to content

Commit d3c8330

Browse files
RyanMetcalfeInt8ankitm3k
authored andcommitted
ovep: Add CreateProvider_V2 & call it from CreateIExecutionProvider
1 parent 796ffc6 commit d3c8330

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

onnxruntime/core/providers/openvino/openvino_provider_factory.cc

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -403,6 +403,18 @@ struct OpenVINOProviderFactory : IExecutionProviderFactory {
403403
return ov_ep;
404404
}
405405

406+
// This is called during session creation when AppendExecutionProvider_V2 is used.
407+
// This one is called because ParseProviderInfo / ParseConfigOptions, etc. are already
408+
// performed in CreateIExecutionProvider, and so provider_info_ has already been populated.
409+
std::unique_ptr<IExecutionProvider> CreateProvider_V2(const OrtSessionOptions& session_options,
410+
const OrtLogger& session_logger) {
411+
ProviderInfo provider_info = provider_info_;
412+
auto ov_ep = std::make_unique<OpenVINOExecutionProvider>(provider_info, shared_context_);
413+
ov_ep->SetLogger(reinterpret_cast<const logging::Logger*>(&session_logger));
414+
return ov_ep;
415+
}
416+
417+
406418
private:
407419
ProviderInfo provider_info_;
408420
std::shared_ptr<SharedContext> shared_context_;
@@ -538,7 +550,7 @@ struct OpenVINO_Provider : Provider {
538550

539551
// Create and return the execution provider
540552
auto factory = std::make_unique<OpenVINOProviderFactory>(pi, SharedContext::Get());
541-
ep = factory->CreateProvider(session_options, logger);
553+
ep = factory->CreateProvider_V2(session_options, logger);
542554
return Status::OK();
543555
}
544556

0 commit comments

Comments
 (0)