WasmEdge icon indicating copy to clipboard operation
WasmEdge copied to clipboard

bug: Inconsistent output from WasmEdge interpreter and jit modes

Open teyahb8 opened this issue 5 months ago • 2 comments

Summary

I executed the following test case with different runtimes like Wasmtime, Wasmer, WAMR, and WasmEdge. Other runtimes and WasmEdge's compiled mode produce the same number whereas WasmEdge's intrepreter mode produces different numbers.

Test case:

(module
  (type (;0;) (func))
  (type (;1;) (func (result v128)))
  (export "main" (func 0))
  (export "to_test" (func 0))
  (func (;0;) (type 1) (result v128)
    v128.const i32x4 0xffffffff 0xffffffff 0xffffffff 0xffffffff
    v128.const i32x4 0xffffffff 0xffffffff 0xffffffff 0xffff60ff
    f64x2.add
  )
)

Current State

Outputs: 340279142017811482847777199818813734911

Expected State

Should output: 340282366920938463463374607431768211455

Reproduction steps

  1. Run: wasmedge --enable-all run test.wasm to_test

Screenshots

No response

Any logs you want to share for showing the specific issue

Can you please confirm if this looks like a bug? By the way, can you please confirm if running wasmedge --enable-all ... without the --force-interpreter flag enables the JIT mode? Thanks in advance.

Components

CLI

WasmEdge Version or Commit you used

0.14.1-271-ga89c176f

Operating system information

Ubuntu 22.04

Hardware Architecture

x86_64

Compiler flags and options

No response

teyahb8 avatar Jul 11 '25 04:07 teyahb8

Hi @teyahb8,
There are two types of wasm files:

  1. Pure wasm
  2. Compiled wasm, which can be created with wasmedge compile input.wasm compiled.wasm

If you provide a pure wasm, the default mode is interpretation.
If you provide a compiled wasm, the system will first attempt to load and execute the AOT section, and it may fall back to interpretation if the loading process fails.
Using --force-interpreter instructs wasmedge to use interpretation mode regardless of whether the input is pure or compiled wasm.

The JIT mode is still experimental, so you need to specify --enable-jit to enable it.
--enable-all is not an option for execution modes; it is for the proposals.

hydai avatar Jul 11 '25 04:07 hydai

Thanks for the clarification, @hydai. Looking forward to hearing back about your thoughts on this bug. Many thanks.

teyahb8 avatar Jul 11 '25 04:07 teyahb8