Stream: git-wasmtime

Topic: wasmtime / issue #3305 Cranelift: `vany_true` for `b64x2`...


view this post on Zulip Wasmtime GitHub notifications bot (Sep 06 2021 at 11:24):

afonso360 labeled issue #3305:

Hey!

.clif Test Case

function %vany_true_b64x2() -> b1 {
block0:
    v0 = vconst.b64x2 [false false]
    v1 = vany_true v0
    return v1
}
; run: %vany_true_b64x2() == false

Steps to Reproduce

clif-util test ./the-above.clif

Expected Results

The test to pass

Actual Results

Qemu crashes with an illegal instruction

     Running `qemu-aarch64 -L /usr/aarch64-linux-gnu -E LD_LIBRARY_PATH=/usr/aarch64-linux-gnu/lib /mnt/c/Users/Afonso/CLionProjects/wasmtime/target/aarch64-unknown-linux-gnu/debug/clif-util test ./filetests/filetests/runtes
ts/simd-vanytrue.clif`
skipped ./filetests/filetests/runtests/simd-vanytrue.clif: host can't run X86_64 programs
skipped ./filetests/filetests/runtests/simd-vanytrue.clif: host can't run X86_64 programs
skipped ./filetests/filetests/runtests/simd-vanytrue.clif: host can't run X86_64 programs
qemu: uncaught target signal 4 (Illegal instruction) - core dumped
Illegal instruction

Versions and Environment

Cranelift version or commit: main
Operating system: linux
Architecture: aarch64

Extra Info

Disassembly:

PS C:\Users\Afonso\CLionProjects\wasmtime\cranelift> cargo run -- compile -D --target aarch64 .\filetests\filetests\runtests\simd-vanytrue.clif
    Finished dev [unoptimized + debuginfo] target(s) in 0.29s
     Running `C:\Users\Afonso\CLionProjects\wasmtime\target\debug\clif-util.exe compile -D --target aarch64 .\filetests\filetests\runtests\simd-vanytrue.clif`
.byte 0, 228, 0, 79, 0, 164, 224, 110, 0, 60, 8, 78, 31, 0, 0, 241, 224, 7, 159, 154, 192, 3, 95, 214

Disassembly of 24 bytes:
   0:   00 e4 00 4f             movi    v0.16b, #0
   4:   00 a4 e0 6e             .byte   0x00, 0xa4, 0xe0, 0x6e
   8:   00 3c 08 4e             mov     x0, v0.d[0]
   c:   1f 00 00 f1             cmp     x0, #0
  10:   e0 07 9f 9a             cset    x0, ne
  14:   c0 03 5f d6             ret

A test suite with vany_true tests is introduced as part of #3304

view this post on Zulip Wasmtime GitHub notifications bot (Sep 06 2021 at 11:24):

afonso360 opened issue #3305:

Hey!

.clif Test Case

function %vany_true_b64x2() -> b1 {
block0:
    v0 = vconst.b64x2 [false false]
    v1 = vany_true v0
    return v1
}
; run: %vany_true_b64x2() == false

Steps to Reproduce

clif-util test ./the-above.clif

Expected Results

The test to pass

Actual Results

Qemu crashes with an illegal instruction

     Running `qemu-aarch64 -L /usr/aarch64-linux-gnu -E LD_LIBRARY_PATH=/usr/aarch64-linux-gnu/lib /mnt/c/Users/Afonso/CLionProjects/wasmtime/target/aarch64-unknown-linux-gnu/debug/clif-util test ./filetests/filetests/runtes
ts/simd-vanytrue.clif`
skipped ./filetests/filetests/runtests/simd-vanytrue.clif: host can't run X86_64 programs
skipped ./filetests/filetests/runtests/simd-vanytrue.clif: host can't run X86_64 programs
skipped ./filetests/filetests/runtests/simd-vanytrue.clif: host can't run X86_64 programs
qemu: uncaught target signal 4 (Illegal instruction) - core dumped
Illegal instruction

Versions and Environment

Cranelift version or commit: main
Operating system: linux
Architecture: aarch64

Extra Info

Disassembly:

PS C:\Users\Afonso\CLionProjects\wasmtime\cranelift> cargo run -- compile -D --target aarch64 .\filetests\filetests\runtests\simd-vanytrue.clif
    Finished dev [unoptimized + debuginfo] target(s) in 0.29s
     Running `C:\Users\Afonso\CLionProjects\wasmtime\target\debug\clif-util.exe compile -D --target aarch64 .\filetests\filetests\runtests\simd-vanytrue.clif`
.byte 0, 228, 0, 79, 0, 164, 224, 110, 0, 60, 8, 78, 31, 0, 0, 241, 224, 7, 159, 154, 192, 3, 95, 214

Disassembly of 24 bytes:
   0:   00 e4 00 4f             movi    v0.16b, #0
   4:   00 a4 e0 6e             .byte   0x00, 0xa4, 0xe0, 0x6e
   8:   00 3c 08 4e             mov     x0, v0.d[0]
   c:   1f 00 00 f1             cmp     x0, #0
  10:   e0 07 9f 9a             cset    x0, ne
  14:   c0 03 5f d6             ret

A test suite with vany_true tests is introduced as part of #3304

view this post on Zulip Wasmtime GitHub notifications bot (Sep 06 2021 at 11:24):

afonso360 labeled issue #3305:

Hey!

.clif Test Case

function %vany_true_b64x2() -> b1 {
block0:
    v0 = vconst.b64x2 [false false]
    v1 = vany_true v0
    return v1
}
; run: %vany_true_b64x2() == false

Steps to Reproduce

clif-util test ./the-above.clif

Expected Results

The test to pass

Actual Results

Qemu crashes with an illegal instruction

     Running `qemu-aarch64 -L /usr/aarch64-linux-gnu -E LD_LIBRARY_PATH=/usr/aarch64-linux-gnu/lib /mnt/c/Users/Afonso/CLionProjects/wasmtime/target/aarch64-unknown-linux-gnu/debug/clif-util test ./filetests/filetests/runtes
ts/simd-vanytrue.clif`
skipped ./filetests/filetests/runtests/simd-vanytrue.clif: host can't run X86_64 programs
skipped ./filetests/filetests/runtests/simd-vanytrue.clif: host can't run X86_64 programs
skipped ./filetests/filetests/runtests/simd-vanytrue.clif: host can't run X86_64 programs
qemu: uncaught target signal 4 (Illegal instruction) - core dumped
Illegal instruction

Versions and Environment

Cranelift version or commit: main
Operating system: linux
Architecture: aarch64

Extra Info

Disassembly:

PS C:\Users\Afonso\CLionProjects\wasmtime\cranelift> cargo run -- compile -D --target aarch64 .\filetests\filetests\runtests\simd-vanytrue.clif
    Finished dev [unoptimized + debuginfo] target(s) in 0.29s
     Running `C:\Users\Afonso\CLionProjects\wasmtime\target\debug\clif-util.exe compile -D --target aarch64 .\filetests\filetests\runtests\simd-vanytrue.clif`
.byte 0, 228, 0, 79, 0, 164, 224, 110, 0, 60, 8, 78, 31, 0, 0, 241, 224, 7, 159, 154, 192, 3, 95, 214

Disassembly of 24 bytes:
   0:   00 e4 00 4f             movi    v0.16b, #0
   4:   00 a4 e0 6e             .byte   0x00, 0xa4, 0xe0, 0x6e
   8:   00 3c 08 4e             mov     x0, v0.d[0]
   c:   1f 00 00 f1             cmp     x0, #0
  10:   e0 07 9f 9a             cset    x0, ne
  14:   c0 03 5f d6             ret

A test suite with vany_true tests is introduced as part of #3304

view this post on Zulip Wasmtime GitHub notifications bot (Sep 06 2021 at 11:30):

afonso360 edited issue #3305:

Hey!

Looks like vany_true is producing a wrong instruction for b64x2. It works for b8x16, b16x8 and b32x4.

.clif Test Case

function %vany_true_b64x2() -> b1 {
block0:
    v0 = vconst.b64x2 [false false]
    v1 = vany_true v0
    return v1
}
; run: %vany_true_b64x2() == false

Steps to Reproduce

clif-util test ./the-above.clif

Expected Results

The test to pass

Actual Results

