Stream: git-wasmtime

Topic: wasmtime / issue #3216 x64 simd: Incorrect codegen leads ...


view this post on Zulip Wasmtime GitHub notifications bot (Aug 19 2021 at 22:01):

alexcrichton labeled issue #3216:

Found with some fuzzing, this module:

(module
  (func (result i64)
      v128.const i64x2 -1 1
      global.get 0
      f64x2.replace_lane 0
      i64x2.extract_lane 1
  )

  (global f64 (f64.const 1))
  (export "" (func 0)))

leads to:

$ wasmtime run --enable-simd --invoke '' test.wat
0

but the result should be 1

cc @jlb6740, @abrown

view this post on Zulip Wasmtime GitHub notifications bot (Aug 19 2021 at 22:01):

alexcrichton labeled issue #3216:

Found with some fuzzing, this module:

(module
  (func (result i64)
      v128.const i64x2 -1 1
      global.get 0
      f64x2.replace_lane 0
      i64x2.extract_lane 1
  )

  (global f64 (f64.const 1))
  (export "" (func 0)))

leads to:

$ wasmtime run --enable-simd --invoke '' test.wat
0

but the result should be 1

cc @jlb6740, @abrown

view this post on Zulip Wasmtime GitHub notifications bot (Aug 19 2021 at 22:01):

alexcrichton opened issue #3216:

Found with some fuzzing, this module:

(module
  (func (result i64)
      v128.const i64x2 -1 1
      global.get 0
      f64x2.replace_lane 0
      i64x2.extract_lane 1
  )

  (global f64 (f64.const 1))
  (export "" (func 0)))

leads to:

$ wasmtime run --enable-simd --invoke '' test.wat
0

but the result should be 1

cc @jlb6740, @abrown

view this post on Zulip Wasmtime GitHub notifications bot (Aug 19 2021 at 22:01):

alexcrichton labeled issue #3216:

Found with some fuzzing, this module:

(module
  (func (result i64)
      v128.const i64x2 -1 1
      global.get 0
      f64x2.replace_lane 0
      i64x2.extract_lane 1
  )

  (global f64 (f64.const 1))
  (export "" (func 0)))

leads to:

$ wasmtime run --enable-simd --invoke '' test.wat
0

but the result should be 1

cc @jlb6740, @abrown

view this post on Zulip Wasmtime GitHub notifications bot (Aug 20 2021 at 17:13):

abrown assigned issue #3216:

Found with some fuzzing, this module:

(module
  (func (result i64)
      v128.const i64x2 -1 1
      global.get 0
      f64x2.replace_lane 0
      i64x2.extract_lane 1
  )

  (global f64 (f64.const 1))
  (export "" (func 0)))

leads to:

$ wasmtime run --enable-simd --invoke '' test.wat
0

but the result should be 1

cc @jlb6740, @abrown

view this post on Zulip Wasmtime GitHub notifications bot (Sep 03 2021 at 23:50):

abrown labeled issue #3216 (assigned to abrown):

Found with some fuzzing, this module:

(module
  (func (result i64)
      v128.const i64x2 -1 1
      global.get 0
      f64x2.replace_lane 0
      i64x2.extract_lane 1
  )

  (global f64 (f64.const 1))
  (export "" (func 0)))

leads to:

$ wasmtime run --enable-simd --invoke '' test.wat
0

but the result should be 1

cc @jlb6740, @abrown

view this post on Zulip Wasmtime GitHub notifications bot (Sep 08 2021 at 16:13):

alexcrichton commented on issue #3216:

I chose this to poke around with objdump and the new module serialization format (not that I couldn't do this before, I just wanted to make sure it all worked), and it looks like the assembly is:

0000000000000000 <_wasm_function_0>:
       0: 55                            pushq   %rbp
       1: 48 89 e5                      movq    %rsp, %rbp
       4: f3 0f 6f 05 14 00 00 00       movdqu  20(%rip), %xmm0  # 20 <_wasm_function_0+0x20>
       c: f2 0f 10 47 30                movsd   48(%rdi), %xmm0
      11: 66 48 0f 3a 16 c6 01          pextrq  $1, %xmm0, %rsi
      18: 48 89 f0                      movq    %rsi, %rax
      1b: 48 89 ec                      movq    %rbp, %rsp
      1e: 5d                            popq    %rbp
      1f: c3                            retq
      20: ff ff                         <unknown>
      22: ff ff                         <unknown>
      24: ff ff                         <unknown>
      26: ff ff                         <unknown>
      28: 01 00                         addl    %eax, (%rax)
      2a: 00 00                         addb    %al, (%rax)
      2c: 00 00                         addb    %al, (%rax)
      2e: 00 00                         addb    %al, (%rax)

It looks like xmm0 is reused for the global.get (or something about that) with some instructions possibly getting fused together. My guess is that there's a bug informing regalloc of used/defined registers somewhere which would fix this.

view this post on Zulip Wasmtime GitHub notifications bot (Nov 18 2021 at 19:48):

alexcrichton closed issue #3216 (assigned to abrown):

Found with some fuzzing, this module:

(module
  (func (result i64)
      v128.const i64x2 -1 1
      global.get 0
      f64x2.replace_lane 0
      i64x2.extract_lane 1
  )

  (global f64 (f64.const 1))
  (export "" (func 0)))

leads to:

$ wasmtime run --enable-simd --invoke '' test.wat
0

but the result should be 1

cc @jlb6740, @abrown


Last updated: Dec 23 2024 at 12:05 UTC