simde icon indicating copy to clipboard operation
simde copied to clipboard

Several tests fail on FreeBSD with clang-15

Open yurivict opened this issue 2 years ago • 16 comments

See the log here.

Version: 0.7.4 clang-15 FreeBSD 13.2

yurivict avatar May 07 '23 19:05 yurivict

Hello @yurivict ; thanks for the report. I've never seen SIMDe tested on FreeBSD before. Did a previous release pass the tests?

I'm seeing some SIGBUS errors, that is because FreeBSD doesn't allow unaligned reads/writes like Linus does, correct? I would accept patches to fix that, of course. And a CI config to prevent regressions.

mr-c avatar May 07 '23 23:05 mr-c

simde-0.7.2 had fewer failures:

  7/874 x86/avx512/abs/emul/c              ERROR           0.39s   killed by signal 11 SIGSEGV
  8/874 x86/avx512/abs/native/c            ERROR           0.28s   killed by signal 11 SIGSEGV
  9/874 x86/avx512/abs/emul/cpp            ERROR           0.90s   killed by signal 11 SIGSEGV
 10/874 x86/avx512/abs/native/cpp          ERROR           0.86s   killed by signal 11 SIGSEGV
371/874 arm/neon/abs/emul/c                ERROR           0.81s   killed by signal 11 SIGSEGV
373/874 arm/neon/abs/emul/cpp              ERROR           0.59s   killed by signal 11 SIGSEGV

So this is a regression.

yurivict avatar May 08 '23 00:05 yurivict

I'm seeing some SIGBUS errors, that is because FreeBSD doesn't allow unaligned reads/writes like Linus does, correct?

No, FreeBSD allows unaligned reads just like Linux does.

yurivict avatar May 08 '23 00:05 yurivict

Hmm.. I'm not able to reproduce using a VM: https://github.com/mr-c/simde/actions/runs/4918777831/jobs/8785545316#step:3:7057

Maybe you can correct my configuration to reproduce what you are seeing: https://github.com/mr-c/simde/blob/ci/gha/freebsd/.github/workflows/ci.yml#L36

mr-c avatar May 08 '23 19:05 mr-c

In a VM please have an updated ports tree:

git clone https://git.FreeBSD.org/ports.git /usr/ports

Then:

  1. cd /usr/ports/devel/simde
  2. make test

This should reproduce the problem.

yurivict avatar May 08 '23 20:05 yurivict

@yurivict Thanks. make test tried to build the ninja package from source, which failed, so I'll try again using the binary package for meson and its dependencies

https://github.com/mr-c/simde/actions/runs/4922970383/jobs/8794277813#step:3:5370

mr-c avatar May 09 '23 07:05 mr-c

Seems that VM is FreeBSD 13.1 which is using clang-13 which has extra complaints https://github.com/mr-c/simde/actions/runs/4923301187/jobs/8794964385#step:2:1588

Trying again with -Wno-pass-failed: https://github.com/mr-c/simde/actions/runs/4923955421/jobs/8796401951

mr-c avatar May 09 '23 08:05 mr-c

https://github.com/mr-c/simde/actions/runs/4923955421/jobs/8796401951 has a couple "emul" tests failing, but those can be skipped.

@yurivict can you try changing the test command to be something like meson test -C _build --print-errorlogs $(meson test -C _build --list | grep -v emul) ?

mr-c avatar May 09 '23 17:05 mr-c

Any other failures appear to be compiler regressions, so I would have to encourage you to file bugs with the clang people, or try -O2 instead.

mr-c avatar May 09 '23 17:05 mr-c

@yurivict As show in https://github.com/simd-everywhere/simde/actions/runs/5143791700/jobs/9259255771?pr=1034#step:2:5440 the only failing tests are "emul" tests, when we disable the use of native intrinsincs on the target architecture. As that does not represent real-world usage of SIMDe, I recommend that you skip all those tests: meson test -C _build --print-errorlogs $(meson test -C _build --list | grep -v emul)

Please let me know when the port is updated and I'll merge #1034 to add freebsd to our test matrix

mr-c avatar Jun 01 '23 12:06 mr-c

@yurivict FYI: We got Travis CI working again, and they support testing on FreeBSD 12.1, but I'm guessing that version of FreeBSD is a too old to be useful for CI?

https://docs.travis-ci.com/user/reference/freebsd/

mr-c avatar Jun 03 '23 08:06 mr-c

The FreeBSD version should be 13.2

yurivict avatar Jun 04 '23 16:06 yurivict

@yurivict Can you test again using version 0.8.0-rc2 of SIMDe ? https://github.com/simd-everywhere/simde/releases/tag/v0.8.0-rc2

mr-c avatar Mar 07 '24 15:03 mr-c

In 0.8.2 tasts fail to link:

FAILED: test/x86/avx512/round-emul-c 
cc  -o test/x86/avx512/round-emul-c test/x86/avx512/round-emul-c.p/round.c.o -Wl,--as-needed -Wl,--no-undefined -lm
ld: error: undefined symbol: roundevenf
>>> referenced by round.c
>>>               test/x86/avx512/round-emul-c.p/round.c.o:(test_simde_x_mm512_round_ps)
>>> referenced by round.c
>>>               test/x86/avx512/round-emul-c.p/round.c.o:(test_simde_x_mm512_round_ps)
>>> referenced by round.c
>>>               test/x86/avx512/round-emul-c.p/round.c.o:(test_simde_x_mm512_round_ps)
>>> referenced 1 more times

ld: error: undefined symbol: roundeven
>>> referenced by round.c
>>>               test/x86/avx512/round-emul-c.p/round.c.o:(test_simde_x_mm512_round_pd)
>>> referenced by round.c
>>>               test/x86/avx512/round-emul-c.p/round.c.o:(test_simde_x_mm512_round_pd)
>>> referenced by round.c
>>>               test/x86/avx512/round-emul-c.p/round.c.o:(test_simde_x_mm512_round_pd)
>>> referenced 1 more times

FreeBSD 14.0

yurivict avatar May 03 '24 08:05 yurivict

I am currently experiencing the same problem while building with Clang-Cl on Windows (Clang 17.0.3 with MSVC-like command-line) while linking some code using the simde_mm_floor_ps and simde_mm_floor_pd:

windows-clang-cl-x64-debug\lld-link : error : undefined symbol: roundeven and windows-clang-cl-x64-debug\lld-link : error : undefined symbol: roundevenf

Weirdly enough, it links fine in release, so it probably has something to do with O2? Compiler bug perhaps?

It ends up using __builtin_roundeven and __builtin_roundevenf, so I suspect that this guard gives a false-positive for clang: https://github.com/simd-everywhere/simde/blob/17416b157fcd88bb498660e3e2f32ce822f436dd/simde/simde-math.h#L1268-L1271

If I force it to use simde_math_round and simde_math_roundf fallbacks it links fine.

The problem seems to persist even in the old SIMDe version I'm using (5e7c4d4ec10855ebe8f19af8a80fdfa26caad5e9) https://github.com/simd-everywhere/simde/blob/5e7c4d4ec10855ebe8f19af8a80fdfa26caad5e9/simde/simde-math.h#L1268-L1271

Epixu avatar May 22 '24 09:05 Epixu

@yurivict and @Epixu Huh, I know that emscripten had some issues with clang related to those functions. Maybe https://github.com/simd-everywhere/simde/issues/1001#issuecomment-1498050395 (use of musl instead of the gnu c lib) is applicable here?

mr-c avatar May 22 '24 10:05 mr-c