Qemu crashes with an illegal instruction

     Running `qemu-aarch64 -L /usr/aarch64-linux-gnu -E LD_LIBRARY_PATH=/usr/aarch64-linux-gnu/lib /mnt/c/Users/Afonso/CLionProjects/wasmtime/target/aarch64-unknown-linux-gnu/debug/clif-util test ./filetests/filetests/runtes
ts/simd-vanytrue.clif`
skipped ./filetests/filetests/runtests/simd-vanytrue.clif: host can't run X86_64 programs
skipped ./filetests/filetests/runtests/simd-vanytrue.clif: host can't run X86_64 programs
skipped ./filetests/filetests/runtests/simd-vanytrue.clif: host can't run X86_64 programs
qemu: uncaught target signal 4 (Illegal instruction) - core dumped
Illegal instruction

Versions and Environment

Cranelift version or commit: main
Operating system: linux
Architecture: aarch64

Extra Info

Disassembly:

PS C:\Users\Afonso\CLionProjects\wasmtime\cranelift> cargo run -- compile -D --target aarch64 .\filetests\filetests\runtests\simd-vanytrue.clif
    Finished dev [unoptimized + debuginfo] target(s) in 0.29s
     Running `C:\Users\Afonso\CLionProjects\wasmtime\target\debug\clif-util.exe compile -D --target aarch64 .\filetests\filetests\runtests\simd-vanytrue.clif`
.byte 0, 228, 0, 79, 0, 164, 224, 110, 0, 60, 8, 78, 31, 0, 0, 241, 224, 7, 159, 154, 192, 3, 95, 214

Disassembly of 24 bytes:
   0:   00 e4 00 4f             movi    v0.16b, #0
   4:   00 a4 e0 6e             .byte   0x00, 0xa4, 0xe0, 0x6e
   8:   00 3c 08 4e             mov     x0, v0.d[0]
   c:   1f 00 00 f1             cmp     x0, #0
  10:   e0 07 9f 9a             cset    x0, ne
  14:   c0 03 5f d6             ret

A test suite with vany_true tests is introduced as part of #3304

view this post on Zulip Wasmtime GitHub notifications bot (Sep 06 2021 at 12:22):

akirilov-arm labeled issue #3305:

Hey!

Looks like vany_true is producing a wrong instruction for b64x2. It works for b8x16, b16x8 and b32x4.

.clif Test Case

function %vany_true_b64x2() -> b1 {
block0:
    v0 = vconst.b64x2 [false false]
    v1 = vany_true v0
    return v1
}
; run: %vany_true_b64x2() == false

Steps to Reproduce

clif-util test ./the-above.clif

Expected Results

The test to pass

Actual Results

Qemu crashes with an illegal instruction

     Running `qemu-aarch64 -L /usr/aarch64-linux-gnu -E LD_LIBRARY_PATH=/usr/aarch64-linux-gnu/lib /mnt/c/Users/Afonso/CLionProjects/wasmtime/target/aarch64-unknown-linux-gnu/debug/clif-util test ./filetests/filetests/runtes
ts/simd-vanytrue.clif`
skipped ./filetests/filetests/runtests/simd-vanytrue.clif: host can't run X86_64 programs
skipped ./filetests/filetests/runtests/simd-vanytrue.clif: host can't run X86_64 programs
skipped ./filetests/filetests/runtests/simd-vanytrue.clif: host can't run X86_64 programs
qemu: uncaught target signal 4 (Illegal instruction) - core dumped
Illegal instruction

Versions and Environment

Cranelift version or commit: main
Operating system: linux
Architecture: aarch64

Extra Info

Disassembly:

PS C:\Users\Afonso\CLionProjects\wasmtime\cranelift> cargo run -- compile -D --target aarch64 .\filetests\filetests\runtests\simd-vanytrue.clif
    Finished dev [unoptimized + debuginfo] target(s) in 0.29s
     Running `C:\Users\Afonso\CLionProjects\wasmtime\target\debug\clif-util.exe compile -D --target aarch64 .\filetests\filetests\runtests\simd-vanytrue.clif`
.byte 0, 228, 0, 79, 0, 164, 224, 110, 0, 60, 8, 78, 31, 0, 0, 241, 224, 7, 159, 154, 192, 3, 95, 214

