Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add and update final SIMD opcodes #1621

Closed
wants to merge 19 commits into from

Conversation

ngzhian
Copy link
Member

@ngzhian ngzhian commented Mar 3, 2021

This adds all the new SIMD opcodes and also update names of certain
instructions enough to get compiling again. Partially addresses #1617.

Note that third_party/testsuite is updated to TOT, and I ran tests/update-spec-tests.py, but manually removed some simd test cases because we cannot handle all the new opcodes yet, they will require implementation in the binary-reader and interp. Support will come later, as with checking in the new SIMD tests.

@tlively
Copy link
Member

tlively commented Mar 3, 2021

Looks good to me so far!

@ngzhian
Copy link
Member Author

ngzhian commented Mar 4, 2021

This is mostly done.
I updated third_party/testsuite, and ran tools/update-spec-tests.py, and manually removed some simd test cases from spec, those can be updated and implemented later (this change is large enough already). The remaining failing tests are all non-simd:

**** FAILED ******************************************************************

  • test/spec/binary.txt
    /usr/local/google/home/zhin/ssd2/wabt/bin/spectest-interp out/test/spec/binary/binary.json
  • test/spec/data.txt
    /usr/local/google/home/zhin/ssd2/wabt/bin/spectest-interp out/test/spec/data/data.json
  • test/spec/elem.txt
    /usr/local/google/home/zhin/ssd2/wabt/bin/spectest-interp out/test/spec/elem/elem.json
  • test/spec/exports.txt
    /usr/local/google/home/zhin/ssd2/wabt/bin/spectest-interp out/test/spec/exports/exports.json
  • test/spec/br_table.txt
    /usr/local/google/home/zhin/ssd2/wabt/bin/spectest-interp out/test/spec/br_table/br_table.json
  • test/spec/global.txt
    /usr/local/google/home/zhin/ssd2/wabt/bin/spectest-interp out/test/spec/global/global.json
  • test/spec/imports.txt
    /usr/local/google/home/zhin/ssd2/wabt/bin/spectest-interp out/test/spec/imports/imports.json
  • test/spec/local_tee.txt
    /usr/local/google/home/zhin/ssd2/wabt/bin/spectest-interp out/test/spec/local_tee/local_tee.json
  • test/spec/memory64/address.txt
    /usr/local/google/home/zhin/ssd2/wabt/bin/spectest-interp out/test/spec/memory64/address/address.json --enable-memory64
  • test/spec/memory64/binary-leb128.txt
    /usr/local/google/home/zhin/ssd2/wabt/bin/spectest-interp out/test/spec/memory64/binary-leb128/binary-leb128.json --enable-memory64
  • test/spec/memory64/binary.txt
    /usr/local/google/home/zhin/ssd2/wabt/bin/spectest-interp out/test/spec/memory64/binary/binary.json --enable-memory64
  • test/spec/memory64/address64.txt
    /usr/local/google/home/zhin/ssd2/wabt/bin/spectest-interp out/test/spec/memory64/address64/address64.json --enable-memory64
  • test/spec/memory64/memory.txt
    /usr/local/google/home/zhin/ssd2/wabt/bin/spectest-interp out/test/spec/memory64/memory/memory.json --enable-memory64
  • test/spec/select.txt
    /usr/local/google/home/zhin/ssd2/wabt/bin/spectest-interp out/test/spec/select/select.json
  • test/wasm2c/spec/global.txt
    /usr/bin/python3 /usr/local/google/home/zhin/ssd2/wabt/test/run-spec-wasm2c.py out/test/wasm2c/spec/global.wast --bindir=/usr/local/google/home/zhin/ssd2/wabt/bin --no-error-cmdline --cflags=-DWABT_BIG_ENDIAN=0 -o out/test/wasm2c/spec/global

@ngzhian
Copy link
Member Author

ngzhian commented Mar 4, 2021

It looks like many of these just need a test rebase, the only tricky one is test/wasm2c/spec/global.txt
/usr/bin/python3 /usr/local/google/home/zhin/ssd2/wabt/test/run-spec-wasm2c.py out/test/wasm2c/spec/global.wast --bindir=/usr/local/google/home/zhin/ssd2/wabt/bin --no-error-cmdline --cflags=-DWABT_BIG_ENDIAN=0 -o out/test/wasm2c/spec/global

