Draft: add opt-in generic WebAssembly execution backend#26
Draft
bkmashiro wants to merge 7 commits into
Draft
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR adds an opt-in generic WebAssembly execution backend for Shimmy.
The new backend is enabled only when:
Existing
rpcandfileexecution paths remain the default behavior and continue to requireFUNCTION_COMMAND.The WebAssembly path loads a pre-built
.wasmevaluator module through wazero, keeps a warm instance pool, and restores a memory snapshot after each request so guest-side mutable state does not leak between evaluations.What is included
wasmas an opt-in execution interface.memoryallocevaluateScope / non-goals
This PR intentionally keeps the first WASM backend small and generic.
It does not attempt to migrate existing Lambda Feedback Python evaluators, Pyodide, Lean, Wolfram, Node/TypeScript, or other runtime-heavy evaluators.
The examples in this PR are synthetic Go/Rust/C++ evaluator artifacts used to validate the execution backend and packaging shape. They are not presented as migrations of existing LF evaluator repositories.
Python/Pyodide-style runtime packaging should be handled as a separate follow-up profile once the generic artifact backend is reviewed.
Backwards compatibility
The existing production paths should remain unchanged:
rpc.rpcandfilebackends still requireFUNCTION_COMMAND.FUNCTION_INTERFACE=wasm.In other words, this PR adds a new opt-in backend rather than changing the default evaluator execution model.
Testing
Locally verified:
The demo scripts verify that multiple HTTP requests can hit a warm WASM evaluator while guest global state is reset after each request.
Example observed behavior:
guest_invocation_count = 1guest_invocation_count = 1This confirms snapshot/restore isolation for the demo evaluators.
Notes for reviewers
The most important review areas are probably:
alloc/evaluateadapter ABI is acceptable as Shimmy's internal WASM ABI;FUNCTION_WASM_MODULEvsFUNCTION_COMMANDcompatibility is the right deployment shape;I am opening this as a draft first.