highway icon indicating copy to clipboard operation
highway copied to clipboard

test with target RVV failed with gcc13 and glibc 2.38

Open wychlw opened this issue 9 months ago • 2 comments

While try running test with GCC-13 compiler, I got the following error reported:

❯ ctest --rerun-failed --output-on-failure -v 
0% tests passed, 109 tests failed out of 109

With the full report at here

The command I run was:

export QEMU_LD_PREFIX=/usr/riscv64-linux-gnu
CC=riscv64-linux-gnu-gcc CXX=riscv64-linux-gnu-g++ cmake .. -DCMAKE_C_COMPILER_TARGET="riscv64-linux-gnu" -DCMAKE_CXX_COMPILER_TARGET="riscv64-linux-gnu" -DCMAKE_CROSSCOMPILING=true -DCMAKE_CROSSCOMPILING_EMULATOR="/usr/bin/qemu-riscv64;-cpu;rv64,v=true,vext_spec=v1.0,rvv_ta_all_1s=true,rvv_ma_all_1s=true;-L;/usr/riscv64-linux-gnu"

make -j
ctest -j

Basiclly made some modification based on run_test.sh to fit my env.

I don't know if I've done anything wrong to get so many errors.

My targets are:

Config: emu128:0 scalar:0 static:0 all_attain:0 is_test:0
Compiled HWY_TARGETS:   RVV
HWY_ATTAINABLE_TARGETS: RVV SCALAR
HWY_BASELINE_TARGETS:   RVV SCALAR
HWY_STATIC_TARGET:      RVV
HWY_BROKEN_TARGETS:    
HWY_DISABLED_TARGETS:  
Current CPU supports:   RVV EMU128 SCALAR

And here is my env: system:

Arch Linux
Linux 6.8.7-arch1-1 #1 SMP PREEMPT_DYNAMIC Wed, 17 Apr 2024 15:20:28 +0000 x86_64 GNU/Linux

cmake:

❯ cmake --version
cmake version 3.29.2
CMake suite maintained and supported by Kitware (kitware.com/cmake).

gcc:

❯ riscv64-linux-gnu-gcc -v
Using built-in specs.
COLLECT_GCC=riscv64-linux-gnu-gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/riscv64-linux-gnu/13.2.0/lto-wrapper
Target: riscv64-linux-gnu
Configured with: /build/riscv64-linux-gnu-gcc/src/gcc-13.2.0/configure --prefix=/usr --program-prefix=riscv64-linux-gnu- --with-local-prefix=/usr/riscv64-linux-gnu --with-sysroot=/usr/riscv64-linux-gnu --with-build-sysroot=/usr/riscv64-linux-gnu --libdir=/usr/lib --libexecdir=/usr/lib --target=riscv64-linux-gnu --host=x86_64-pc-linux-gnu --build=x86_64-pc-linux-gnu --with-system-zlib --with-isl --with-linker-hash-style=gnu --disable-nls --disable-libunwind-exceptions --disable-libsanitizer --disable-libstdcxx-pch --disable-libssp --disable-multilib --disable-werror --enable-languages=c,c++ --enable-shared --enable-threads=posix --enable-__cxa_atexit --enable-clocale=gnu --enable-gnu-unique-object --enable-linker-build-id --enable-lto --enable-plugin --enable-install-libiberty --enable-gnu-indirect-function --enable-default-pie --enable-checking=release
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 13.2.0 (GCC) 

g++:

❯ riscv64-linux-gnu-g++ -v
Using built-in specs.
COLLECT_GCC=riscv64-linux-gnu-g++
COLLECT_LTO_WRAPPER=/usr/lib/gcc/riscv64-linux-gnu/13.2.0/lto-wrapper
Target: riscv64-linux-gnu
Configured with: /build/riscv64-linux-gnu-gcc/src/gcc-13.2.0/configure --prefix=/usr --program-prefix=riscv64-linux-gnu- --with-local-prefix=/usr/riscv64-linux-gnu --with-sysroot=/usr/riscv64-linux-gnu --with-build-sysroot=/usr/riscv64-linux-gnu --libdir=/usr/lib --libexecdir=/usr/lib --target=riscv64-linux-gnu --host=x86_64-pc-linux-gnu --build=x86_64-pc-linux-gnu --with-system-zlib --with-isl --with-linker-hash-style=gnu --disable-nls --disable-libunwind-exceptions --disable-libsanitizer --disable-libstdcxx-pch --disable-libssp --disable-multilib --disable-werror --enable-languages=c,c++ --enable-shared --enable-threads=posix --enable-__cxa_atexit --enable-clocale=gnu --enable-gnu-unique-object --enable-linker-build-id --enable-lto --enable-plugin --enable-install-libiberty --enable-gnu-indirect-function --enable-default-pie --enable-checking=release
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 13.2.0 (GCC) 

