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
11 changes: 8 additions & 3 deletions onnxruntime/core/providers/openvino/backend_manager.cc
Original file line number Diff line number Diff line change
Expand Up @@ -183,9 +183,13 @@ BackendManager::BackendManager(SessionContext& session_context,
}
if (session_context_.so_context_enable &&
(subgraph_context_.is_ep_ctx_ovir_encapsulated || !subgraph_context_.is_ep_ctx_graph)) {
auto status = onnxruntime::openvino_ep::BackendManager::ExportCompiledBlobAsEPCtxNode(subgraph);
if (!status.IsOK()) {
ORT_THROW(status);
if (concrete_backend_) {
auto status = onnxruntime::openvino_ep::BackendManager::ExportCompiledBlobAsEPCtxNode(subgraph);
if (!status.IsOK()) {
ORT_THROW(status);
}
} else {
ORT_THROW("[OpenVINO-EP] Cannot export compiled blob as EPCtx Node: Backend not initialized.");
}
}
}
Expand Down Expand Up @@ -660,6 +664,7 @@ void BackendManager::Compute(OrtKernelContext* context) {
}

void BackendManager::ShutdownBackendManager() {
std::unique_lock<std::mutex> lock(mutex_);
backend_map_.clear();
concrete_backend_.reset();
}
Expand Down
2 changes: 1 addition & 1 deletion onnxruntime/core/providers/openvino/backend_utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
std::transform(ort_shape.begin(), ort_shape.end(), ov_shape.begin(), [](int64_t dim) {
return dim == -1 ? ov::Dimension::dynamic() : ov::Dimension(dim);
});
return ov::PartialShape(ov_shape);
return ov::PartialShape(std::move(ov_shape));

Check notice on line 40 in onnxruntime/core/providers/openvino/backend_utils.h

View workflow job for this annotation

GitHub Actions / cpplint

[cpplint] onnxruntime/core/providers/openvino/backend_utils.h#L40

Add #include <utility> for move [build/include_what_you_use] [4]
Raw output
onnxruntime/core/providers/openvino/backend_utils.h:40:  Add #include <utility> for move  [build/include_what_you_use] [4]
}

