Skip to content

Commit e51c5e0

Browse files
committed
fix: pass device_type as string
1 parent 9a217ef commit e51c5e0

3 files changed

Lines changed: 6 additions & 7 deletions

File tree

onnxruntime/core/providers/openvino/backend_manager.cc

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -100,11 +100,10 @@ BackendManager::BackendManager(SessionContext& session_context,
100100
std::string exception_str =
101101
"[OpenVINO-EP] Bounded dynamic model execution using provider option reshape_input is not supported for OVEP EPContext model";
102102
ORT_THROW(exception_str);
103-
}
104-
if (subgraph_context_.is_ep_ctx_ovir_encapsulated) {
105-
model_stream = ep_ctx_handle_.GetModelBlobStream(session_context_.onnx_model_path_name.replace_extension("xml").string(), subgraph, session_context_);
103+
} if (subgraph_context_.is_ep_ctx_ovir_encapsulated) {
104+
model_stream = ep_ctx_handle_.GetModelBlobStream(session_context_.onnx_model_path_name.replace_extension("xml").string(), subgraph, session_context_.device_type);
106105
} else {
107-
model_stream = ep_ctx_handle_.GetModelBlobStream(session_context_.so_context_file_path, subgraph, session_context_);
106+
model_stream = ep_ctx_handle_.GetModelBlobStream(session_context_.so_context_file_path, subgraph, session_context_.device_type);
108107
}
109108

110109
} else {

onnxruntime/core/providers/openvino/onnx_ctx_model_helper.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ Status EPCtxHandler::AddOVEPCtxNodeToGraph(const GraphViewer& graph_viewer,
9393
return Status::OK();
9494
}
9595

96-
std::unique_ptr<ModelBlobWrapper> EPCtxHandler::GetModelBlobStream(const std::filesystem::path& so_context_file_path, const GraphViewer& graph_viewer, const SessionContext& session_context) const {
96+
std::unique_ptr<ModelBlobWrapper> EPCtxHandler::GetModelBlobStream(const std::filesystem::path& so_context_file_path, const GraphViewer& graph_viewer, const std::string& device_type) const {
9797
auto first_index = *graph_viewer.GetNodesInTopologicalOrder().begin();
9898
auto node = graph_viewer.GetNode(first_index);
9999
ORT_ENFORCE(node != nullptr);
@@ -129,7 +129,7 @@ std::unique_ptr<ModelBlobWrapper> EPCtxHandler::GetModelBlobStream(const std::fi
129129
// exported with must match the version that is currently running.
130130
native_blob_path = std::move(blob_filepath);
131131
// Skip SDK version check for NPU devices as they may use different SDK versions.
132-
if (session_context.device_type.find("NPU") == std::string::npos) {
132+
if (device_type.find("NPU") == std::string::npos) {
133133
ORT_ENFORCE((attrs.count(EP_SDK_VER) == 1) && (attrs.at(EP_SDK_VER).s() == openvino_sdk_version_),
134134
"EPCtx blob was exported / is compatible with OpenVINO SDK version " + attrs.at(EP_SDK_VER).s() +
135135
", but OpenVINO SDK version currently in use is " + openvino_sdk_version_);

onnxruntime/core/providers/openvino/onnx_ctx_model_helper.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ class EPCtxHandler {
4141
const std::string& graph_name,
4242
const bool embed_mode,
4343
std::string&& model_blob_str) const;
44-
std::unique_ptr<ModelBlobWrapper> GetModelBlobStream(const std::filesystem::path& so_context_file_path, const GraphViewer& subgraph_view, const SessionContext& session_context) const;
44+
std::unique_ptr<ModelBlobWrapper> GetModelBlobStream(const std::filesystem::path& so_context_file_path, const GraphViewer& subgraph_view, const std::string& device_type) const;
4545
InlinedVector<const Node*> GetEPCtxNodes() const;
4646
bool CheckEPCacheContextAttribute(const GraphViewer& subgraph_view, const std::string& target_attr_extn) const;
4747
std::shared_ptr<SharedContext> Initialize(const std::vector<IExecutionProvider::FusedNodeAndGraph>& fused_nodes, const SessionContext& session_context);

0 commit comments

Comments
 (0)