glibc: GLIBC 2.38

qemu-riscv64:

❯ qemu-riscv64 --version
qemu-riscv64 version 8.2.2
Copyright (c) 2003-2023 Fabrice Bellard and the QEMU Project developers

(Though I run the same test on board with RVV1.0 support and also failed, so it may not be a qemu issue?)

wychlw avatar Apr 30 '24 04:04 wychlw

Hi, thanks for reporting. If all tests are failing, then likely causes are:

  • does your Linux support RVV? Last I heard, changes were required to context switching. It may also have to be enabled on the board.
  • is it the compiler? We are currently able to build+run with clang. Are you able to try with that compiler?

jan-wassenberg avatar Apr 30 '24 07:04 jan-wassenberg

I use clang to compile it again, and now it gives the expected result which is 4 error. So it it my original toolchain have some problem. Thanks a lot for replying me!

Meanwhile, with the newly build gcc-13(@88f22217) toolchain, I still got following error:

❯ ctest --rerun-failed --output-on-failure -v | tee tf.log
Test project /home/lw/Work/plct/highway/build
    Start 209: HwyConvertTestGroup/HwyConvertTest.TestAllBF16/RVV  # GetParam() = 137438953472
1/7 Test #209: HwyConvertTestGroup/HwyConvertTest.TestAllBF16/RVV  # GetParam() = 137438953472 ...............***Failed    0.04 sec
Running main() from /home/lw/Work/plct/highway/build/googletest-src/googletest/src/gtest_main.cc
Note: Google Test filter = HwyConvertTestGroup/HwyConvertTest.TestAllBF16/RVV
[==========] Running 1 test from 1 test suite.
[----------] Global test environment set-up.
[----------] 1 test from HwyConvertTestGroup/HwyConvertTest
[ RUN      ] HwyConvertTestGroup/HwyConvertTest.TestAllBF16/RVV


f32x2 expect [0+ ->]:
  338953138925153547590470800371487866880.000000000,199384199367737380935571059042051686400.000000000,
f32x2 actual [0+ ->]:
  inf,199384199367737380935571059042051686400.000000000,
Abort at convert_test.cc:558: RVV, f32x2 lane 0 mismatch: expected '338953138925153547590470800371487866880.000000000', got 'inf'.


    Start 249: HwyDemoteTestGroup/HwyDemoteTest.TestAllDemoteToFloat/RVV  # GetParam() = 137438953472
2/7 Test #249: HwyDemoteTestGroup/HwyDemoteTest.TestAllDemoteToFloat/RVV  # GetParam() = 137438953472 ........***Failed    0.03 sec
Running main() from /home/lw/Work/plct/highway/build/googletest-src/googletest/src/gtest_main.cc
Note: Google Test filter = HwyDemoteTestGroup/HwyDemoteTest.TestAllDemoteToFloat/RVV
[==========] Running 1 test from 1 test suite.
[----------] Global test environment set-up.
[----------] 1 test from HwyDemoteTestGroup/HwyDemoteTest
[ RUN      ] HwyDemoteTestGroup/HwyDemoteTest.TestAllDemoteToFloat/RVV


f32 expect [0+ ->]:
  0.000000000E+00,
f32 actual [0+ ->]:
  -1.401298464E-45,
Abort at demote_test.cc:258: RVV, f32x1 lane 0 mismatch: expected '0.000000000E+00', got '-1.401298464E-45'.


    Start 395: HwyMaskTestGroup/HwyMaskTest.TestAllDup128MaskFromMaskBits/RVV  # GetParam() = 137438953472
3/7 Test #395: HwyMaskTestGroup/HwyMaskTest.TestAllDup128MaskFromMaskBits/RVV  # GetParam() = 137438953472 ...***Failed    0.16 sec
Running main() from /home/lw/Work/plct/highway/build/googletest-src/googletest/src/gtest_main.cc
Note: Google Test filter = HwyMaskTestGroup/HwyMaskTest.TestAllDup128MaskFromMaskBits/RVV
[==========] Running 1 test from 1 test suite.
[----------] Global test environment set-up.
[----------] 1 test from HwyMaskTestGroup/HwyMaskTest
[ RUN      ] HwyMaskTestGroup/HwyMaskTest.TestAllDup128MaskFromMaskBits/RVV


i16x16 expect [6+ ->]:
  0x0000,0x0000,0xFFFF,0x0000,0x0000,0x0000,0x0000,
i16x16 actual [6+ ->]:
  0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
