VcDevel / Vc

SIMD Vector Classes for C++
BSD 3-Clause "New" or "Revised" License
1.45k stars 152 forks source link

vc 1.4.3 build failure #348

Open chenrui333 opened 2 years ago

chenrui333 commented 2 years ago

šŸ‘‹ trying to build the latest release, but run into some build issue. The error log is as below:

build error ``` In file included from /tmp/vc-20220529-32959-1ggh4jf/Vc-1.4.3/Vc/scalar/../common/../avx/mask.h:37: /tmp/vc-20220529-32959-1ggh4jf/Vc-1.4.3/Vc/scalar/../common/../avx/detail.h:1182:64: error: always_inline function '_mm256_testz_ps' requires target feature 'avx', but would be inlined into function 'testz' that is compiled without support for 'avx' Vc_INTRINSIC Vc_CONST int testz(__m256 a, __m256 b) { return _mm256_testz_ps(a, b); } ^ /tmp/vc-20220529-32959-1ggh4jf/Vc-1.4.3/Vc/scalar/../common/../avx/detail.h:1182:64: error: AVX vector argument of type '__m256' (vector of 8 'float' values) without 'avx' enabled changes the ABI /tmp/vc-20220529-32959-1ggh4jf/Vc-1.4.3/Vc/scalar/../common/../avx/detail.h:651:55: error: always_inline function '_mm256_and_ps' requires target feature 'avx', but would be inlined into function 'and_' that is compiled without support for 'avx' Vc_INTRINSIC __m256 and_(__m256 a, __m256 b) { return _mm256_and_ps(a, b); } ^ /tmp/vc-20220529-32959-1ggh4jf/Vc-1.4.3/Vc/scalar/../common/../avx/detail.h:651:55: error: AVX vector argument of type '__m256' (vector of 8 'float' values) without 'avx' enabled changes the ABI In file included from /tmp/vc-20220529-32959-1ggh4jf/Vc-1.4.3/build/trigonometric_AVX2+FMA+BMI2.cpp:31: In file included from /tmp/vc-20220529-32959-1ggh4jf/Vc-1.4.3/Vc/vector.h:35: In file included from /tmp/vc-20220529-32959-1ggh4jf/Vc-1.4.3/Vc/scalar/../common/../sse/vector.h:32: In file included from /tmp/vc-20220529-32959-1ggh4jf/Vc-1.4.3/Vc/scalar/../common/../sse/intrinsics.h:37: In file included from /tmp/vc-20220529-32959-1ggh4jf/Vc-1.4.3/Vc/scalar/../common/../avx/../common/storage.h:35: /tmp/vc-20220529-32959-1ggh4jf/Vc-1.4.3/Vc/scalar/../common/../sse/../avx/intrinsics.h:122:65: error: always_inline function '_mm256_broadcast_ss' requires target feature 'avx', but would be inlined into function 'setabsmask_ps' that is compiled without support for 'avx' static Vc_INTRINSIC m256 Vc_CONST setabsmask_ps() { return _mm256_broadcast_ss(reinterpret_cast(&c_general::absMaskFloat[1])); } ^ /tmp/vc-20220529-32959-1ggh4jf/Vc-1.4.3/Vc/scalar/../common/../sse/../avx/intrinsics.h:122:65: error: AVX vector return of type '__m256' (vector of 8 'float' values) without 'avx' enabled changes the ABI In file included from /tmp/vc-20220529-32959-1ggh4jf/Vc-1.4.3/build/trigonometric_AVX2+FMA+BMI2.cpp:31: In file included from /tmp/vc-20220529-32959-1ggh4jf/Vc-1.4.3/Vc/vector.h:38: In file included from /tmp/vc-20220529-32959-1ggh4jf/Vc-1.4.3/Vc/avx/vector.h:542: /tmp/vc-20220529-32959-1ggh4jf/Vc-1.4.3/Vc/scalar/../common/../avx/vector.tcc:310:14: error: always_inline function '_mm256_or_ps' requires target feature 'avx', but would be inlined into function 'setQnan' that is compiled without support for 'avx' data() = _mm256_or_ps(data(), k.dataF()); ^ /tmp/vc-20220529-32959-1ggh4jf/Vc-1.4.3/Vc/scalar/../common/../avx/vector.tcc:310:14: error: AVX vector argument of type '__m256' (vector of 8 'float' values) without 'avx' enabled changes the ABI In file included from /tmp/vc-20220529-32959-1ggh4jf/Vc-1.4.3/build/trigonometric_AVX2+FMA+BMI2.cpp:31: In file included from /tmp/vc-20220529-32959-1ggh4jf/Vc-1.4.3/Vc/vector.h:38: In file included from /tmp/vc-20220529-32959-1ggh4jf/Vc-1.4.3/Vc/avx/vector.h:36: In file included from /tmp/vc-20220529-32959-1ggh4jf/Vc-1.4.3/Vc/scalar/../common/../avx/mask.h:37: /tmp/vc-20220529-32959-1ggh4jf/Vc-1.4.3/Vc/scalar/../common/../avx/detail.h:652:58: error: always_inline function '_mm256_and_pd' requires target feature 'avx', but would be inlined into function 'and_' that is compiled without support for 'avx' Vc_INTRINSIC __m256d and_(__m256d a, __m256d b) { return _mm256_and_pd(a, b); } In file included from /tmp/vc-20220529-32959-1ggh4jf/Vc-1.4.3/Vc/avx/vector.h:31: /tmp/vc-20220529-32959-1ggh4jf/Vc-1.4.3/Vc/avx/../traits/../common/../sse/../avx/intrinsics.h:143:89: error: '__builtin_ia32_vinsertf128_ps256' needs target feature avx template Vc_INTRINSIC __m256 insert128(__m256 a, __m128 b) { return _mm256_insertf128_ps(a, b, offset); } ^ /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/13.1.6/include/avxintrin.h:4595:11: note: expanded from macro '_mm256_insertf128_ps' (__m256)__builtin_ia32_vinsertf128_ps256((__v8sf)(__m256)(V1), \ ^ In file included from /tmp/vc-20220529-32959-1ggh4jf/Vc-1.4.3/build/avx_sorthelper_AVX2+FMA+BMI2.cpp:28: In file included from /tmp/vc-20220529-32959-1ggh4jf/Vc-1.4.3/Vc/avx/vector.h:32: /tmp/vc-20220529-32959-1ggh4jf/Vc-1.4.3/Vc/avx/../traits/../common/../sse/../avx/casts.h:69:66: error: always_inline function '_mm256_castps128_ps256' requires target feature 'avx', but would be inlined into function 'avx_cast' that is compiled without support for 'avx' template<> Vc_INTRINSIC __m256 avx_cast(__m128 v) { return _mm256_castps128_ps256(v); } ^ /tmp/vc-20220529-32959-1ggh4jf/Vc-1.4.3/Vc/avx/../traits/../common/../sse/../avx/casts.h:69:66: error: AVX vector return of type '__m256' (vector of 8 'float' values) without 'avx' enabled changes the ABI /tmp/vc-20220529-32959-1ggh4jf/Vc-1.4.3/Vc/avx/../traits/../common/../sse/../avx/casts.h:98:66: error: always_inline function '_mm256_castpd256_pd128' requires target feature 'avx', but would be inlined into function 'avx_cast' that is compiled without support for 'avx' template<> Vc_INTRINSIC __m128d avx_cast(__m256d v) { return _mm256_castpd256_pd128(v); } ^ /tmp/vc-20220529-32959-1ggh4jf/Vc-1.4.3/Vc/avx/../traits/../common/../sse/../avx/casts.h:98:66: error: AVX vector argument of type '__m256d' (vector of 4 'double' values) without 'avx' enabled changes the ABI In file included from /tmp/vc-20220529-32959-1ggh4jf/Vc-1.4.3/build/avx_sorthelper_AVX2+FMA+BMI2.cpp:28: In file included from /tmp/vc-20220529-32959-1ggh4jf/Vc-1.4.3/Vc/avx/vector.h:31: /tmp/vc-20220529-32959-1ggh4jf/Vc-1.4.3/Vc/avx/../traits/../common/../sse/../avx/intrinsics.h:154:79: error: '__builtin_ia32_vextractf128_pd256' needs target feature avx template Vc_INTRINSIC __m128d extract128(__m256d a) { return _mm256_extractf128_pd(a, offset); } ^ /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/13.1.6/include/avxintrin.h:4725:12: note: expanded from macro '_mm256_extractf128_pd' (__m128d)__builtin_ia32_vextractf128_pd256((__v4df)(__m256d)(V), (int)(M)) ^ In file included from /tmp/vc-20220529-32959-1ggh4jf/Vc-1.4.3/build/avx_sorthelper_AVX2+FMA+BMI2.cpp:28: In file included from /tmp/vc-20220529-32959-1ggh4jf/Vc-1.4.3/Vc/avx/vector.h:31: /tmp/vc-20220529-32959-1ggh4jf/Vc-1.4.3/Vc/avx/../traits/../common/../sse/../avx/intrinsics.h:144:89: error: '__builtin_ia32_vinsertf128_pd256' needs target feature avx template Vc_INTRINSIC __m256d insert128(__m256d a, __m128d b) { return _mm256_insertf128_pd(a, b, offset); } ^ /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/13.1.6/include/avxintrin.h:4633:12: note: expanded from macro '_mm256_insertf128_pd' (__m256d)__builtin_ia32_vinsertf128_pd256((__v4df)(__m256d)(V1), \ ^ In file included from /tmp/vc-20220529-32959-1ggh4jf/Vc-1.4.3/build/avx_sorthelper_AVX2+FMA+BMI2.cpp:28: In file included from /tmp/vc-20220529-32959-1ggh4jf/Vc-1.4.3/Vc/avx/vector.h:32: /tmp/vc-20220529-32959-1ggh4jf/Vc-1.4.3/Vc/avx/../traits/../common/../sse/../avx/casts.h:77:66: error: always_inline function '_mm256_castpd128_pd256' requires target feature 'avx', but would be inlined into function 'avx_cast' that is compiled without support for 'avx' template<> Vc_INTRINSIC __m256d avx_cast(__m128d v) { return _mm256_castpd128_pd256(v); } ^ /tmp/vc-20220529-32959-1ggh4jf/Vc-1.4.3/Vc/avx/../traits/../common/../sse/../avx/casts.h:77:66: error: AVX vector return of type '__m256d' (vector of 4 'double' values) without 'avx' enabled changes the ABI In file included from /tmp/vc-20220529-32959-1ggh4jf/Vc-1.4.3/build/avx_sorthelper_AVX2+FMA+BMI2.cpp:28: In file included from /tmp/vc-20220529-32959-1ggh4jf/Vc-1.4.3/Vc/avx/vector.h:32: In file included from /tmp/vc-20220529-32959-1ggh4jf/Vc-1.4.3/Vc/avx/../traits/../common/../sse/../avx/casts.h:34: /tmp/vc-20220529-32959-1ggh4jf/Vc-1.4.3/Vc/avx/shuffle.h:293:20: error: '__builtin_ia32_vpermilps' needs target feature avx return _mm_permute_ps(x, Dst0 + Dst1 * 4 + Dst2 * 16 + Dst3 * 64); ^ /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/13.1.6/include/avxintrin.h:1088:11: note: expanded from macro '_mm_permute_ps' (__m128)__builtin_ia32_vpermilps((__v4sf)(__m128)(A), (int)(C)) ^ fatal error: too many errors emitted, stopping now [-ferror-limit=] 20 errors generated. ```

