x-linux-ai: recipes-frameworks: fix build issue with onnxruntime recipe
This commit adds a patch to address a build issue with the onnxruntime recipe
when warnings are treated as errors. The issue happens due to changes in commit
19fce77a5f132c569c555e8b6a4dda1379537653 ("gcc: Fix c++: tweak for
Wrange-loop-construct") in the poky layer.
Signed-off-by: Arturo Buzarra <arturo.buzarra@digi.com>
This commit is contained in:
parent
c58b5a433f
commit
b7c15294a2
|
|
@ -0,0 +1,43 @@
|
|||
From: Arturo Buzarra <arturo.buzarra@digi.com>
|
||||
Date: Tue, 7 Jan 2025 14:03:27 +0100
|
||||
Subject: [PATCH] Use reference type to prevent copying the entire container
|
||||
|
||||
The loop variable creates a copy of each element in the container. For large or
|
||||
complex objects, this approach is costly in terms of memory and performance.
|
||||
Changing the loop variable to a reference type prevents unnecessary copying and
|
||||
improves efficiency. Additionally, this change addresses a build issue with the
|
||||
compiler when warnings are treated as errors
|
||||
|
||||
Signed-off-by: Arturo Buzarra <arturo.buzarra@digi.com>
|
||||
---
|
||||
.../optimizer/selectors_actions/selector_action_transformer.cc | 2 +-
|
||||
onnxruntime/core/session/inference_session.cc | 2 +-
|
||||
2 files changed, 2 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/onnxruntime/core/optimizer/selectors_actions/selector_action_transformer.cc b/onnxruntime/core/optimizer/selectors_actions/selector_action_transformer.cc
|
||||
index b68cbaf85b..b1d6c51f69 100644
|
||||
--- a/onnxruntime/core/optimizer/selectors_actions/selector_action_transformer.cc
|
||||
+++ b/onnxruntime/core/optimizer/selectors_actions/selector_action_transformer.cc
|
||||
@@ -147,7 +147,7 @@ static Status MatchAndProcess(
|
||||
RuntimeOptimizationRecord::ProducedOpIdVector produced_op_ids{};
|
||||
produced_op_ids.reserve(action_saved_state.produced_node_op_schemas.size());
|
||||
|
||||
- for (const auto op_schema : action_saved_state.produced_node_op_schemas) {
|
||||
+ for (const auto& op_schema : action_saved_state.produced_node_op_schemas) {
|
||||
produced_op_ids.push_back(utils::MakeOpId(*op_schema));
|
||||
if (save_context->record_produced_node_op_schema) {
|
||||
status = save_context->record_produced_node_op_schema(*op_schema);
|
||||
diff --git a/onnxruntime/core/session/inference_session.cc b/onnxruntime/core/session/inference_session.cc
|
||||
index 5eed7c5c6f..5352d69044 100644
|
||||
--- a/onnxruntime/core/session/inference_session.cc
|
||||
+++ b/onnxruntime/core/session/inference_session.cc
|
||||
@@ -899,7 +899,7 @@ common::Status InferenceSession::SaveToOrtFormat(const std::filesystem::path& fi
|
||||
ORT_RETURN_IF_ERROR(kernel_type_str_resolver.RegisterGraphNodeOpSchemas(model_->MainGraph()));
|
||||
ORT_RETURN_IF_ERROR(standalone::RegisterCustomOpNodeSchemas(kernel_type_str_resolver, model_->MainGraph()));
|
||||
|
||||
- for (const auto op_schema : saved_runtime_optimization_produced_node_op_schemas_) {
|
||||
+ for (const auto& op_schema : saved_runtime_optimization_produced_node_op_schemas_) {
|
||||
ORT_RETURN_IF_ERROR(kernel_type_str_resolver.RegisterOpSchema(*op_schema));
|
||||
}
|
||||
|
||||
--
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
# Copyright (C) 2025, Digi International Inc.
|
||||
|
||||
FILESEXTRAPATHS:prepend := "${THISDIR}/files:"
|
||||
|
||||
SRC_URI += " \
|
||||
file://0001-Use-reference-type-to-prevent-copying-the-entire-con.patch \
|
||||
"
|
||||
Loading…
Reference in New Issue