Abort at mask_test.cc:543: RVV, i16x16 lane 8 mismatch: expected '0xFFFF', got '0x0000'.


    Start 567: MatVecTestGroup/MatVecTest.TestAllMatVec/RVV  # GetParam() = 137438953472
4/7 Test #567: MatVecTestGroup/MatVecTest.TestAllMatVec/RVV  # GetParam() = 137438953472 .....................***Failed    0.13 sec
Running main() from /home/lw/Work/plct/highway/build/googletest-src/googletest/src/gtest_main.cc
Note: Google Test filter = MatVecTestGroup/MatVecTest.TestAllMatVec/RVV
[==========] Running 1 test from 1 test suite.
[----------] Global test environment set-up.
[----------] 1 test from MatVecTestGroup/MatVecTest
[ RUN      ] MatVecTestGroup/MatVecTest.TestAllMatVec/RVV
f32/f32 6 x 8, without add: mismatch at 0 nan nan; tol nan
Abort at matvec_test.cc:178: Assert 0

    Start 569: MatVecTestGroup/MatVecTest.TestAllMatVecBF16/RVV  # GetParam() = 137438953472
5/7 Test #569: MatVecTestGroup/MatVecTest.TestAllMatVecBF16/RVV  # GetParam() = 137438953472 .................***Failed    0.15 sec
Running main() from /home/lw/Work/plct/highway/build/googletest-src/googletest/src/gtest_main.cc
Note: Google Test filter = MatVecTestGroup/MatVecTest.TestAllMatVecBF16/RVV
[==========] Running 1 test from 1 test suite.
[----------] Global test environment set-up.
[----------] 1 test from MatVecTestGroup/MatVecTest
[ RUN      ] MatVecTestGroup/MatVecTest.TestAllMatVecBF16/RVV
i16/f32 6 x 8, without add: mismatch at 0 nan nan; tol nan
Abort at matvec_test.cc:178: Assert 0

    Start 571: MatVecTestGroup/MatVecTest.TestAllMatVecBF16Both/RVV  # GetParam() = 137438953472
6/7 Test #571: MatVecTestGroup/MatVecTest.TestAllMatVecBF16Both/RVV  # GetParam() = 137438953472 .............***Failed    0.14 sec
Running main() from /home/lw/Work/plct/highway/build/googletest-src/googletest/src/gtest_main.cc
Note: Google Test filter = MatVecTestGroup/MatVecTest.TestAllMatVecBF16Both/RVV
[==========] Running 1 test from 1 test suite.
[----------] Global test environment set-up.
[----------] 1 test from MatVecTestGroup/MatVecTest
[ RUN      ] MatVecTestGroup/MatVecTest.TestAllMatVecBF16Both/RVV
i16/i16 6 x 8, without add: mismatch at 0 nan nan; tol nan
Abort at matvec_test.cc:178: Assert 0

    Start 647: SortTestGroup/SortTest.TestAllPartition/RVV  # GetParam() = 137438953472
7/7 Test #647: SortTestGroup/SortTest.TestAllPartition/RVV  # GetParam() = 137438953472 ......................***Exception: SegFault  0.23 sec
Running main() from /home/lw/Work/plct/highway/build/googletest-src/googletest/src/gtest_main.cc
Note: Google Test filter = SortTestGroup/SortTest.TestAllPartition/RVV
[==========] Running 1 test from 1 test suite.
[----------] Global test environment set-up.
[----------] 1 test from SortTestGroup/SortTest
[ RUN      ] SortTestGroup/SortTest.TestAllPartition/RVV


0% tests passed, 7 tests failed out of 7

Total Test time (real) =   0.89 sec

The following tests FAILED:
        209 - HwyConvertTestGroup/HwyConvertTest.TestAllBF16/RVV  # GetParam() = 137438953472 (Failed)
        249 - HwyDemoteTestGroup/HwyDemoteTest.TestAllDemoteToFloat/RVV  # GetParam() = 137438953472 (Failed)
        395 - HwyMaskTestGroup/HwyMaskTest.TestAllDup128MaskFromMaskBits/RVV  # GetParam() = 137438953472 (Failed)
        567 - MatVecTestGroup/MatVecTest.TestAllMatVec/RVV  # GetParam() = 137438953472 (Failed)
        569 - MatVecTestGroup/MatVecTest.TestAllMatVecBF16/RVV  # GetParam() = 137438953472 (Failed)
        571 - MatVecTestGroup/MatVecTest.TestAllMatVecBF16Both/RVV  # GetParam() = 137438953472 (Failed)
        647 - SortTestGroup/SortTest.TestAllPartition/RVV  # GetParam() = 137438953472 (SEGFAULT)
Errors while running CTest

It looks make sense now, are these error expected?

wychlw avatar Apr 30 '24 11:04 wychlw