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

runtime: initial prototype to enable multi-value and reference-types #12198

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

nagisa
Copy link
Collaborator

@nagisa nagisa commented Oct 9, 2024

These WASM extensions are enabled by default in 1.83 release of the Rust compiler.

We have discussed enabling these features between crt members and these are rough conclusions:

  1. The enablement work is probably not super onerous, given that these features were already implemented in wasmer at the time near-vm forked off;
  2. Similarly (to the best of my memory) these features have been implemented in finite-wasm;
  3. However it is much more crucial to actually verify whether the new functionality does not expose new avenues that would permit non-linear compilation times, for example. With multi-value it is now possible for somebody to specify thousands of return values from a single function. Does the compilation (and execution) time remain linear with regards to the number of values here? Does finite-wasm actually handle this correctly too? We appreciated multi-value being disabled last time we were dealing with this class of problems in related areas (e.g. local initialization problem.)
  4. Further, enabling reference-types requires enabling bulk-memory which introduces a new family of primitives for our system: memory.copy (memcpy), memory.fill (memset.) These are new in not only that they are "expensive" instructions that are executed in the host code and need their own fees, but in that their processing time is going to naturally depend on the arguments passed to the functions. We do have some infrastructure for this in finite-wasm (Aggregate instrumentation kind) but it hasn't been tested as rigorously as the other types of instrumentation kinds.
  5. Old versions of the runtime (wasmer0) do not have an implementation for these features at all, however the choice of the runtime used and the validations performed are independent. We already have some precedent in panicking when there's an unsupported combination of the two, but at the same time we have many tests that validate "all types of the VMs." We will have to adjust these tests in a way that's not just disabling coverage for old VMs as changes in mildly related areas can break replayablility where these old versions matter.

These WASM extensions are enabled by default in 1.83 release of the Rust
compiler.

We have discussed enabling these features between crt members and these
are rough conclusions:

1. The enablement work is probably not super onerous, given that these
   features were already implemented in wasmer at the time near-vm
   forked off;
2. Similarly (to the best of my memory) these features have been
   implemented in finite-wasm;
3. However it is much more crucial to actually verify whether the new
   functionality does not expose new avenues that would permit
   non-linear compilation times, for example. With multi-value it is now
   possible for somebody to specify thousands of return values from a
   single function. Does the compilation (and execution) time remain
   linear with regards to the number of values here? Does finite-wasm
   actually handle this correctly too? We appreciated multi-value being
   disabled last time we were dealing with this class of problems in
   related areas (e.g. local initialization problem.)
4. Further, enabling reference-types requires enabling bulk-memory which
   introduces a new family of primitives for our system: `memory.copy`
   (memcpy), `memory.fill` (memset.) These are new in not only that they
   are "expensive" instructions that are executed in the host code and
   need their own fees, but in that their processing time is going to
   naturally depend on the arguments passed to the functions. We do have
   some infrastructure for this in finite-wasm (Aggregate
   instrumentation kind) but it hasn't been tested as rigorously as the
   other types of instrumentation kinds.
5. Old versions of the runtime (wasmer0) do not have an implementation
   for these features at all, however the choice of the runtime used and
   the validations performed are independent. We already have some
   precedent in panicking when there's an unsupported combination of the
   two, but at the same time we have many tests that validate "all
   types of the VMs." We will have to adjust these tests in a way that's
   not just disabling coverage for old VMs as changes in mildly related
   areas can break replayablility where these old versions matter.
@nagisa nagisa requested a review from a team as a code owner October 9, 2024 10:03
@nagisa nagisa requested a review from akhi3030 October 9, 2024 10:03
@nagisa nagisa marked this pull request as draft October 9, 2024 10:04
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

Successfully merging this pull request may close these issues.

1 participant