From a3d98ce504071913f73d9dd4ff1d9301fa682067 Mon Sep 17 00:00:00 2001 From: Shahzad Malik Muzaffar Date: Mon, 27 Jan 2025 22:17:53 +0100 Subject: [PATCH] onnxruntime: patch needed for gcc 13.3.1 --- onnxruntime-gcc13.patch | 26 ++++++++++++++++++++++++++ onnxruntime.spec | 2 ++ 2 files changed, 28 insertions(+) create mode 100644 onnxruntime-gcc13.patch diff --git a/onnxruntime-gcc13.patch b/onnxruntime-gcc13.patch new file mode 100644 index 00000000000..63e086a24be --- /dev/null +++ b/onnxruntime-gcc13.patch @@ -0,0 +1,26 @@ +diff --git a/onnxruntime/core/optimizer/selectors_actions/selector_action_transformer.cc b/onnxruntime/core/optimizer/selectors_actions/selector_action_transformer.cc +index b68cbaf..b1d6c51 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 023cbcb..8fc17f0 100644 +--- a/onnxruntime/core/session/inference_session.cc ++++ b/onnxruntime/core/session/inference_session.cc +@@ -907,7 +907,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)); + } + diff --git a/onnxruntime.spec b/onnxruntime.spec index e9a4a062796..58fc73b570f 100644 --- a/onnxruntime.spec +++ b/onnxruntime.spec @@ -5,6 +5,7 @@ %define branch cms/v%{realversion} %define tag efe7f6a3859bedbad40a2991480be4e7584b1582 Source: git+https://github.com/%{github_user}/%{n}.git?obj=%{branch}/%{tag}&export=%{n}-%{realversion}&submodules=1&output=/%{n}-%{realversion}.tgz +Patch0: onnxruntime-gcc13 BuildRequires: cmake ninja Requires: protobuf py3-numpy py3-wheel py3-onnx zlib libpng py3-pybind11 re2 @@ -12,6 +13,7 @@ Requires: protobuf py3-numpy py3-wheel py3-onnx zlib libpng py3-pybind11 re2 %prep %setup -q -n %{n}-%{realversion} +%patch0 -p1 %build rm -rf ../build; mkdir ../build; cd ../build