Skip to content

Commit 62a1612

Browse files
committed
fix: map ep_metadata to device type using "ov_device" key
1 parent b0f08cd commit 62a1612

File tree

2 files changed

+15
-14
lines changed

2 files changed

+15
-14
lines changed

onnxruntime/core/providers/openvino/openvino_provider_factory.cc

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -444,24 +444,27 @@ struct OpenVINO_Provider : Provider {
444444
return Status(common::ONNXRUNTIME, ORT_EP_FAIL, "OpenVINO EP only supports one device.");
445445
}
446446

447-
ProviderInfo pi;
448-
const auto& config_options = session_options.GetConfigOptions();
449-
ParseProviderInfo(provider_options, &config_options, pi);
450-
447+
// Extract device type from EP metadata
451448
const auto& device_meta_data = ep_metadata[0];
452449
auto it = device_meta_data->Entries().find("ov_device");
453450
if (it == device_meta_data->Entries().end()) {
454451
return Status(common::ONNXRUNTIME, ORT_INVALID_ARGUMENT, "OpenVINO EP device metadata not found.");
455452
}
456-
pi.device_type = it->second;
457453

458-
/*
459-
TODO: This is where we need to perform some checking / manupulation of the session_options before
460-
they are passed into CreateProviders() below.
461-
Note: pi.device_type is getting set above, but I *think* it will just get overridden by the
462-
ParseConfigOptions() that will be done inside of CreateProvider();
463-
*/
454+
std::string metadata_device_type = it->second;
455+
456+
// If user didn't specify device_type, use the one from metadata
457+
if (provider_options.find("device_type") == provider_options.end()) {
458+
provider_options["device_type"] = metadata_device_type;
459+
}
460+
461+
// Parse provider info with the device type
462+
ProviderInfo pi;
463+
const auto& config_options = session_options.GetConfigOptions();
464+
ParseProviderInfo(provider_options, &config_options, pi);
465+
ParseConfigOptions(pi);
464466

467+
// Create and return the execution provider
465468
auto factory = std::make_unique<OpenVINOProviderFactory>(pi, SharedContext::Get());
466469
ep = factory->CreateProvider(session_options, logger);
467470
return Status::OK();

onnxruntime/core/providers/openvino/ov_factory.h

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,6 @@ struct ApiPtrs {
2020
const OrtModelEditorApi& model_editor_api;
2121
};
2222

23-
#define OVEP_PLUGIN_VERSION "0.0.0"
24-
2523
#define OVEP_DISABLE_MOVE(class_name) \
2624
class_name(class_name&&) = delete; \
2725
class_name& operator=(class_name&&) = delete;
@@ -143,7 +141,7 @@ class OpenVINOEpPluginFactory : public OrtEpFactory, public ApiPtrs {
143141
}
144142

145143
static const char* ORT_API_CALL GetVersionImpl(const OrtEpFactory*) noexcept {
146-
return OVEP_PLUGIN_VERSION;
144+
return ORT_VERSION;
147145
}
148146
};
149147

0 commit comments

Comments
 (0)