Skip to content

Commit ec48103

Browse files
committed
fix: block provider options for AppendExecutionProvider_V2 pass
1 parent 06fbb41 commit ec48103

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

onnxruntime/core/providers/openvino/openvino_provider_factory.cc

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

447+
// Block setting certain provider options via AppendExecutionProvider_V2
448+
const std::unordered_set<std::string> blocked_provider_keys = {
449+
"device_type", "device_id", "device_luid", "cache_dir", "precision",
450+
"context", "num_of_threads", "model_priority", "num_streams",
451+
"enable_opencl_throttling", "enable_qdq_optimizer", "disable_dynamic_shapes"
452+
};
453+
454+
for (const auto& key : blocked_provider_keys) {
455+
if (provider_options.find(key) != provider_options.end()) {
456+
return Status(common::ONNXRUNTIME, ORT_INVALID_ARGUMENT,
457+
"OpenVINO EP: Option '" + key + "' cannot be set explicitly when using AppendExecutionProvider_V2.");
458+
}
459+
}
460+
447461
// Extract device type from EP metadata
448462
const auto& device_meta_data = ep_metadata[0];
449463
auto it = device_meta_data->Entries().find("ov_device");

0 commit comments

Comments
 (0)