wabt icon indicating copy to clipboard operation
wabt copied to clipboard

mips test/interp/simd-binary.txt simd-unary.txt test failures

Open kapouer opened this issue 1 year ago • 8 comments

Hi,

wabt, as built on debian, fails on mips64el architecture: https://buildd.debian.org/status/fetch.php?pkg=wabt&arch=mips64el&ver=1.0.34%2Bdsfg2%2B%7Ecs1.0.32-4&stamp=1739635385&raw=0

but it doesn't fail on loong64.

- test/interp/simd-binary.txt
  STDOUT MISMATCH:
  --- expected
  +++ actual
  @@ -31,17 +31,17 @@
   v128_and_0() => v128 i32x4:0x00020001 0x00040002 0x00000003 0x00000004
   v128_or_0() => v128 i32x4:0x00ff0001 0x00fe0002 0x44000003 0x55000004
   v128_xor_0() => v128 i32x4:0x00fd0000 0x00fa0000 0x44000000 0x55000000
  -f32x4_min_0() => v128 i32x4:0x80000000 0x7fc00000 0x449a5000 0xbf800000
  -f64x2_min_0() => v128 i32x4:0x00000000 0xc0934a00 0x00000000 0x7ff80000
  -f32x4_max_0() => v128 i32x4:0x00000000 0x7fc00000 0x449a5000 0x3f800000
  -f64x2_max_0() => v128 i32x4:0x00000000 0x00000000 0x00000000 0x7ff80000
  -f32x4_add_0() => v128 i32x4:0x00000000 0x7fc00000 0x449a7000 0xc49a2000
  -f64x2_add_0() => v128 i32x4:0x00000000 0xc0934400 0x00000000 0x7ff80000
  -f32x4_sub_0() => v128 i32x4:0x80000000 0x7fc00000 0x449a3000 0xc49a8000
  -f64x2_sub_0() => v128 i32x4:0x00000000 0x40935000 0x00000000 0x7ff80000
  -f32x4_div_0() => v128 i32x4:0x7fc00000 0x7fc00000 0x3fc00000 0xc0000000
  +f32x4_min_0() => v128 i32x4:0x80000000 0x7fbfffff 0x449a5000 0xbf800000
  +f64x2_min_0() => v128 i32x4:0x00000000 0xc0934a00 0xffffffff 0x7ff7ffff
  +f32x4_max_0() => v128 i32x4:0x00000000 0x7fbfffff 0x449a5000 0x3f800000
  +f64x2_max_0() => v128 i32x4:0x00000000 0x00000000 0xffffffff 0x7ff7ffff
  +f32x4_add_0() => v128 i32x4:0x00000000 0x7fbfffff 0x449a7000 0xc49a2000
  +f64x2_add_0() => v128 i32x4:0x00000000 0xc0934400 0xffffffff 0x7ff7ffff
  +f32x4_sub_0() => v128 i32x4:0x80000000 0x7fbfffff 0x449a3000 0xc49a8000
  +f64x2_sub_0() => v128 i32x4:0x00000000 0x40935000 0xffffffff 0x7ff7ffff
  +f32x4_div_0() => v128 i32x4:0x7fbfffff 0x7fbfffff 0x3fc00000 0xc0000000
   f64x2_div_0() => v128 i32x4:0x00000000 0x3ff80000 0x00000000 0xc0000000
  -f32x4_mul_0() => v128 i32x4:0x80000000 0x7fc00000 0x3fc00000 0xc0900000
  +f32x4_mul_0() => v128 i32x4:0x80000000 0x7fbfffff 0x3fc00000 0xc0900000
   f64x2_mul_0() => v128 i32x4:0x00000000 0x3ff80000 0x00000000 0xc0120000
   v8x16_swizzle_0() => v128 i32x4:0x0d090501 0x020e0a06 0x03070f0b 0x0c080410
   v8x16_swizzle_1() => v128 i32x4:0x44444444 0x44444444 0x88888888 0x88888888
- test/interp/simd-unary.txt
  STDOUT MISMATCH:
  --- expected
  +++ actual
  @@ -23,8 +23,8 @@
   f32x4_abs_0() => v128 i32x4:0x00000000 0x7fc00000 0x449a5000 0x3f800000
   f64x2_abs_0() => v128 i32x4:0x00000000 0x00000000 0x00000000 0x7ff80000
   f64x2_abs_1() => v128 i32x4:0x00000000 0x40934a00 0x00000000 0x3ff00000
  -f32x4_sqrt_0() => v128 i32x4:0x7fc00000 0x7fc00000 0x40000000 0x40400000
  -f64x2_sqrt_0() => v128 i32x4:0x00000000 0x7ff80000 0x00000000 0x7ff80000
  +f32x4_sqrt_0() => v128 i32x4:0x7fbfffff 0x7fbfffff 0x40000000 0x40400000
  +f64x2_sqrt_0() => v128 i32x4:0xffffffff 0x7ff7ffff 0xffffffff 0x7ff7ffff
   f64x2_sqrt_1() => v128 i32x4:0x00000000 0x40000000 0x00000000 0x40080000
   f32x4_convert_i32x4_s_0() => v128 i32x4:0x3f800000 0xbf800000 0x00000000 0x40400000
   f32x4_convert_i32x4_u_0() => v128 i32x4:0x3f800000 0x40000000 0x00000000 0x40400000

Note that "run-tests" pass on all other architectures where its build-deps are available (even armel, s390x, riscv64).

kapouer avatar Feb 17 '25 09:02 kapouer

can you use -mnan=2008?

SoniEx2 avatar Feb 17 '25 16:02 SoniEx2

Sure, on WASM2C_CFLAGS or else ?

kapouer avatar Feb 17 '25 16:02 kapouer

that should work, let us know what happens

SoniEx2 avatar Feb 17 '25 17:02 SoniEx2

  +++ actual
  @@ -0,0 +1,21 @@
  +In file included from /usr/include/features.h:534,
  +                 from /usr/include/assert.h:35,
  +                 from out/test/regress/regress-2039/regress-2039.0.c:2:
  +/usr/include/mips64el-linux-gnuabi64/gnu/stubs.h:41:11: fatal error: gnu/stubs-n64_hard_2008.h: No such file or directory
  +   41 | # include <gnu/stubs-n64_hard_2008.h>

kapouer avatar Feb 17 '25 17:02 kapouer

This log comes from here (link will expire).

  +utils.Error: Error running "/usr/bin/cc '-I/<<PKGBUILDDIR>>/wasm2c' '-I/<<PKGBUILDDIR>>/third_party/simde' -std=c99 -c out/test/regress/regress-2034/regress-2034.0.c -o out/test/regress/regress-2034/regress-2034.0.o -O2 -Wall -Werror -Wno-unused -Wno-array-bounds -Wno-ignored-optimization-argument -Wno-tautological-constant-out-of-range-compare -Wno-infinite-recursion -Wno-pass-failed -fno-optimize-sibling-calls -frounding-math -fsignaling-nans -D_DEFAULT_SOURCE -mnan=2008" (1):

kapouer avatar Feb 17 '25 17:02 kapouer

oh. what kind of MIPS is this?

SoniEx2 avatar Feb 17 '25 17:02 SoniEx2

wait, the failing tests are interp, not wasm2c, sorry. it should be passed in CXXFLAGS. however, it probably still won't work.

the problem is that MIPS (without -mnan=2008) uses a different floating point NaN convention than literally everyone else, including wasm. so to support MIPS (without support for -mnan=2008) would require some manual handling of NaNs.

SoniEx2 avatar Feb 17 '25 18:02 SoniEx2

nan2008 is not supported in debian. Also mips64el is not in great shape, so I'll just disable those tests on that arch. I understand it's not worth the time spent on that problem.

kapouer avatar Feb 18 '25 00:02 kapouer