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)