-
Notifications
You must be signed in to change notification settings - Fork 101
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
Compile rustc using cg_clif #743
Comments
The problem is |
Filled cryptocorrosion/cryptocorrosion#25 for running without SIMD. |
Pushed 6129921 with some fixes necessary for this. |
Now there are two const_err's which don't make sense:
|
Marked as bug because of the impossible |
I got rustc bootstrapping using cg_clif. Unfortunately the rustc built using cg_clif crashes when you try to use it. So far I have been able to pin point that Rust fork: bjorn3/rust@e5c3091 (branch cg_clif_subtree) config.toml: [rust]
codegen-backends = ["cranelift"]
deny-warnings = false |
Rust fork: bjorn3/rust@42728c0 Edit config.toml: [build]
full-bootstrap = true
[rust]
codegen-backends = ["cranelift"]
deny-warnings = false Current failure:
|
The ICE happens at https://github.com/bjorn3/rust/blob/42728c0730229daad922372f76e08f5e40c31aa1/src/librustc_mir_build/build/matches/test.rs#L227. I am probably handling matching on |
Minimal repro for ICE: fn is_true(a: true) -> u8 {
if a { 1 } else { 0 }
} |
Minimal miscompilation repro: fn main() {
let options = [1u128];
match options[0] {
1 => (),
0 => loop {},
v => panic(v),
};
}
fn panic(v: u128) -> !{
panic!("{}", v)
} clif ir for `main`
|
Got to metadata writing with the miscompilation fixed. It panicked in |
It finally works! 🎉 🎈 🚀 🎈 🎉 Rust fork: bjorn3/rust@9a1facc Edit config.toml: [build]
full-bootstrap = true
[rust]
codegen-backends = ["cranelift"]
deny-warnings = false
|
|
bytecodealliance/wasmtime#1939 got merged. The only Cranelift blocker is now bytecodealliance/wasmtime#1559. |
bytecodealliance/wasmtime#1559. has been merged. As of #1068 it is no longer necessary to patch cg_clif or Cranelift. |
what's left for compiling rustc then? |
|
With #1070 merged, only bjorn3/rust@3b4a3d6...9a1facc should be necessary now. |
I rebased and cleaned up the rust branch (now called
|
I’m curious - how much longer are those times with llvm? |
Stage 0 is using a cg_llvm compiled rustc with cg_llvm as backend. This is representative for all stages when using cg_llvm. Stage 1 is using a cg_llvm compiled rustc with cg_clif as backend. Stage 2 is using a cg_clif compiled rustc with cg_clif as backend. The difference between stage 0 and stage 1 is the compile time speedup of cg_clif over release mode cg_llvm. The difference between stage 1 and stage 2 is the runtime slowdown of cg_clif over release mode cg_llvm. This difference is much less when using cg_llvm in debug mode. I don't volunteer for testing the difference between cg_clif and debug mode cg_llvm as it would take me ~4-5h, during which I can't use my computer at all. :) |
Brilliant - thank you for the explanation! Incredible results. |
@bjorn3 in stage 0, are you re-compiling llvm from scratch or do you have it cached? IIRC it's compiled only once for all three stages so to give a fair comparison between cg_llvm and cg_clif, one needs to ensure it's not compiled during the stage 0 build but cached. |
I didn't compile LLVM at all. Stage 0 is the compilation of a rustc that only supports cg_clif using the bootstrap compiler. |
@vultix On reddit you said 7x faster. This is pretty much comparing apples to oranges. cg_clif compiles code that runs a bit slower than debug mode cg_llvm. The compilation of rustc was however with release mode cg_llvm. This seems to have caused a bit of confusion on reddit. |
@bjorn3 amazing! |
Ah, my apologies for confusing everyone. That distinction never occurred to me |
After #78624 all you need to do is apply diff --git a/compiler/rustc_data_structures/Cargo.toml b/compiler/rustc_data_structures/Cargo.toml
index 23e689fcae7..5f077b765b6 100644
--- a/compiler/rustc_data_structures/Cargo.toml
+++ b/compiler/rustc_data_structures/Cargo.toml
@@ -32,7 +32,7 @@ tempfile = "3.0.5"
[dependencies.parking_lot]
version = "0.11"
-features = ["nightly"]
+#features = ["nightly"]
[target.'cfg(windows)'.dependencies]
winapi = { version = "0.3", features = ["fileapi", "psapi"] } and run $ cat > config.toml <<EOF
[build]
full-bootstrap = true
[rust]
codegen-backends = ["cranelift"]
EOF
$ ./x.py build --stage 2 |
…=jyn514 Sync rustc_codegen_cranelift This fixes bootstrapping of rustc using cg_clif again. It regressed a while before rust-lang#77975 got merged. Fixes https://github.com/bjorn3/rustc_codegen_cranelift/issues/743
…=jyn514 Sync rustc_codegen_cranelift This fixes bootstrapping of rustc using cg_clif again. It regressed a while before rust-lang#77975 got merged. Fixes https://github.com/bjorn3/rustc_codegen_cranelift/issues/743
Fixed in https://github.com/bjorn3/rustc_codegen_cranelift/pull/1099 and added a test in bjorn3@54b1d10. |
Currently fails while compiling libcore using the new compiler with:
The text was updated successfully, but these errors were encountered: