Add option to enable pulley support for pre-compilation and runtime of modules and components#358
Conversation
There was a problem hiding this comment.
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.
one small comment about version checking
There was a problem hiding this comment.
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
0e540e8 to
656ffaf
Compare
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 10 out of 11 changed files in this pull request and generated 6 comments.
Comments suppressed due to low confidence (1)
src/hyperlight_wasm_aot/src/main.rs:174
- This unconditional
println!("{}", error_message)adds noisy stdout output and can duplicate the latereprintln!/parsed-version output. Consider removing it or gating it behind a verbose/debug flag, and prefer stderr for unexpected errors.
let error_message = e.to_string();
println!("{}", error_message);
if !error_message.starts_with(
"Module was compiled with incompatible Wasmtime version",
) {
eprintln!("{}", error_message);
return;
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
656ffaf to
c369a0f
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>
c369a0f to
734fb51
Compare
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.To check a module's compilation option there's no need to provide the
--pulleyoption, it automatically infers it from the ELFs flags.This also extends the
heapsize for the debug modules, which are larger than the already assigned size