Skip to content
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

Cranelift: enable SIMD based on actual Wasm features #2224

Merged
merged 12 commits into from
May 15, 2021
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 15 additions & 12 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

24 changes: 12 additions & 12 deletions fuzz/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions lib/compiler-cranelift/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ edition = "2018"
wasmer-compiler = { path = "../compiler", version = "1.0.2", features = ["translator"], default-features = false }
wasmer-vm = { path = "../vm", version = "1.0.2" }
wasmer-types = { path = "../types", version = "1.0.2", default-features = false, features = ["std"] }
cranelift-entity = { version = "0.70", default-features = false }
cranelift-codegen = { version = "0.70", default-features = false, features = ["x86", "arm64"] }
cranelift-frontend = { version = "0.70", default-features = false }
cranelift-entity = { version = "0.72", default-features = false }
cranelift-codegen = { version = "0.72", default-features = false, features = ["x86", "arm64"] }
cranelift-frontend = { version = "0.72", default-features = false }
tracing = "0.1"
hashbrown = { version = "0.9", optional = true }
rayon = "1.5"
Expand All @@ -29,7 +29,7 @@ loupe = "0.1"

[dev-dependencies]
target-lexicon = { version = "0.11", default-features = false }
cranelift-codegen = { version = "0.70", features = ["enable-serde", "all-arch"] }
cranelift-codegen = { version = "0.72", features = ["enable-serde", "all-arch"] }
lazy_static = "1.4"

[badges]
Expand Down
30 changes: 9 additions & 21 deletions lib/compiler-cranelift/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ pub enum CraneliftOptLevel {
pub struct Cranelift {
enable_nan_canonicalization: bool,
enable_verifier: bool,
enable_simd: bool,
enable_pic: bool,
opt_level: CraneliftOptLevel,
/// The middleware chain.
Expand All @@ -48,7 +47,6 @@ impl Cranelift {
enable_verifier: false,
opt_level: CraneliftOptLevel::Speed,
enable_pic: false,
enable_simd: true,
middlewares: vec![],
}
}
Expand All @@ -62,12 +60,6 @@ impl Cranelift {
self
}

/// Enable SIMD support.
pub fn enable_simd(&mut self, enable: bool) -> &mut Self {
self.enable_simd = enable;
self
}

/// The optimization levels when optimizing the IR.
pub fn opt_level(&mut self, opt_level: CraneliftOptLevel) -> &mut Self {
self.opt_level = opt_level;
Expand Down Expand Up @@ -153,23 +145,19 @@ impl Cranelift {
.set("enable_verifier", enable_verifier)
.expect("should be valid flag");

let opt_level = if self.enable_simd {
"none"
} else {
match self.opt_level {
CraneliftOptLevel::None => "none",
CraneliftOptLevel::Speed => "speed",
CraneliftOptLevel::SpeedAndSize => "speed_and_size",
}
};

flags
.set("opt_level", opt_level)
.set(
"opt_level",
match self.opt_level {
CraneliftOptLevel::None => "none",
CraneliftOptLevel::Speed => "speed",
CraneliftOptLevel::SpeedAndSize => "speed_and_size",
},
)
.expect("should be valid flag");

let enable_simd = if self.enable_simd { "true" } else { "false" };
flags
.set("enable_simd", enable_simd)
.set("enable_simd", "true")
.expect("should be valid flag");

let enable_nan_canonicalization = if self.enable_nan_canonicalization {
Expand Down
Loading