Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions include/onnxruntime/core/session/onnxruntime_c_api.h
Original file line number Diff line number Diff line change
Expand Up @@ -632,7 +632,6 @@ typedef struct OrtMIGraphXProviderOptions {
typedef struct OrtOpenVINOProviderOptions {
#ifdef __cplusplus
OrtOpenVINOProviderOptions() : device_type{},
enable_npu_fast_compile{},
device_id{},
num_of_threads{},
cache_dir{},
Expand All @@ -645,7 +644,6 @@ typedef struct OrtOpenVINOProviderOptions {
* Valid settings are one of: "CPU_FP32", "CPU_FP16", "GPU_FP32", "GPU_FP16"
*/
const char* device_type;
unsigned char enable_npu_fast_compile; ///< 0 = disabled, nonzero = enabled
const char* device_id;
size_t num_of_threads; ///< 0 = Use default number of threads
const char* cache_dir; // path is set to empty by default
Expand Down
1 change: 0 additions & 1 deletion onnxruntime/core/providers/openvino/contexts.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ namespace openvino_ep {
struct GlobalContext {
OVCore ie_core;
bool is_wholly_supported_graph = false;
bool enable_npu_fast_compile = false;
bool enable_opencl_throttling = false;
bool disable_dynamic_shapes = false;
bool ep_context_embed_mode = true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ OpenVINOExecutionProvider::OpenVINOExecutionProvider(const OpenVINOExecutionProv
global_context_ = std::make_unique<openvino_ep::GlobalContext>();
global_context_->device_type = info.device_type_;
global_context_->precision_str = info.precision_;
global_context_->enable_npu_fast_compile = info.enable_npu_fast_compile_;
global_context_->cache_dir = info.cache_dir_;
global_context_->load_config = info.load_config_;
global_context_->model_priority = info.model_priority_;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,6 @@ static std::vector<std::string> parseDevices(const std::string& device_string,
struct OpenVINOExecutionProviderInfo {
std::string device_type_{""};
std::string precision_{""};
bool enable_npu_fast_compile_{false};
size_t num_of_threads_{0};
std::string load_config_{""};
std::string cache_dir_{""};
Expand All @@ -96,15 +95,14 @@ struct OpenVINOExecutionProviderInfo {
OpenVINOExecutionProviderInfo() = delete;

explicit OpenVINOExecutionProviderInfo(const std::string& dev_type, const std::string& precision,
bool enable_npu_fast_compile, size_t num_of_threads,
size_t num_of_threads,
const std::string& load_config, const std::string& cache_dir,
const std::string& model_priority, int num_streams,
void* context, bool enable_opencl_throttling,
bool disable_dynamic_shapes, bool export_ep_ctx_blob,
bool enable_qdq_optimizer, bool disable_cpu_fallback,
bool so_epctx_embed_mode)
: precision_(std::move(precision)),
enable_npu_fast_compile_(enable_npu_fast_compile),
num_of_threads_(num_of_threads),
load_config_(std::move(load_config)),
cache_dir_(std::move(cache_dir)),
Expand Down
25 changes: 6 additions & 19 deletions onnxruntime/core/providers/openvino/openvino_provider_factory.cc
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,13 @@
namespace onnxruntime {
struct OpenVINOProviderFactory : IExecutionProviderFactory {
OpenVINOProviderFactory(const std::string& device_type, const std::string& precision,
bool enable_npu_fast_compile, size_t num_of_threads,
size_t num_of_threads,
const std::string& load_config, const std::string& cache_dir,
const std::string& model_priority, int num_streams, void* context,
bool enable_opencl_throttling, bool disable_dynamic_shapes,
bool enable_qdq_optimizer, const ConfigOptions& config_options)
: device_type_(device_type),
precision_(precision),
enable_npu_fast_compile_(enable_npu_fast_compile),
num_of_threads_(num_of_threads),
load_config_(load_config),
cache_dir_(cache_dir),
Expand All @@ -35,7 +34,6 @@ struct OpenVINOProviderFactory : IExecutionProviderFactory {
private:
std::string device_type_;
std::string precision_;
bool enable_npu_fast_compile_;
size_t num_of_threads_;
std::string load_config_;
std::string cache_dir_;
Expand Down Expand Up @@ -71,7 +69,7 @@ std::unique_ptr<IExecutionProvider> OpenVINOProviderFactory::CreateProvider() {
}
}

OpenVINOExecutionProviderInfo info(device_type_, precision_, enable_npu_fast_compile_, num_of_threads_, load_config_,
OpenVINOExecutionProviderInfo info(device_type_, precision_, num_of_threads_, load_config_,
cache_dir_, model_priority_, num_streams_, context_, enable_opencl_throttling_,
disable_dynamic_shapes_, so_export_ep_ctx_blob, enable_qdq_optimizer_,
so_disable_cpu_fallback, so_epctx_embed_mode);
Expand Down Expand Up @@ -105,8 +103,6 @@ struct OpenVINO_Provider : Provider {
// Not setting precision will execute with optimized precision for
// best inference latency. set Precision=ACCURACY for executing models
// with input precision for best accuracy.
bool enable_npu_fast_compile = false; // [enable_npu_fast_compile]: Fast-compile may be optionally enabled to
// speeds up the model's compilation to NPU device specific format.
int num_of_threads = 0; // [num_of_threads]: Overrides the accelerator default value of number of
// threads with this value at runtime.
std::string load_config = ""; // Path to JSON file to load custom OV parameters.
Expand All @@ -123,10 +119,11 @@ struct OpenVINO_Provider : Provider {
bool enable_opencl_throttling = false; // [enable_opencl_throttling]: Enables OpenCL queue throttling for GPU
// device (Reduces CPU Utilization when using GPU)

void* context = nullptr;
bool enable_qdq_optimizer = false; // Enables QDQ pruning for efficient inference latency with NPU

bool enable_qdq_optimizer = false;
void* context = nullptr;

std::string bool_flag = "";
if (provider_options_map.find("device_type") != provider_options_map.end()) {
device_type = provider_options_map.at("device_type").c_str();

Expand Down Expand Up @@ -243,16 +240,6 @@ struct OpenVINO_Provider : Provider {
<< "Executing with num_streams=1";
}
}
std::string bool_flag = "";
if (provider_options_map.find("enable_npu_fast_compile") != provider_options_map.end()) {
bool_flag = provider_options_map.at("enable_npu_fast_compile");
if (bool_flag == "true" || bool_flag == "True")
enable_npu_fast_compile = true;
else if (bool_flag == "false" || bool_flag == "False")
enable_npu_fast_compile = false;
bool_flag = "";
}

if (provider_options_map.find("enable_opencl_throttling") != provider_options_map.end()) {
bool_flag = provider_options_map.at("enable_opencl_throttling");
if (bool_flag == "true" || bool_flag == "True")
Expand Down Expand Up @@ -292,11 +279,11 @@ struct OpenVINO_Provider : Provider {
disable_dynamic_shapes = false;
}
}
bool_flag = "";
}

return std::make_shared<OpenVINOProviderFactory>(device_type,
precision,
enable_npu_fast_compile,
num_of_threads,
load_config,
cache_dir,
Expand Down
6 changes: 0 additions & 6 deletions onnxruntime/core/session/provider_bridge_ort.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1788,12 +1788,6 @@ ProviderOptions OrtOpenVINOProviderOptionsToOrtOpenVINOProviderOptionsV2(const O
if (legacy_ov_options->device_type != nullptr)
ov_options_converted_map["device_type"] = legacy_ov_options->device_type;

if (legacy_ov_options->enable_npu_fast_compile) {
ov_options_converted_map["enable_npu_fast_compile"] = "false";
} else {
ov_options_converted_map["enable_npu_fast_compile"] = "true";
}

if (legacy_ov_options->num_of_threads != '\0')
ov_options_converted_map["num_of_threads"] = std::to_string(legacy_ov_options->num_of_threads);

Expand Down
9 changes: 0 additions & 9 deletions onnxruntime/python/onnxruntime_pybind_state.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1062,12 +1062,6 @@ std::unique_ptr<IExecutionProvider> CreateExecutionProviderInstance(
} else if (option.first == "precision") {
OV_provider_options_map[option.first] = option.second;
continue;
} else if (option.first == "enable_npu_fast_compile") {
if (!(option.second == "True" || option.second == "true" ||
option.second == "False" || option.second == "false")) {
ORT_THROW("Invalid value passed for enable_npu_fast_compile: ", option.second);
}
OV_provider_options_map[option.first] = option.second;
} else if (option.first == "enable_opencl_throttling") {
if (!(option.second == "True" || option.second == "true" ||
option.second == "False" || option.second == "false")) {
Expand Down Expand Up @@ -1112,9 +1106,6 @@ std::unique_ptr<IExecutionProvider> CreateExecutionProviderInstance(
} else if (option.first == "context") {
OV_provider_options_map[option.first] = option.second;
continue;
} else if (option.first == "export_ep_ctx_blob") {
OV_provider_options_map[option.first] = option.second;
continue;
} else if (option.first == "enable_qdq_optimizer") {
OV_provider_options_map[option.first] = option.second;
continue;
Expand Down
3 changes: 1 addition & 2 deletions onnxruntime/test/perftest/command_args_parser.cc
Original file line number Diff line number Diff line change
Expand Up @@ -76,11 +76,10 @@ namespace perftest {
"\n"
"\t [OpenVINO only] [device_type]: Overrides the accelerator hardware type and precision with these values at runtime.\n"
"\t [OpenVINO only] [device_id]: Selects a particular hardware device for inference.\n"
"\t [OpenVINO only] [enable_npu_fast_compile]: Optionally enabled to speeds up the model's compilation on NPU device targets.\n"
"\t [OpenVINO only] [num_of_threads]: Overrides the accelerator hardware type and precision with these values at runtime.\n"
"\t [OpenVINO only] [cache_dir]: Explicitly specify the path to dump and load the blobs(Model caching) or cl_cache (Kernel Caching) files feature. If blob files are already present, it will be directly loaded.\n"
"\t [OpenVINO only] [enable_opencl_throttling]: Enables OpenCL queue throttling for GPU device(Reduces the CPU Utilization while using GPU) \n"
"\t [Example] [For OpenVINO EP] -e openvino -i \"device_type|CPU enable_npu_fast_compile|true num_of_threads|5 enable_opencl_throttling|true cache_dir|\"<path>\"\"\n"
"\t [Example] [For OpenVINO EP] -e openvino -i \"device_type|CPU num_of_threads|5 enable_opencl_throttling|true cache_dir|\"<path>\"\"\n"
"\n"
"\t [QNN only] [backend_path]: QNN backend path. e.g '/folderpath/libQnnHtp.so', '/folderpath/libQnnCpu.so'.\n"
"\t [QNN only] [profiling_level]: QNN profiling level, options: 'basic', 'detailed', default 'off'.\n"
Expand Down
21 changes: 4 additions & 17 deletions onnxruntime/test/perftest/ort_test_session.cc
Original file line number Diff line number Diff line change
Expand Up @@ -795,13 +795,6 @@ select from 'TF8', 'TF16', 'UINT8', 'FLOAT', 'ITENSOR'. \n)");
ORT_THROW("[ERROR] [OpenVINO] Unsupported inference precision is selected. CPU only supports FP32 . \n");
}
}
} else if (key == "enable_npu_fast_compile") {
if (value == "true" || value == "True" ||
value == "false" || value == "False") {
ov_options[key] = value;
} else {
ORT_THROW("[ERROR] [OpenVINO] The value for the key 'enable_npu_fast_compile' should be a boolean i.e. true or false. Default value is false.\n");
}
} else if (key == "enable_opencl_throttling") {
if (value == "true" || value == "True" ||
value == "false" || value == "False") {
Expand Down Expand Up @@ -845,19 +838,13 @@ select from 'TF8', 'TF16', 'UINT8', 'FLOAT', 'ITENSOR'. \n)");
} else {
ov_options[key] = value;
}
} else if (key == "export_ep_ctx_blob") {
if (value == "true" || value == "True" ||
value == "false" || value == "False") {
ov_options[key] = value;
} else {
ORT_THROW(
"[ERROR] [OpenVINO] The value for the key 'export_ep_ctx_blob' "
"should be a boolean i.e. true or false. Default value is false.\n");
}
} else if (key == "device_memory_name") {
device_memory_name_ = std::move(value);
} else {
ORT_THROW("[ERROR] [OpenVINO] wrong key type entered. Choose from the following runtime key options that are available for OpenVINO. ['device_type', 'device_id', 'enable_npu_fast_compile', 'num_of_threads', 'load_config', 'cache_dir', 'num_streams', 'enable_opencl_throttling', 'disable_dynamic_shapes'] \n");
ORT_THROW(
"[ERROR] [OpenVINO] wrong key type entered. Choose from the following runtime key options that are available for OpenVINO."
" ['device_type', 'device_id', 'num_of_threads', 'load_config', 'cache_dir', 'num_streams', "
"'enable_opencl_throttling', 'disable_dynamic_shapes', 'enable_qdq_optimizer', 'model_priority'] \n");
}
}
session_options.AppendExecutionProvider_OpenVINO_V2(ov_options);
Expand Down
4 changes: 2 additions & 2 deletions onnxruntime/test/providers/cpu/model_tests.cc
Original file line number Diff line number Diff line change
Expand Up @@ -570,7 +570,7 @@ ::std::vector<::std::basic_string<ORTCHAR_T>> GetParameterStrings() {
ORT_TSTR("yolov3"),
ORT_TSTR("LSTM_Seq_lens_unpacked"),
ORT_TSTR("tinyyolov3"),
//ORT_TSTR("faster_rcnn"),
// ORT_TSTR("faster_rcnn"),
ORT_TSTR("mask_rcnn"),
ORT_TSTR("coreml_FNS-Candy_ImageNet"),
ORT_TSTR("tf_mobilenet_v2_1.0_224"),
Expand All @@ -581,7 +581,7 @@ ::std::vector<::std::basic_string<ORTCHAR_T>> GetParameterStrings() {
ORT_TSTR("mlperf_ssd_resnet34_1200"),
ORT_TSTR("candy"),
ORT_TSTR("cntk_simple_seg"),
//ORT_TSTR("GPT2_LM_HEAD"),
// ORT_TSTR("GPT2_LM_HEAD"),
ORT_TSTR("mlperf_ssd_mobilenet_300"),
ORT_TSTR("fp16_coreml_FNS-Candy"),
ORT_TSTR("fp16_test_tiny_yolov2"),
Expand Down