From 437409c343f5c9cbfab3f4d3e8f82bab992447f4 Mon Sep 17 00:00:00 2001 From: Jan Tilly Date: Wed, 7 Sep 2022 04:14:14 +0200 Subject: [PATCH] Add DONT_VECTORIZE flag to cmake (#12169) Add DONT_VECTORIZE flag. --- cmake/CMakeLists.txt | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt index fd277da4cd..31249584f7 100644 --- a/cmake/CMakeLists.txt +++ b/cmake/CMakeLists.txt @@ -85,6 +85,7 @@ option(onnxruntime_TENSORRT_PLACEHOLDER_BUILDER "Instantiate Placeholder TensorR option(onnxruntime_ENABLE_LTO "Enable link time optimization" OFF) option(onnxruntime_CROSS_COMPILING "Cross compiling onnx runtime" OFF) option(onnxruntime_GCOV_COVERAGE "Compile with options necessary to run code coverage" OFF) +option(onnxruntime_DONT_VECTORIZE "Do not vectorize operations in Eigen" OFF) #It's preferred to turn it OFF when onnxruntime is dynamically linked to PROTOBUF. But Tensort always required the full version of protobuf. cmake_dependent_option(onnxruntime_USE_FULL_PROTOBUF "Link to libprotobuf instead of libprotobuf-lite when this option is ON" OFF "NOT onnxruntime_USE_TENSORRT" ON) @@ -518,6 +519,10 @@ if (MSVC) -DEIGEN_STRONG_INLINE=inline) endif() +if ( onnxruntime_DONT_VECTORIZE ) + add_definitions(-DEIGEN_DONT_VECTORIZE=1) +endif() + if (onnxruntime_CROSS_COMPILING) set(CMAKE_CROSSCOMPILING ON) check_cxx_compiler_flag(-Wno-error HAS_NOERROR)