- test/wasm2c/spec/global.txt
  expected error code 0, got 1.
  STDERR MISMATCH:
  --- expected
  +++ actual
  @@ -0,0 +1,15 @@
  +Traceback (most recent call last):
  +  File "/usr/local/google/home/zhin/ssd2/wabt/test/run-spec-wasm2c.py", line 415, in <module>
  +    sys.exit(main(sys.argv[1:]))
  +  File "/usr/local/google/home/zhin/ssd2/wabt/test/run-spec-wasm2c.py", line 405, in main
  +    Link(cc, o_filenames, main_exe, out_dir, '-lm')
  +  File "/usr/local/google/home/zhin/ssd2/wabt/test/run-spec-wasm2c.py", line 316, in Link
  +    cc.RunWithArgs(*args, cwd=out_dir)
  +  File "/usr/local/google/home/zhin/ssd2/wabt/test/utils.py", line 103, in RunWithArgs
  +    raise error
  +utils.Error: Error running "cc -DWABT_BIG_ENDIAN=0 -o global /usr/local/google/home/zhin/ssd2/wabt/out/test/wasm2c/spec/global/wasm-rt-impl.o /usr/local/google/home/zhin/ssd2/wabt/out/test/wasm2c/spec/global/global.0.o /usr/local/google/home/zhin/ssd2/wabt/out/test/wasm2c/spec/global/global.3.o /usr/local/google/home/zhin/ssd2/wabt/out/test/wasm2c/spec/global/global.4.o /usr/local/google/home/zhin/ssd2/wabt/out/test/wasm2c/spec/global/global.20.o /usr/local/google/home/zhin/ssd2/wabt/out/test/wasm2c/spec/global/global.23.o /usr/local/google/home/zhin/ssd2/wabt/out/test/wasm2c/spec/global/global-main.o -lm":
  +/usr/bin/ld: /usr/local/google/home/zhin/ssd2/wabt/out/test/wasm2c/spec/global/global.0.o: warning: relocation against `Z_spectestZ_global_i64Z_j' in read-only section `.text'
  +/usr/bin/ld: /usr/local/google/home/zhin/ssd2/wabt/out/test/wasm2c/spec/global/global.0.o: in function `init_globals':
  +global.0.c:(.text+0x236): undefined reference to `Z_spectestZ_global_i64Z_j'
  +/usr/bin/ld: warning: creating DT_TEXTREL in a PIE
  +collect2: error: ld returned 1 exit statu

@ngzhian
Copy link
Member Author

ngzhian commented Mar 4, 2021

Got some pointers to the wasm2c error and I have a fix.
I think once #1622 is merged, I will rebase this, then I will check in the fix for wasm2c, together with the rebased files, and we'll be good.

Fix is:

$ git diff -- test/spec-wasm2c-prefix.c
diff --git a/test/spec-wasm2c-prefix.c b/test/spec-wasm2c-prefix.c
index 897872b4..f28339e1 100644
--- a/test/spec-wasm2c-prefix.c
+++ b/test/spec-wasm2c-prefix.c
@@ -202,6 +202,7 @@ static void spectest_print_f64_f64(double d1, double d2) {
 static wasm_rt_table_t spectest_table;
 static wasm_rt_memory_t spectest_memory;
 static uint32_t spectest_global_i32 = 666;
+static uint64_t spectest_global_i64 = 666l;

 void (*Z_spectestZ_printZ_vv)(void) = &spectest_print;
 void (*Z_spectestZ_print_i32Z_vi)(uint32_t) = &spectest_print_i32;
@@ -214,6 +215,7 @@ void (*Z_spectestZ_print_f64_f64Z_vdd)(double,
 wasm_rt_table_t* Z_spectestZ_table = &spectest_table;
 wasm_rt_memory_t* Z_spectestZ_memory = &spectest_memory;
 uint32_t* Z_spectestZ_global_i32Z_i = &spectest_global_i32;
+uint64_t* Z_spectestZ_global_i64Z_j = &spectest_global_i64;

 static void init_spectest_module(void) {
   wasm_rt_allocate_memory(&spectest_memory, 1, 2);

@ngzhian
Copy link
Member Author

ngzhian commented Mar 4, 2021

Hm, what is this? from the ci logs:

- test/spec/simd/simd_conversions.txt
  expected error code 0, got -6.
  STDERR MISMATCH:
  --- expected
  +++ actual
  @@ -0,0 +1 @@
  +*** stack smashing detected ***: terminated

@ngzhian
Copy link
Member Author

ngzhian commented Mar 4, 2021

I'll be splitting this up into smaller changes to make it easier to review, please hold on.

@steven-johnson
Copy link
Collaborator

Where should we check for updates on the 'completeness' of this update, since this is being split into smaller pieces?

@ngzhian
Copy link
Member Author

ngzhian commented Mar 8, 2021

@steven-johnson I will update the WABT row in WebAssembly/simd#480 when this work is done.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants