Stream: git-wasmtime

Topic: wasmtime / issue #8399 The outputs of Wasmtime are incon...


view this post on Zulip Wasmtime GitHub notifications bot (Apr 18 2024 at 12:11):

abc767234318 opened issue #8399:

I constructed a wasm binary with an exported function called "main". I compared the outputs of wasmtime and found they are inconsistent across different platforms.
file86.zip

Wasmtime v18.0.2 Ubuntu22.04 x86_64:

wasmtime --invoke main file86.wasm
warning: using `--invoke` with a function that returns values is experimental and may break in the future
667210185897120983469013534608098645
667210185897120983469013534608098645
667210185897120983469013534608098645
667210185897120983469013534608098645
667210185897120983469013534608098645
667210185897120983469013534608098645
667210185897120983469013534608098645

Wasmtime v18.0.2 MacOS arm64:

wasmtime --invoke main file86.wasm
warning: using `--invoke` with a function that returns values is experimental and may break in the future
667210185936411072606488982786049365
667210185936411072606488982786049365
667210185936411072606488982786049365
667210185936411072606488982786049365
667210185936411072606488982786049365
667210185936411072606488982786049365
667210185936411072606488982786049365

view this post on Zulip Wasmtime GitHub notifications bot (Apr 18 2024 at 12:24):

bjorn3 commented on issue #8399:

Does the wasm module look at the raw bits of floats? NaN values are allowed to be non-deterministic by the wasm specification. Different cpu architectures have different handling of NaN values. This may be the cause of the difference here if the answer to my question is true.

view this post on Zulip Wasmtime GitHub notifications bot (Apr 18 2024 at 14:39):

alexcrichton closed issue #8399:

I constructed a wasm binary with an exported function called "main". I compared the outputs of wasmtime and found they are inconsistent across different platforms.
file86.zip

Wasmtime v18.0.2 Ubuntu22.04 x86_64:

wasmtime --invoke main file86.wasm
warning: using `--invoke` with a function that returns values is experimental and may break in the future
667210185897120983469013534608098645
667210185897120983469013534608098645
667210185897120983469013534608098645
667210185897120983469013534608098645
667210185897120983469013534608098645
667210185897120983469013534608098645
667210185897120983469013534608098645

Wasmtime v18.0.2 MacOS arm64:

wasmtime --invoke main file86.wasm
warning: using `--invoke` with a function that returns values is experimental and may break in the future
667210185936411072606488982786049365
667210185936411072606488982786049365
667210185936411072606488982786049365
667210185936411072606488982786049365
667210185936411072606488982786049365
667210185936411072606488982786049365
667210185936411072606488982786049365

view this post on Zulip Wasmtime GitHub notifications bot (Apr 18 2024 at 14:39):

alexcrichton commented on issue #8399:

I can confirm locally that wasmtime run --invoke main -W nan-canonicalization file86.wasm produces the same result on both systems, whereas without it different results are produced. Given that I don't believe that there's a bug here since NaN is allowed to be nondeterministic across platforms and is a known part of the wasm spec.


Last updated: Oct 23 2024 at 20:03 UTC