You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Wasmtime: Add (optional) bottom-up function inlining to Wasm compilation (bytecodealliance#11283)
* Wasmtime: Add (optional) bottom-up function inlining to Wasm compilation
This commit plumbs together two pieces of recently-added infrastructure:
1. function inlining in Cranelift, and
2. the parallel bottom-up inlining scheduler in Wasmtime.
Sprinkle some very simple inlining heuristics on top, and this gives us function
inlining in Wasm compilation.
The default Wasmtime configuration does not enable inlining, and when we do
enable it, we only enable it for cross-component calls by default (since
presumably the toolchain that produced a particular core Wasm module, like LLVM,
already performed any inlining that was beneficial within that module, but that
toolchain couldn't know how that Wasm module would be getting linked together
with other modules via component composition, and so it could not have done any
cross-component inlining). For what it is worth, there is a config knob to
enable intra-module function inlining, but this is primarily for use by our
fuzzers, so that they can easily excercise and explore this new inlining
functionality.
All this plumbing required some changes to the `wasmtime_environ::Compiler`
trait, since Winch cannot do inlining but Cranelift can. This is mostly
encapsulated in the new `wasmtime_environ::InliningCompiler` trait, for the most
part. Additionally, we take care not to construct the call graph, or any other
data structures required only by the inliner and not regular compilation, both
when using Winch and when using Cranelift with inlining disabled.
Finally, we add a `disas` test to verify that we successfully inline a series of
calls from a function in one component, to a cross-component adapter function,
to a function in another component. Most test coverage is expected to come from
our fuzzing, however.
* Fix dead code warning when not `cfg(feature = "component-model")`
* fix winch trampoline compilation
* Move CLI options to codegen
* Move parameters into struct
* Use an index set for call-graph construction
* Smuggle inlining heuristic options through cranelift flags
* Remove old CLI flags
* set tunables before settings
* Only configure inlining options for cranelift in fuzzing
0 commit comments