-
Notifications
You must be signed in to change notification settings - Fork 33
Add option to enable pulley support for pre-compilation and runtime of modules and components #358
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
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR adds support for the Pulley interpreter as an alternative to Cranelift for WebAssembly compilation and execution in Hyperlight. Pulley is an interpreted execution mode for WebAssembly that can be enabled at both AOT compilation time and runtime.
Changes:
- Added
--pulleyflag to the AOT compilation tool to target the pulley64 architecture - Added
pulleyfeature flag to enable pulley runtime support in the wasm_runtime and hyperlight_wasm crates - Added Justfile recipes to build and test modules/components with pulley support
Reviewed changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| src/wasm_runtime/src/module.rs | Configures wasmtime engine to use pulley64 target when pulley feature is enabled |
| src/wasm_runtime/src/component.rs | Configures wasmtime engine to use pulley64 target when pulley feature is enabled for component model |
| src/wasm_runtime/build.rs | Adds cfg alias for pulley feature flag |
| src/wasm_runtime/Cargo.toml | Adds pulley feature that enables wasmtime's pulley support |
| src/hyperlight_wasm_aot/src/main.rs | Adds --pulley command-line flag and logic to compile for pulley64 target |
| src/hyperlight_wasm_aot/Cargo.toml | Unconditionally enables pulley feature in wasmtime since AOT tool needs both targets |
| src/hyperlight_wasm/build.rs | Propagates pulley feature flag to wasm_runtime build |
| src/hyperlight_wasm/Cargo.toml | Adds pulley feature flag |
| Justfile | Adds recipes to build and test pulley-compiled modules and components |
Comments suppressed due to low confidence (1)
src/hyperlight_wasm_aot/src/main.rs:194
- When compiling for the pulley target with debug enabled, the code still calls
config.cranelift_opt_level(OptLevel::None). Since pulley is an interpreter that doesn't use Cranelift, this setting may be ignored or could potentially cause issues. Consider wrapping Cranelift-specific configuration in a conditional check to only apply when not using pulley (e.g.,if !pulley { config.cranelift_opt_level(OptLevel::None); }).
if debug {
config.debug_info(true);
config.cranelift_opt_level(OptLevel::None);
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
simongdavies
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
one small comment about version checking
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
Copilot reviewed 9 out of 9 changed files in this pull request and generated 3 comments.
Comments suppressed due to low confidence (1)
src/hyperlight_wasm_aot/src/main.rs:202
- When compiling for pulley64 target with debug enabled, the code sets
cranelift_opt_level(OptLevel::None)which is specific to the Cranelift compiler. This may cause unexpected behavior or errors when using the pulley interpreter. Consider conditionally applying this setting only when not using pulley, or verify that this setting is safely ignored by pulley.
if debug {
config.debug_info(true);
config.cranelift_opt_level(OptLevel::None);
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
51d839b to
da2a8e4
Compare
2567f4a to
0e540e8
Compare
Signed-off-by: Doru Blânzeanu <dblnz@pm.me>
Signed-off-by: Doru Blânzeanu <dblnz@pm.me>
Signed-off-by: Doru Blânzeanu <dblnz@pm.me>
0e540e8 to
656ffaf
Compare
| let mut proto_wasm_sandbox = SandboxBuilder::new() | ||
| .with_guest_input_buffer_size(256 * 1024) | ||
| .with_guest_heap_size(768 * 1024) | ||
| .with_guest_heap_size(1280 * 1024) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pulley debug binaries are really big
This PR adds an option to enable
pulleyinterpreter instead of the defaultcraneliftfor wasmtime.To use
pulleyone needs to:pulley64target. It can be done usinghyperlight-wasm-aot compile --pulleycommandpulleyfeature forhyperlight-wasmto build thewasm_runtimewithpulleyfeature that correctly sets theconfig.target("pulley64")for theConfigpassed to the wasmtimeEngine.