Add egraphs option to Wasmtime config, and add it to fuzzing config generation. (#5067)
* Add egraphs option to Wasmtime config, and add it to fuzzing config generation. This PR adds a wrapper method for Cranelift's `use_egraphs` setting to Wasmtime's `Config`, named `cranelift_use_egraphs` analogously to its existing `cranelift_opt_level`. Eventually this should become a no-op as egraph-based optimization becomes the default, but until then it makes sense to expose this as another kind of optimization option. This PR then adds the option to the `Arbitrary`-based config generation for fuzzing, so compilation with egraphs will be fuzzed (on its own and against other configurations and oracles). * Don't use `NamedTempFile` on Windows It looks like this prevents mmap-ing since the named temporary file holds a `File` open which conflicts with the rights we're trying to open the file for mmap-ing. Instead use a temporary directory to try to fix this issue. Co-authored-by: Alex Crichton <alex@alexcrichton.com>
This commit is contained in:
@@ -853,6 +853,27 @@ impl Config {
|
||||
self
|
||||
}
|
||||
|
||||
/// Configures the Cranelift code generator to use its
|
||||
/// "egraph"-based mid-end optimizer.
|
||||
///
|
||||
/// This optimizer is intended to replace the compiler's more
|
||||
/// traditional pipeline of optimization passes with a unified
|
||||
/// code-rewriting system. It is not yet on by default, but it is
|
||||
/// intended to become the default in a future version. It may
|
||||
/// result in faster code, at the cost of slightly more
|
||||
/// compilation-time work.
|
||||
///
|
||||
/// The default value for this is `false`.
|
||||
#[cfg(compiler)]
|
||||
#[cfg_attr(nightlydoc, doc(cfg(feature = "cranelift")))] // see build.rs
|
||||
pub fn cranelift_use_egraphs(&mut self, enable: bool) -> &mut Self {
|
||||
let val = if enable { "true" } else { "false" };
|
||||
self.compiler_config
|
||||
.settings
|
||||
.insert("use_egraphs".to_string(), val.to_string());
|
||||
self
|
||||
}
|
||||
|
||||
/// Configures whether Cranelift should perform a NaN-canonicalization pass.
|
||||
///
|
||||
/// When Cranelift is used as a code generation backend this will configure
|
||||
|
||||
Reference in New Issue
Block a user