full build log, https://github.com/Homebrew/homebrew-core/runs/6645127976 relates to Homebrew/homebrew-core#102079

bernhardmgruber commented 2 years ago

Hi! Vc is now in maintenance mode and no longer actively developed. However, if you can provide us with a pull requests we an try to get it in.

chenrui333 commented 2 years ago

Got it, thanks!

dennisklein commented 1 year ago

I just encountered the same issue. Turns out brew's compiler wrapper script filters out any -march flags now, unless the formula opts in to not remove it. See https://github.com/Homebrew/brew/commit/0404da7ba7d22379b236c503d6a87746a848776c.

Adding this to the beginning of the install step could successfully compile Vc 1.4.3 (https://github.com/FairRootGroup/homebrew-fairsoft/commit/718bf9292e9a2b73a20b33765052c93ed93c3bfc):

def install
  ENV.runtime_cpu_detection
  #...
end
chenrui333 commented 1 year ago

I just encountered the same issue. Turns out brew's compiler wrapper script filters out any -march flags now, unless the formula opts in to not remove it. See Homebrew/brew@0404da7.

Adding this to the beginning of the install step could successfully compile Vc 1.4.3 (FairRootGroup/homebrew-fairsoft@718bf92):

def install
  ENV.runtime_cpu_detection
  #...
end

Gonna give ENV.runtime_cpu_detection a shot

chenrui333 commented 1 year ago

Got some audit failure, but the build is successful

  vc:
    * No `cpuid` instruction detected. vc should not use `ENV.runtime_cpu_detection`.
dennisklein commented 1 year ago

Got some audit failure, but the build is successful

  vc:
    * No `cpuid` instruction detected. vc should not use `ENV.runtime_cpu_detection`.

That seems to be a shortcoming of brew's Formula linter currently, which only considers dylibs and executables. However, Vc only emits a libVc.a file.

dennisklein commented 1 year ago

I guess, if you teach this code to also include libVc.a in the set of checked files, the audit will succeed: https://github.com/Homebrew/brew/blob/36d14ae49cc4cd410b0b77e7d4f01e1836fd3be8/Library/Homebrew/formula_cellar_checks.rb#L312-L316

chenrui333 commented 1 year ago

I see šŸ˜„ I will look into more this weekend