Disassembly of 24 bytes:
   0:   00 e4 00 4f             movi    v0.16b, #0
   4:   00 a4 e0 6e             .byte   0x00, 0xa4, 0xe0, 0x6e
   8:   00 3c 08 4e             mov     x0, v0.d[0]
   c:   1f 00 00 f1             cmp     x0, #0
  10:   e0 07 9f 9a             cset    x0, ne
  14:   c0 03 5f d6             ret

A test suite with vany_true tests is introduced as part of #3304

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

cfallin commented on issue #3305:

That's surprising -- thank you for this report! cc @akirilov-arm or @sparker-arm -- thoughts?

view this post on Zulip Wasmtime GitHub notifications bot (Sep 07 2021 at 17:27):

akirilov-arm commented on issue #3305:

It is just an oversight - we have been relying on the WebAssembly tests, which cover only the I8X16 type (because the lane sizes do not matter actually - the operation is equivalent to checking if there is a non-zero bit anywhere in the vector). There is also a wart in the ISA - the vector pairwise instructions (which we use) do not support 64-bit elements consistently. Looking at the current implementation, the fix should be really simple (untested code):

let s = VectorSize::from_ty(ctx.input_ty(insn, 0));
let size = if s == VectorSize::Size64x2 {
  VectorSize::Size32x4
} else {
  s
};

(since vany_true is a polymorphic operation, I still prefer to have VectorSize::from_ty() detect any unexpected types such as vectors that are larger than 128 bits)

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

cfallin closed issue #3305:

Hey!

Looks like vany_true is producing a wrong instruction for b64x2. It works for b8x16, b16x8 and b32x4.

.clif Test Case

function %vany_true_b64x2() -> b1 {
block0:
    v0 = vconst.b64x2 [false false]
    v1 = vany_true v0
    return v1
}
; run: %vany_true_b64x2() == false

Steps to Reproduce

clif-util test ./the-above.clif

Expected Results

The test to pass

Actual Results

Qemu crashes with an illegal instruction

     Running `qemu-aarch64 -L /usr/aarch64-linux-gnu -E LD_LIBRARY_PATH=/usr/aarch64-linux-gnu/lib /mnt/c/Users/Afonso/CLionProjects/wasmtime/target/aarch64-unknown-linux-gnu/debug/clif-util test ./filetests/filetests/runtes
ts/simd-vanytrue.clif`
skipped ./filetests/filetests/runtests/simd-vanytrue.clif: host can't run X86_64 programs
skipped ./filetests/filetests/runtests/simd-vanytrue.clif: host can't run X86_64 programs
skipped ./filetests/filetests/runtests/simd-vanytrue.clif: host can't run X86_64 programs
qemu: uncaught target signal 4 (Illegal instruction) - core dumped
Illegal instruction

Versions and Environment

Cranelift version or commit: main
Operating system: linux
Architecture: aarch64

Extra Info

Disassembly:

PS C:\Users\Afonso\CLionProjects\wasmtime\cranelift> cargo run -- compile -D --target aarch64 .\filetests\filetests\runtests\simd-vanytrue.clif
    Finished dev [unoptimized + debuginfo] target(s) in 0.29s
     Running `C:\Users\Afonso\CLionProjects\wasmtime\target\debug\clif-util.exe compile -D --target aarch64 .\filetests\filetests\runtests\simd-vanytrue.clif`
.byte 0, 228, 0, 79, 0, 164, 224, 110, 0, 60, 8, 78, 31, 0, 0, 241, 224, 7, 159, 154, 192, 3, 95, 214

Disassembly of 24 bytes:
   0:   00 e4 00 4f             movi    v0.16b, #0
   4:   00 a4 e0 6e             .byte   0x00, 0xa4, 0xe0, 0x6e
   8:   00 3c 08 4e             mov     x0, v0.d[0]
   c:   1f 00 00 f1             cmp     x0, #0
  10:   e0 07 9f 9a             cset    x0, ne
  14:   c0 03 5f d6             ret

A test suite with vany_true tests is introduced as part of #3304


Last updated: Nov 22 2024 at 16:03 UTC