Stream: git-wasmtime

Topic: wasmtime / PR #9472 winch: Implement Fuel-Based Interruption


view this post on Zulip Wasmtime GitHub notifications bot (Oct 15 2024 at 23:27):

saulecabrera opened PR #9472 from saulecabrera:winch-fuel to bytecodealliance:main:

Closes: https://github.com/bytecodealliance/wasmtime/issues/8090

This commit introduces the initial implementation of fuel-based interruption in Winch.

To maintain consistency with existing fuel semantics, this implementation closely follows the Wasmtime/Cranelift approach, with the following exception:

This commit also includes a small refactoring in the visitor, which introduces more generic "visitor hook" which enable handling the invariants that need to happen before and after emitting machine code for each Wasm operator.

<!--
Please make sure you include the following information:

Our development process is documented in the Wasmtime book:
https://docs.wasmtime.dev/contributing-development-process.html

Please ensure all communication follows the code of conduct:
https://github.com/bytecodealliance/wasmtime/blob/main/CODE_OF_CONDUCT.md
-->

view this post on Zulip Wasmtime GitHub notifications bot (Oct 15 2024 at 23:27):

saulecabrera requested elliottt for a review on PR #9472.

view this post on Zulip Wasmtime GitHub notifications bot (Oct 15 2024 at 23:27):

saulecabrera requested wasmtime-compiler-reviewers for a review on PR #9472.

view this post on Zulip Wasmtime GitHub notifications bot (Oct 15 2024 at 23:27):

saulecabrera requested wasmtime-core-reviewers for a review on PR #9472.

view this post on Zulip Wasmtime GitHub notifications bot (Oct 16 2024 at 02:10):

github-actions[bot] commented on PR #9472:

Subscribe to Label Action

cc @saulecabrera

<details>
This issue or pull request has been labeled: "winch"

Thus the following users have been cc'd because of the following labels:

To subscribe or unsubscribe from this label, edit the <code>.github/subscribe-to-label.json</code> configuration file.

Learn more.
</details>

view this post on Zulip Wasmtime GitHub notifications bot (Oct 16 2024 at 03:28):

alexcrichton submitted PR review:

Looks reasonable to me, tahnks for this!

One thought I had reading over this was that this should probably update some documentation somewhere around enabling fuel that Winch is supported. I don't think that's quite right though since we don't exhaustively document Winch's support on all other Config options, so documenting this as a one-off doesn't feel right. That being said it led me to another thought though that there was no change here associated with "ok actually allow Winch to use fuel". This means that it looks like we were silently accepting fuel-enabled-Config even though Winch didn't support it.

To handle that, either here or as a follow-up, mind updating the Compiler for ... in winch-codegen? IIRC there's a method set_tunables and it might be good to have Winch-specific logic to reject configurations that Winch doesn't support. For example Winch doesn't support generate_native_debuginfo or epoch_interruption. This might help move some code out of Config::validate as well and keep it in a Winch-specific location.

view this post on Zulip Wasmtime GitHub notifications bot (Oct 16 2024 at 03:28):

alexcrichton created PR review comment:

stray ;

view this post on Zulip Wasmtime GitHub notifications bot (Oct 16 2024 at 03:28):

alexcrichton created PR review comment:

Out of curiosity was the vmruntime_limits cache-of-sorts here added because the original methods were too slow? Or because the original self.vmoffsets.ptr wasn't accessible when the cache was needed?

view this post on Zulip Wasmtime GitHub notifications bot (Oct 16 2024 at 03:28):

alexcrichton submitted PR review:

Looks reasonable to me, thanks for this!

One thought I had reading over this was that this should probably update some documentation somewhere around enabling fuel that Winch is supported. I don't think that's quite right though since we don't exhaustively document Winch's support on all other Config options, so documenting this as a one-off doesn't feel right. That being said it led me to another thought though that there was no change here associated with "ok actually allow Winch to use fuel". This means that it looks like we were silently accepting fuel-enabled-Config even though Winch didn't support it.

To handle that, either here or as a follow-up, mind updating the Compiler for ... in winch-codegen? IIRC there's a method set_tunables and it might be good to have Winch-specific logic to reject configurations that Winch doesn't support. For example Winch doesn't support generate_native_debuginfo or epoch_interruption. This might help move some code out of Config::validate as well and keep it in a Winch-specific location.

view this post on Zulip Wasmtime GitHub notifications bot (Oct 16 2024 at 11:49):

saulecabrera submitted PR review.

view this post on Zulip Wasmtime GitHub notifications bot (Oct 16 2024 at 11:49):

saulecabrera created PR review comment:

Not really, I didn't perform extensive benchmarking here, I think it might be fine to immediately resolve the limits when constructing FuncEnv.

view this post on Zulip Wasmtime GitHub notifications bot (Oct 16 2024 at 13:03):

saulecabrera commented on PR #9472:

Thanks for the review @alexcrichton.

One thought I had reading over this was that this should probably update some documentation somewhere around enabling fuel that Winch is supported. I don't think that's quite right though since we don't exhaustively document Winch's support on all other Config options, so documenting this as a one-off doesn't feel right. That being said it led me to another thought though that there was no change here associated with "ok actually allow Winch to use fuel". This means that it looks like we were silently accepting fuel-enabled-Config even though Winch didn't support it.

I think it's reasonable to audit the Config options and be explicit in the documentation regarding those options that are not fully supported by Winch. I'll do that in a separate PR paired with the change to perform winch-specific configuration validation in set_tunables in Winch's compiler implementation.

view this post on Zulip Wasmtime GitHub notifications bot (Oct 16 2024 at 22:23):

alexcrichton submitted PR review.

view this post on Zulip Wasmtime GitHub notifications bot (Oct 16 2024 at 22:23):

alexcrichton created PR review comment:

Ah ok makes sense, I ask because it felt a bit unidiomatic to copy a few fields from VMOffsets into a separate structure vs threading around the VMOffsets themselves, but it's also a pretty minor point

view this post on Zulip Wasmtime GitHub notifications bot (Oct 20 2024 at 21:34):

saulecabrera commented on PR #9472:

@alexcrichton I've opened https://github.com/bytecodealliance/wasmtime/pull/9490 -- once https://github.com/bytecodealliance/wasmtime/pull/9490 lands, I'll rebase and land this change.

view this post on Zulip Wasmtime GitHub notifications bot (Oct 21 2024 at 17:03):

saulecabrera updated PR #9472.

view this post on Zulip Wasmtime GitHub notifications bot (Oct 22 2024 at 17:57):

saulecabrera updated PR #9472.

view this post on Zulip Wasmtime GitHub notifications bot (Oct 22 2024 at 19:01):

saulecabrera updated PR #9472.

view this post on Zulip Wasmtime GitHub notifications bot (Oct 22 2024 at 19:42):

saulecabrera merged PR #9472.


Last updated: Nov 22 2024 at 16:03 UTC