kfrlib / kfr

Fast, modern C++ DSP framework, FFT, Sample Rate Conversion, FIR/IIR/Biquad Filters (SSE, AVX, AVX-512, ARM NEON)
https://www.kfrlib.com
GNU General Public License v2.0
1.67k stars 256 forks source link

Build Failure [GCC] #56

Closed acxz closed 4 years ago

acxz commented 5 years ago

OS: ArchLinux GCC: 9.1 kfr: master ( 11d9a15) at the time of posting EDIT: same errors reported with the dev branch as well ( 1b4afb3) at the time of posting

I am getting the following errors: error: requested alignment is not an integer constant. This issue is very similar to #16, however, that issue was fixed for GCC 8.x, but now I am getting the same issue on GCC 9.1.

Here is a more complete sample of the output:

/home/acxz/vcs/github/acxz/kfr/include/kfr/io/impl/../../base/../simd/impl/../../base/../simd/impl/simd.hpp: In instantiation of ‘struct kfr::sse2::intrinsics::simd_array<short int, 8>’:
/home/acxz/vcs/github/acxz/kfr/include/kfr/io/impl/../../base/../simd/impl/../../base/../simd/impl/backend_generic.hpp:1118:31:   required from ‘T kfr::sse2::intrinsics::simd_get_element(kfr::sse2::intrinsics::simd<T, N1>&, std::size_t) [with T = short int; long unsigned int N = 8; kfr::sse2::intrinsics::simd<T, N1> = __vector(2) long long int; std::size_t = long unsigned int]’
/home/acxz/vcs/github/acxz/kfr/include/kfr/io/impl/../../base/../simd/impl/../../base/../simd/vec.hpp:321:50:   required from ‘constexpr kfr::sse2::vec<T, N>::value_type kfr::sse2::vec<T, N>::get(std::size_t) const [with int dummy = 0; typename std::enable_if<((dummy == 0) && cometa::compound_type_traits<T>::is_scalar), cometa::details::unique_enum_impl<318>::type>::type <anonymous> = cometa::details::unique_enum_impl<318>::value; T = short int; long unsigned int N = 8; kfr::sse2::vec<T, N>::value_type = short int; std::size_t = long unsigned int]’
/home/acxz/vcs/github/acxz/kfr/include/kfr/io/impl/../../base/../simd/impl/../../base/../simd/vec.hpp:308:107:   required from ‘constexpr kfr::sse2::vec<T, N>::value_type kfr::sse2::vec<T, N>::operator[](std::size_t) const & [with T = short int; long unsigned int N = 8; kfr::sse2::vec<T, N>::value_type = short int; std::size_t = long unsigned int]’
/home/acxz/vcs/github/acxz/kfr/include/kfr/io/impl/../../base/../simd/impl/basicoperators_generic.hpp:115:5:   required from here
/home/acxz/vcs/github/acxz/kfr/include/kfr/io/impl/../../base/../simd/impl/../../base/../simd/impl/simd.hpp:70:35: error: requested alignment is not an integer constant

Note: Clang 8.0 works fine.

gvansickle commented 5 years ago

I'm seeing almost the same thing on Fed 30, but clang 8.0.0 throws the same error. EDIT: nm, clang 8 does work, as long as you convince cmake to use it. :-/

acxz commented 5 years ago

@gvansickle If you want to use GCC take a look at the following PR: https://github.com/kfrlib/kfr/pull/46

GCC was able to compile for me, under bmanga’s branch.

Currently waiting on this PR to get merged so that we can close this issue.

dancazarin commented 4 years ago

Closed because the pull request by @bmanga has been merged. GCC9 now works fine.

dancazarin commented 4 years ago

Unfortunately, GCC9 has bug that in some cases leads to incorrect code generated for KFR DFT. The behavior depends on optimization level and target system.

bmanga commented 4 years ago

@dlevin256 can you share more information regarding the bug? Was it reported to gcc's bugzilla?

dancazarin commented 4 years ago

It affects FFT code starting from size 8 (incorrect SIMD code generated for optimized builds). The first version with this bug is 8.2.0. Last known to work is 7.4.0. Not reported yet. Minimal snippet reproducing this bug should include almost all kfr code because of complexity of FFT algorithm. Best compiler for KFR DFT is Clang (any version starting from 6.0), it generates highly optimized code and is available for all platforms maintaining binary compatibility with GCC and MSVC ABIs. Performance measurements published here are made using Clang. Some changes that make performance with other compilers better are published in WIP-4.0 branch but this does not solve GCC and MSVC bugs.

dancazarin commented 4 years ago

I'll open new issue for building DFT in GCC and MSVC.

Then we can close this one because GCC 9 support has been fixed in all areas except DFT.