meta-digi/meta-digi-dey/dynamic-layers/x-linux-ai/recipes-frameworks/onnxruntime/files/0004-onnxruntime-fix-imcomp...

39 lines
1.3 KiB
Diff

From 961ee9cf8510b4d9d87777105a338fa31a5d572a Mon Sep 17 00:00:00 2001
From: Othmane AHL ZOUAOUI <othmane.ahlzouaoui@st.com>
Date: Tue, 9 May 2023 14:03:04 +0200
Subject: [PATCH 4/5] onnxruntime: fix imcompatibility with compiler GCC12.2.1
bug
As stated in this issue below, the onnxruntime 14.4.0 release is
not compatible with the version 12.2.1 of the GCC cross compiler.
This patch is a workaround to fix this incompatibility bug.
Link to onnxruntime github issue:
https://github.com/microsoft/onnxruntime/issues/14981
Signed-off-by: Othmane AHL ZOUAOUI <othmane.ahlzouaoui@st.com>
%% original patch: 0004-onnxruntime-fix-imcompatibility-with-compiler-GCC12..patch
---
onnxruntime/core/providers/cpu/tensor/scatter.cc | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/onnxruntime/core/providers/cpu/tensor/scatter.cc b/onnxruntime/core/providers/cpu/tensor/scatter.cc
index 2d932dfe59..2e2f47d31f 100644
--- a/onnxruntime/core/providers/cpu/tensor/scatter.cc
+++ b/onnxruntime/core/providers/cpu/tensor/scatter.cc
@@ -340,7 +340,11 @@ Status ScatterData(
// and so on
std::vector<int64_t> dim_block_size(num_dims);
+#if __GNUC__ >= 12
+ dim_block_size[num_dims-1] = 1;
+#else
dim_block_size.back() = 1;
+#endif
if (num_dims > 1) {
// We start at num_dims - 2 because we already pre-populated
// the last element above
--
2.25.1