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

Incorrect Handling of SIMD v128 Return Value #3963

Open
Q1IQ opened this issue Dec 17, 2024 · 5 comments
Open

Incorrect Handling of SIMD v128 Return Value #3963

Q1IQ opened this issue Dec 17, 2024 · 5 comments

Comments

@Q1IQ
Copy link

Q1IQ commented Dec 17, 2024

Subject of the issue

WasmEdge fails to handle v128 return values correctly

Test case

program.wasm.txt

Your environment

  • os: Ubuntu 20.04
  • cpu: amd64
  • WAMR version: iwasm 1.2.3
  • command: iwasm --interp ./program.wasm

Steps to reproduce

Run the following wasm module:

(module
  (memory 1)
  (func $return_v128 (result v128)
    (v128.const i32x4 0x00000004 0x34567890 0x66666666 0x77777777)
 )
  (export "main" (func $return_v128))
)

Observed output:

iwasm --interp  -f main ./program.wasm
Segmentation fault (core dumped)

Expected behavior

The v128 value should be returned correctly, like it can correctly process i32.

(module
  (memory 1)
  (func $func1 (result i32)
    i32.const 1234
 )
  (export "main" (func $func1))
)
iwasm --interp  -f main program.wasm
0x1234:i32
@lum1n0us
Copy link
Collaborator

@Q1IQ SIMD on interp is currently in development. You may want to try again using the development branch. dev/simd_for_interp

@Zzzabiyaka @loganek Just FYI.

@Zzzabiyaka
Copy link
Contributor

Hi
Just fyi I would expect this branch to be merge-ready in January

@lum1n0us
Copy link
Collaborator

iwasm --fast-jit ./program.wasm

SIMD is not supported on the fast-jit. Only llvm-jit and aot support SIMD opcodes.

@Q1IQ
Copy link
Author

Q1IQ commented Dec 18, 2024

interp should at least output a hint like "unsupported opcode" similar to fast-jit, instead of directly segmentation fault.

$ iwasm --fast-jit  -f  main ./program.wasm
fast jit compilation failed: Error: unsupported opcode
Exception: failed to compile fast jit function
fast jit compilation failed: Error: unsupported opcode
failed to compile fast jit function 0
$ iwasm --interp  -f main./program.wasm
Segmentation fault (core dumped)

@Zzzabiyaka
Copy link
Contributor

interp should at least output a hint like "unsupported opcode" similar to fast-jit, instead of directly segmentation fault.


$ iwasm --fast-jit  -f  main ./program.wasm

fast jit compilation failed: Error: unsupported opcode

Exception: failed to compile fast jit function

fast jit compilation failed: Error: unsupported opcode

failed to compile fast jit function 0

$ iwasm --interp  -f main./program.wasm

Segmentation fault (core dumped)

I think for fast interp it might not be needed right now given we expect to deliver simd there in about a month or so

For classic interp maybe it'd be helpful

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

No branches or pull requests

3 participants