Skip to content

Commit

Permalink
fix: RUN-1002: Enable WebAssembly SIMD in optimization pass (#58)
Browse files Browse the repository at this point in the history
* Fix clippy

* fix: RUN-1002: Align WebAssembly Features with IC
  • Loading branch information
dfinity-berestovskyy authored Jun 27, 2024
1 parent 2eb0900 commit 2d0707f
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/instrumentation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ pub fn instrument(m: &mut Module, config: Config) -> Result<(), String> {
&& id != dynamic_counter_func
&& id != dynamic_counter64_func
{
let is_partial_tracing = trace_only_ids.get(&id).is_some();
let is_partial_tracing = trace_only_ids.contains(&id);
inject_profiling_prints(&m.types, printer, id, func, is_partial_tracing, &vars);
}
}
Expand Down
9 changes: 9 additions & 0 deletions src/optimize.rs
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,15 @@ pub fn optimize(
if let Some(max_size) = always_inline_max_function_size {
optimizations.always_inline_max_size(*max_size);
}
// The feature set should be align with IC `wasmtime` validation config:
// https://github.com/dfinity/ic/blob/6a6470d705a0f36fb94743b12892280409f85688/rs/embedders/src/wasm_utils/validation.rs#L1385
optimizations.enable_feature(wasm_opt::Feature::MutableGlobals);
optimizations.enable_feature(wasm_opt::Feature::TruncSat);
optimizations.enable_feature(wasm_opt::Feature::Simd);
optimizations.enable_feature(wasm_opt::Feature::BulkMemory);
optimizations.enable_feature(wasm_opt::Feature::SignExt);
optimizations.enable_feature(wasm_opt::Feature::ReferenceTypes);
optimizations.enable_feature(wasm_opt::Feature::Memory64);
optimizations.run(temp_file.path(), temp_file.path())?;

// read optimized wasm back in from temp file
Expand Down

0 comments on commit 2d0707f

Please sign in to comment.