diff options
author | Henning Baldersheim <balder@yahoo-inc.com> | 2021-04-28 16:21:29 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-04-28 16:21:29 +0200 |
commit | 1121b538077fd8bd7957630c84565f2854b999f7 (patch) | |
tree | 887dd51712802a73ae245b1fdafbed8a8b4bcf78 /vespalib | |
parent | 7146aa115de988978f9f7d36e6030fd8e949b05c (diff) | |
parent | f794a072284bc2a9631f6144aa8bd9d264bc89a0 (diff) |
Merge pull request #17642 from vespa-engine/toregge/disable-intel-optimization-on-arm
Disable intel optimization on arm.
Diffstat (limited to 'vespalib')
-rw-r--r-- | vespalib/src/vespa/vespalib/hwaccelrated/CMakeLists.txt | 11 | ||||
-rw-r--r-- | vespalib/src/vespa/vespalib/hwaccelrated/iaccelrated.cpp | 8 |
2 files changed, 16 insertions, 3 deletions
diff --git a/vespalib/src/vespa/vespalib/hwaccelrated/CMakeLists.txt b/vespalib/src/vespa/vespalib/hwaccelrated/CMakeLists.txt index ac9d8d76074..c5797cbd432 100644 --- a/vespalib/src/vespa/vespalib/hwaccelrated/CMakeLists.txt +++ b/vespalib/src/vespa/vespalib/hwaccelrated/CMakeLists.txt @@ -1,12 +1,17 @@ # Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. + +if(CMAKE_SYSTEM_PROCESSOR STREQUAL "x86_64") + set(ACCEL_FILES "avx2.cpp" "avx512.cpp") +else() + unset(ACCEL_FILES) +endif() + vespa_add_library(vespalib_vespalib_hwaccelrated OBJECT SOURCES iaccelrated.cpp generic.cpp - avx2.cpp - avx512.cpp + ${ACCEL_FILES} DEPENDS ) -set_source_files_properties(avx.cpp PROPERTIES COMPILE_FLAGS -march=sandybridge) set_source_files_properties(avx2.cpp PROPERTIES COMPILE_FLAGS -march=haswell) set_source_files_properties(avx512.cpp PROPERTIES COMPILE_FLAGS -march=skylake-avx512) diff --git a/vespalib/src/vespa/vespalib/hwaccelrated/iaccelrated.cpp b/vespalib/src/vespa/vespalib/hwaccelrated/iaccelrated.cpp index de917c5f065..674efe75c17 100644 --- a/vespalib/src/vespa/vespalib/hwaccelrated/iaccelrated.cpp +++ b/vespalib/src/vespa/vespalib/hwaccelrated/iaccelrated.cpp @@ -2,8 +2,10 @@ #include "iaccelrated.h" #include "generic.h" +#ifdef __x86_64__ #include "avx2.h" #include "avx512.h" +#endif #include <vespa/vespalib/util/memory.h> #include <cstdio> #include <vector> @@ -26,6 +28,7 @@ public: IAccelrated::UP create() const override { return std::make_unique<GenericAccelrator>(); } }; +#ifdef __x86_64__ class Avx2Factory :public Factory{ public: IAccelrated::UP create() const override { return std::make_unique<Avx2Accelrator>(); } @@ -35,6 +38,7 @@ class Avx512Factory :public Factory{ public: IAccelrated::UP create() const override { return std::make_unique<Avx512Accelrator>(); } }; +#endif template<typename T> std::vector<T> createAndFill(size_t sz) { @@ -255,6 +259,7 @@ private: Selector::Selector() : _factory() { +#ifdef __x86_64__ __builtin_cpu_init (); if (__builtin_cpu_supports("avx512f")) { _factory = std::make_unique<Avx512Factory>(); @@ -263,6 +268,9 @@ Selector::Selector() : } else { _factory = std::make_unique<GenericFactory>(); } +#else + _factory = std::make_unique<GenericFactory>(); +#endif } } |