Stream: git-wasmtime

Topic: wasmtime / PR #9947 Make module validation deterministic ...


view this post on Zulip Wasmtime GitHub notifications bot (Jan 08 2025 at 12:15):

michael-weigelt requested wasmtime-core-reviewers for a review on PR #9947.

view this post on Zulip Wasmtime GitHub notifications bot (Jan 08 2025 at 12:15):

michael-weigelt opened PR #9947 from michael-weigelt:mwe/deterministic_validation to bytecodealliance:main:

If a Wasm binary is invalid in several ways, parallel compilation will return a non-deterministic result. We would like to get a deterministic result even in the presence of multiple errors.

This PR addresses that by first materializing all validation results and then returning the first error, if any ('first' with regard to the order of the input vector).

The downside is that we cannot return early when an error is encountered. This slows down the validation for invalid binaries. Since that is not the happy path anyway, I propose to accept the slowdown.

The provided test does not prove determinism, which is hard to do. But it gives _some_ confidence and ensures the behaviour of parallel and sequential compilation do not deviate.

view this post on Zulip Wasmtime GitHub notifications bot (Jan 08 2025 at 12:15):

michael-weigelt requested alexcrichton for a review on PR #9947.

view this post on Zulip Wasmtime GitHub notifications bot (Jan 08 2025 at 12:59):

michael-weigelt edited PR #9947:

If a Wasm binary is invalid in several ways, parallel compilation will return a non-deterministic result. We would like to get a deterministic result even in the presence of multiple errors.

This PR addresses that by first materializing all validation results and then returning the first error, if any ('first' with regard to the order of the input vector).

The downside is that we cannot return early when an error is encountered. This slows down the validation for invalid binaries. Since that is not the happy path anyway, I propose to accept the slowdown.

The provided test does not prove determinism, which is hard to do. But it gives _some_ confidence and ensures the behaviours of parallel and sequential compilation do not deviate.

view this post on Zulip Wasmtime GitHub notifications bot (Jan 08 2025 at 15:33):

alexcrichton submitted PR review:

Thanks for this!

view this post on Zulip Wasmtime GitHub notifications bot (Jan 08 2025 at 17:44):

alexcrichton commented on PR #9947:

Ah the timeout there looks like the new validate_deterministic test is taking awhile in miri, so mind putting #[cfg(not(miri))] on the test?

view this post on Zulip Wasmtime GitHub notifications bot (Jan 08 2025 at 17:44):

alexcrichton commented on PR #9947:

er, actually, #[cfg_attr(miri, ignore)] would probably be better

view this post on Zulip Wasmtime GitHub notifications bot (Jan 09 2025 at 08:37):

michael-weigelt updated PR #9947.

view this post on Zulip Wasmtime GitHub notifications bot (Jan 09 2025 at 08:40):

michael-weigelt updated PR #9947.

view this post on Zulip Wasmtime GitHub notifications bot (Jan 09 2025 at 10:22):

michael-weigelt commented on PR #9947:

@alexcrichton done, and I made the test smaller too.

view this post on Zulip Wasmtime GitHub notifications bot (Jan 09 2025 at 16:10):

alexcrichton merged PR #9947.


Last updated: Jan 24 2025 at 00:11 UTC