meta-digi/meta-digi-dey/dynamic-layers/x-linux-ai/recipes-frameworks/onnxruntime/files/0005-onnxruntime-avoid-usin...

59 lines
2.5 KiB
Diff
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

From 8195a2404f122d25814b851cd738cf0ff1e91d89 Mon Sep 17 00:00:00 2001
From: Othmane AHL ZOUAOUI <othmane.ahlzouaoui@st.com>
Date: Wed, 10 May 2023 10:39:00 +0200
Subject: [PATCH 5/5] onnxruntime: avoid using unsupported Eigen headers
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
This patch removes the suspected Unsupported/Eigen/CXX11 headers and
uses Onnx internal headers instead. It enables also the pragma for
HAS_CLASS_MEMACCESS to treat the class-memaccess as warnings.
This allows fixing the following build error: void* memcpy(void*,
const void*, size_t) copying an object of non-trivial type
Eigen::internal::Packet4c{aka const signed char}
[-Werror=class-memaccess]
Signed-off-by: Othmane AHL ZOUAOUI <othmane.ahlzouaoui@st.com>
%% original patch: 0006-onnxruntime-avoid-using-unsupported-Eigen-headers.patch
---
onnxruntime/test/onnx/microbenchmark/eigen.cc | 15 ++++++++++++---
1 file changed, 12 insertions(+), 3 deletions(-)
diff --git a/onnxruntime/test/onnx/microbenchmark/eigen.cc b/onnxruntime/test/onnx/microbenchmark/eigen.cc
index b3b2c55600..00c317da50 100644
--- a/onnxruntime/test/onnx/microbenchmark/eigen.cc
+++ b/onnxruntime/test/onnx/microbenchmark/eigen.cc
@@ -6,6 +6,13 @@
#pragma GCC diagnostic ignored "-Wunused-parameter"
#pragma GCC diagnostic ignored "-Wunused-result"
#pragma GCC diagnostic ignored "-Wmaybe-uninitialized"
+// cmake/external/eigen/unsupported/Eigen/CXX11/../../../Eigen/src/Core/arch/NEON/PacketMath.h:1633:9:
+// error: void* memcpy(void*, const void*, size_t) copying an object of non-trivial type Eigen::internal::Packet4c
+// {aka struct Eigen::internal::eigen_packet_wrapper<int, 2>} from an array of const int8_t
+// {aka const signed char} [-Werror=class-memaccess]
+#ifdef HAS_CLASS_MEMACCESS
+#pragma GCC diagnostic ignored "-Wclass-memaccess"
+#endif
#elif defined(_MSC_VER)
// build\windows\debug\external\eigen3\unsupported\eigen\cxx11\src/Tensor/Tensor.h(76):
// warning C4554: '&': check operator precedence for possible error; use parentheses to clarify precedence
@@ -22,9 +29,11 @@
#define EIGEN_USE_THREADS
#endif
-#include <unsupported/Eigen/CXX11/ThreadPool>
-#include <unsupported/Eigen/CXX11/Tensor>
-#include <unsupported/Eigen/CXX11/src/Tensor/TensorDeviceThreadPool.h>
+#include "core/platform/threadpool.h"
+#include "core/common/eigen_common_wrapper.h"
+#include "core/util/thread_utils.h"
+#include <benchmark/benchmark.h>
+
#if defined(__GNUC__)
#pragma GCC diagnostic pop
#elif defined(_MSC_VER)
--
2.25.1