Skip to content

Commit

Permalink
Fix blob generation with AUTO:GPU,CPU (#553)
Browse files Browse the repository at this point in the history
* Fix blob generation with AUTO:GPU,CPU

* Remove unused variable
  • Loading branch information
preetha-intel authored and jatinwadhwa921 committed Feb 6, 2025
1 parent 1c41c1b commit 2e4318e
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 10 deletions.
12 changes: 3 additions & 9 deletions onnxruntime/core/providers/openvino/backends/basic_backend.cc
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ BasicBackend::BasicBackend(std::unique_ptr<ONNX_NAMESPACE::ModelProto>& model_pr
PopulateConfigValue(device_config);

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

// Setting OpenCL queue throttling for GPU
EnableGPUThrottling(device_config);
Expand Down Expand Up @@ -300,19 +300,13 @@ void BasicBackend::PopulateConfigValue(ov::AnyMap& device_config) {
}
}

void BasicBackend::EnableCaching(ov::AnyMap& device_config) {
void BasicBackend::EnableCaching() {
// 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";
if (session_context_.device_type.find("AUTO:GPU") != std::string::npos) {
std::pair<std::string, ov::Any> device_property;
device_property = std::make_pair("CACHE_DIR", session_context_.cache_dir);
device_config.emplace(ov::device::properties("GPU", device_property));
} else {
OVCore::SetCache(session_context_.cache_dir.string());
}
OVCore::SetCache(session_context_.cache_dir.string());
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ class BasicBackend : public IBackend {
void PopulateCompiledDirectory(std::string, std::string&, std::string&, bool&);
bool ValidateSubgraph(std::map<std::string, std::shared_ptr<ov::Node>>& const_outputs_map);
void PopulateConfigValue(ov::AnyMap& device_config);
void EnableCaching(ov::AnyMap& device_config);
void EnableCaching();
void EnableGPUThrottling(ov::AnyMap& device_config);
void EnableStreams();
void SetNumThreads(ov::AnyMap& device_config);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ std::string ParseDeviceType(const ProviderOptions& provider_options, std::string
"Select from 'CPU', 'GPU', 'NPU', 'GPU.x' where x = 0,1,2 and so on or from"
" HETERO/MULTI/AUTO options available. \n");
}
LOGS_DEFAULT(INFO) << "[OpenVINO-EP] Choosing Device: " << selected_device;
return selected_device;
} else {
std::string default_device;
Expand Down

0 comments on commit 2e4318e

Please sign in to comment.