static ort_shape_t ToOrtShape(const ov::PartialShape& ov_shape) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ BasicBackend::BasicBackend(std::unique_ptr<ONNX_NAMESPACE::ModelProto>& model_pr
// model_file_path will use so_context_file_path if the onnx_model_path_name is not available,
// especially in case of CreateSessionFormArray() where user must explicitly
// specify absolute path for so_context_file_path.
auto model_file_path = [this]() {
auto model_file_path = [this]() -> const std::filesystem::path& {
if (!session_context_.onnx_model_path_name.empty() &&
std::filesystem::exists(session_context_.onnx_model_path_name)) return session_context_.onnx_model_path_name;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ common::Status OpenVINOExecutionProvider::Compile(
fs::path metadata_file_path = context_model_file_path.parent_path() / metadata_filename;
std::ifstream file(metadata_file_path, std::ios::binary);
ORT_RETURN_IF_NOT(file, "Metadata file was not found: " + metadata_file_path.string());
shared_context_->shared_weights.metadata_filepath = metadata_file_path;
shared_context_->shared_weights.metadata_filepath = std::move(metadata_file_path);
file >> metadata;
}

Expand Down
6 changes: 3 additions & 3 deletions onnxruntime/core/providers/openvino/openvino_parser_utils.cc
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@
}

// Process each tensor definition e.g. "input_1[1..5, 2, 3..4],data[1,2,3]"
for (std::sregex_iterator i = tensor_begin; i != tensor_end; ++i) {
for (std::sregex_iterator i = std::move(tensor_begin); i != tensor_end; ++i) {
std::smatch tensor_match = *i;

// Extract tensor name and trim whitespace
Expand All @@ -165,7 +165,7 @@
auto dim_end = std::sregex_iterator();

// Process each dimension
for (std::sregex_iterator j = dim_begin; j != dim_end; ++j) {
for (std::sregex_iterator j = std::move(dim_begin); j != dim_end; ++j) {
std::smatch dim_match = *j;
std::string dim_value = dim_match[1].str();

Expand All @@ -190,7 +190,7 @@
}

// Store parsed shape in result map
parsed_shape_map[tensor_name] = ov::PartialShape(dimensions);
parsed_shape_map[tensor_name] = ov::PartialShape(std::move(dimensions));

Check notice on line 193 in onnxruntime/core/providers/openvino/openvino_parser_utils.cc

View workflow job for this annotation

GitHub Actions / cpplint

[cpplint] onnxruntime/core/providers/openvino/openvino_parser_utils.cc#L193

Add #include <utility> for move [build/include_what_you_use] [4]
Raw output
onnxruntime/core/providers/openvino/openvino_parser_utils.cc:193:  Add #include <utility> for move  [build/include_what_you_use] [4]
}

return parsed_shape_map;
Expand Down
2 changes: 1 addition & 1 deletion onnxruntime/core/providers/openvino/ov_interface.cc
Original file line number Diff line number Diff line change
Expand Up @@ -331,7 +331,7 @@ OVTensorPtr OVInferRequest::GetTensor(const std::string& input_name) {
}

std::string OVInferRequest::GetInputTensorName(uint32_t index) {
return OvExceptionBoundary([&]() {
return OvExceptionBoundary([&]() -> const std::string& {
const auto& model = ovInfReq.get_compiled_model();
return *model.input(index).get_names().begin();
},
Expand Down
4 changes: 2 additions & 2 deletions onnxruntime/core/providers/openvino/ov_interface.h
Original file line number Diff line number Diff line change
Expand Up @@ -105,8 +105,8 @@ class OVExeNetwork {

public:
explicit OVExeNetwork(ov::CompiledModel compiled_model, std::string device, bool stateful_causallm = false)
: compiled_model_obj(compiled_model), target_device(device), is_stateful_causallm(stateful_causallm) {}
OVExeNetwork() : compiled_model_obj(ov::CompiledModel()) {}
: compiled_model_obj(std::move(compiled_model)), target_device(std::move(device)), is_stateful_causallm(stateful_causallm) {}
OVExeNetwork() : compiled_model_obj(ov::CompiledModel()), is_stateful_causallm(false) {}
ov::CompiledModel& Get() { return compiled_model_obj; }
std::shared_ptr<OVInferRequest> CreateInferRequest();
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ void FuseCacheReorder(std::shared_ptr<ov::Model> ov_model,

auto input_batch = ov_model->input(main_input_name).get_partial_shape()[0];

auto beam_idx = std::make_shared<ov::opset13::Parameter>(ov::element::i32, ov::PartialShape({input_batch}));
auto beam_idx = std::make_shared<ov::opset13::Parameter>(ov::element::i32, ov::PartialShape({std::move(input_batch)}));
beam_idx->set_friendly_name("beam_idx");
beam_idx->output(0).get_tensor().add_names({"beam_idx"});
ov_model->add_parameters({beam_idx});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -512,7 +512,7 @@ struct CustomGraph {
continue;
}

auto scale_name = node->node_input_name[1]; // Scale
const auto& scale_name = node->node_input_name[1]; // Scale
auto scale_value = get_initializer_value(original_graph, scale_name);
if (scale_value / node->scale_factor < threshold) {
remove_qdq_pair(*node, removed);
Expand Down Expand Up @@ -699,7 +699,7 @@ bool scale_graph(CustomGraph& gen_graph,
if (cur_node->op_type == "QuantizeLinear" &&
cur_node->to_node[0]->op_type == "DequantizeLinear") {
needs_second_run = true;
auto scale_name = *std::next(cur_node->node_input_name.begin());
const auto& scale_name = *std::next(cur_node->node_input_name.begin());
auto scale_value = get_initializer_value(gen_graph.original_graph, scale_name);

// QDQ pair with scale over 1
Expand Down
Loading