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
12 changes: 6 additions & 6 deletions onnxruntime/core/providers/openvino/backends/basic_backend.cc
Original file line number Diff line number Diff line change
Expand Up @@ -242,13 +242,13 @@ void BasicBackend::PopulateConfigValue(ov::AnyMap& device_config) {
}
}

void BasicBackend::EnableCaching() {
void BasicBackend::EnableCaching(ov::AnyMap& device_config) {
// cache_dir argument has no effect when working with an embed-mode EPContext Graph
if (subgraph_context_.is_ep_ctx_graph) return;

if (!session_context_.cache_dir.empty() && !session_context_.so_context_enable) {
LOGS_DEFAULT(INFO) << log_tag << "Enables Caching";
OVCore::Get()->SetCache(session_context_.cache_dir.string());
device_config.emplace(ov::cache_dir(session_context_.cache_dir.string()));
}
}

Expand All @@ -262,7 +262,7 @@ void BasicBackend::EnableGPUThrottling(ov::AnyMap& device_config) {
}
}

void BasicBackend::EnableStreams() {
void BasicBackend::EnableStreams(ov::AnyMap& device_config) {
// Return silently for NPU as it's currently treated as a read-only flag by the NPU plugin
// and throws an exception for the same
if (session_context_.device_type.find("NPU") != std::string::npos)
Expand All @@ -279,7 +279,7 @@ void BasicBackend::EnableStreams() {
}
// Do nothing
} else {
OVCore::Get()->SetStreams(session_context_.device_type, session_context_.num_streams);
device_config.emplace(ov::num_streams(session_context_.num_streams));
}
}

Expand All @@ -293,13 +293,13 @@ void BasicBackend::SetOVDeviceConfiguration(ov::AnyMap& device_config) {
PopulateConfigValue(device_config);

// Enable caching
EnableCaching();
EnableCaching(device_config);

// Setting OpenCL queue throttling for GPU
EnableGPUThrottling(device_config);

// Enable streams; default=1 unless overridden by user configuration
EnableStreams();
EnableStreams(device_config);

// Set the inference_num_threads property of the CPU
SetNumThreads(device_config);
Expand Down
4 changes: 2 additions & 2 deletions onnxruntime/core/providers/openvino/backends/basic_backend.h
Original file line number Diff line number Diff line change
Expand Up @@ -142,9 +142,9 @@ class BasicBackend : public IBackend {
private:
bool ValidateSubgraph(std::map<std::string, std::shared_ptr<ov::Node>>& const_outputs_map);
void PopulateConfigValue(ov::AnyMap& device_config);
void EnableCaching();
void EnableCaching(ov::AnyMap& device_config);
void EnableGPUThrottling(ov::AnyMap& device_config);
void EnableStreams();
void EnableStreams(ov::AnyMap& device_config);
void SetNumThreads(ov::AnyMap& device_config);
void SetOVDeviceConfiguration(ov::AnyMap& device_config);
void ValidateOrtDimsAgainstPartialShape(const std::vector<int64_t>& ort_dims,
Expand Down
8 changes: 0 additions & 8 deletions onnxruntime/core/providers/openvino/ov_interface.cc
Original file line number Diff line number Diff line change
Expand Up @@ -270,10 +270,6 @@ OVExeNetwork OVCore::ImportEPCtxOVIREncapsulation(std::istream& model_stream,
"Exception while Loading Network from OVIR model file: {}", model_file_path.string());
}

void OVCore::SetCache(const std::string& cache_dir_path) {
core.set_property(ov::cache_dir(cache_dir_path));
}

std::vector<std::string> OVCore::GetAvailableDevices() const {
std::vector<std::string> available_devices = core.get_available_devices();
return available_devices;
Expand Down Expand Up @@ -312,10 +308,6 @@ std::vector<std::string> OVCore::GetAvailableDevices(const std::string& device_t
return available_devices;
}

void OVCore::SetStreams(const std::string& device_type, int num_streams) {
core.set_property(device_type, {ov::num_streams(num_streams)});
}

std::shared_ptr<OVInferRequest> OVExeNetwork::CreateInferRequest() {
return OvExceptionBoundary([&]() {
auto infReq = compiled_model_obj.create_infer_request();
Expand Down
2 changes: 0 additions & 2 deletions onnxruntime/core/providers/openvino/ov_interface.h
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,6 @@ struct OVCore : WeakSingleton<OVCore> {

std::vector<std::string> GetAvailableDevices() const;
std::vector<std::string> GetAvailableDevices(const std::string& device_type) const;
void SetCache(const std::string& cache_dir_path);
void SetStreams(const std::string& device_type, int num_streams);
};

class OVExeNetwork {
Expand Down
Loading