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

egraph-based midend: draw the rest of the owl (productionized). #4953

Merged
merged 61 commits into from
Oct 12, 2022
Merged
Show file tree
Hide file tree
Changes from 42 commits
Commits
Show all changes
61 commits
Select commit Hold shift + click to select a range
e54cdef
egraph-based midend: draw the rest of the owl.
cfallin Sep 23, 2022
e43bc64
Rename `egg` submodule of cranelift-codegen to `egraph`.
cfallin Sep 26, 2022
e01e8f1
Apply some feedback from @jsharp during code walkthrough.
cfallin Sep 28, 2022
8f9b5ad
Remove recursion from find_best_node by doing a single pass.
cfallin Sep 30, 2022
0b954b6
Make elaboration non-recursive.
cfallin Sep 30, 2022
58b509f
Make elaboration traversal of the domtree non-recursive/stack-safe.
cfallin Sep 30, 2022
9275d0c
Work analysis logic in Cranelift-side egraph glue into a general anal…
cfallin Oct 4, 2022
01d491a
Apply static recursion limit to rule application.
cfallin Oct 4, 2022
dbbfd8b
Merge remote-tracking branch 'upstream/main' into mid-end
cfallin Oct 4, 2022
a53984d
Fix aarch64 wrt dynamic-vector support -- broken rebase.
cfallin Oct 4, 2022
97bc58b
Topo-sort cranelift-egraph before cranelift-codegen in publish script…
cfallin Oct 4, 2022
8681c76
Fix multi-result call testcase.
cfallin Oct 4, 2022
c211c56
Include `cranelift-egraph` in `PUBLISHED_CRATES`.
cfallin Oct 4, 2022
d673f95
Fix atomic_rmw: not really a load.
cfallin Oct 4, 2022
9e68cc6
Merge remote-tracking branch 'upstream/main' into mid-end
cfallin Oct 6, 2022
bb0bc99
Remove now-unnecessary PartialOrd/Ord derivations.
cfallin Oct 6, 2022
a31bc05
Address some code-review comments.
cfallin Oct 6, 2022
3660bd6
Review feedback.
cfallin Oct 7, 2022
e992197
Merge remote-tracking branch 'upstream/main' into mid-end
cfallin Oct 7, 2022
676a72d
Review feedback.
cfallin Oct 10, 2022
23f8066
No overlap in mid-end rules, because we are defining a multi-construc…
cfallin Oct 10, 2022
d3f1ece
rustfmt
cfallin Oct 10, 2022
248065a
Review feedback.
cfallin Oct 10, 2022
15fd6b9
Review feedback.
cfallin Oct 10, 2022
fb2cb33
Review feedback.
cfallin Oct 10, 2022
96e379d
Review feedback.
cfallin Oct 10, 2022
95a393f
Remove redundant `mut`.
cfallin Oct 10, 2022
c9646c2
Add comment noting what rules can do.
cfallin Oct 10, 2022
b967925
Review feedback.
cfallin Oct 10, 2022
ccec8ea
Clarify comment wording.
cfallin Oct 10, 2022
f5cb2c2
Update `has_memory_fence_semantics`.
cfallin Oct 10, 2022
f39b1cc
Apply @jameysharp's improved loop-level computation.
cfallin Oct 11, 2022
2f5c66e
Fix suggestion commit.
cfallin Oct 11, 2022
71a0078
Fix off-by-one in new loop-nest analysis.
cfallin Oct 11, 2022
9b2989b
Review feedback.
cfallin Oct 11, 2022
75b9d2e
Review feedback.
cfallin Oct 11, 2022
17809c6
Review feedback.
cfallin Oct 11, 2022
5fbc64c
Use `Default`, not `std::default::Default`, as per @fitzgen
cfallin Oct 11, 2022
a1fdd35
Apply @fitzgen's comment elaboration to a doc-comment.
cfallin Oct 11, 2022
c5de3a0
Add stat for hitting the rewrite-depth limit.
cfallin Oct 11, 2022
81819ed
Merge remote-tracking branch 'upstream/main' into mid-end
cfallin Oct 11, 2022
4b1aa37
Some code motion in split prelude to make the diff a little clearer w…
cfallin Oct 11, 2022
3721cec
Take @jameysharp's suggested `try_into()` usage for blockparam indices.
cfallin Oct 11, 2022
15e0d31
Take @jameysharp's suggestion to avoid double-match on load op.
cfallin Oct 11, 2022
768ad06
Fix suggestion (add import).
cfallin Oct 11, 2022
a36c5dc
Review feedback.
cfallin Oct 11, 2022
f86242b
Fix stack_load handling.
cfallin Oct 11, 2022
19bf37e
Remove redundant can_store case.
cfallin Oct 11, 2022
c69f753
Take @jameysharp's suggested improvement to FuncEGraph::build() logic
cfallin Oct 11, 2022
9a7feef
Tweaks to FuncEGraph::build() on top of suggestion.
cfallin Oct 11, 2022
04d1617
Take @jameysharp's suggested clarified condition
cfallin Oct 11, 2022
32640e2
Clean up after suggestion (unused variable).
cfallin Oct 11, 2022
bf9f673
Fix loop analysis.
cfallin Oct 11, 2022
0d7ae78
loop level asserts
cfallin Oct 11, 2022
4bd3e9c
Revert constant-space loop analysis -- edge cases were incorrect, so …
cfallin Oct 11, 2022
9aadf51
Take @jameysharp's suggestion re: result_tys
cfallin Oct 12, 2022
a13ead2
Fix up after suggestion
cfallin Oct 12, 2022
0a9f2ab
Take @jameysharp's suggestion to use fold rather than reduce
cfallin Oct 12, 2022
70b1c10
Fixup after suggestion
cfallin Oct 12, 2022
8b4be05
Take @jameysharp's suggestion to remove elaborate_eclass_use's return…
cfallin Oct 12, 2022
ec8a1a9
Clarifying comment in terminator insts.
cfallin Oct 12, 2022
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
1 change: 1 addition & 0 deletions Cargo.lock

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

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,7 @@ wasmtime-fuzzing = { path = "crates/fuzzing" }

cranelift-wasm = { path = "cranelift/wasm", version = "0.90.0" }
cranelift-codegen = { path = "cranelift/codegen", version = "0.90.0" }
cranelift-egraph = { path = "cranelift/egraph", version = "0.90.0" }
cranelift-frontend = { path = "cranelift/frontend", version = "0.90.0" }
cranelift-entity = { path = "cranelift/entity", version = "0.90.0" }
cranelift-native = { path = "cranelift/native", version = "0.90.0" }
Expand Down
1 change: 1 addition & 0 deletions cranelift/codegen/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ bumpalo = "3"
cranelift-codegen-shared = { path = "./shared", version = "0.90.0" }
cranelift-entity = { workspace = true }
cranelift-bforest = { workspace = true }
cranelift-egraph = { workspace = true }
hashbrown = { workspace = true, optional = true }
target-lexicon = { workspace = true }
log = { workspace = true }
Expand Down
35 changes: 30 additions & 5 deletions cranelift/codegen/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -177,9 +177,19 @@ fn get_isle_compilations(
) -> Result<IsleCompilations, std::io::Error> {
let cur_dir = std::env::current_dir()?;

let clif_isle = out_dir.join("clif.isle");
// Preludes.
let clif_lower_isle = out_dir.join("clif_lower.isle");
let clif_opt_isle = out_dir.join("clif_opt.isle");
let prelude_isle =
make_isle_source_path_relative(&cur_dir, crate_dir.join("src").join("prelude.isle"));
let prelude_opt_isle =
make_isle_source_path_relative(&cur_dir, crate_dir.join("src").join("prelude_opt.isle"));
let prelude_lower_isle =
make_isle_source_path_relative(&cur_dir, crate_dir.join("src").join("prelude_lower.isle"));

// Directory for mid-end optimizations.
let src_opts = make_isle_source_path_relative(&cur_dir, crate_dir.join("src").join("opts"));
// Directories for lowering backends.
let src_isa_x64 =
make_isle_source_path_relative(&cur_dir, crate_dir.join("src").join("isa").join("x64"));
let src_isa_aarch64 =
Expand All @@ -204,47 +214,62 @@ fn get_isle_compilations(
// `cranelift/codegen/src/isa/*/lower/isle/generated_code.rs`!
Ok(IsleCompilations {
items: vec![
// The mid-end optimization rules.
IsleCompilation {
output: out_dir.join("isle_opt.rs"),
inputs: vec![
prelude_isle.clone(),
prelude_opt_isle.clone(),
src_opts.join("algebraic.isle"),
src_opts.join("cprop.isle"),
],
untracked_inputs: vec![clif_opt_isle.clone()],
},
// The x86-64 instruction selector.
IsleCompilation {
output: out_dir.join("isle_x64.rs"),
inputs: vec![
prelude_isle.clone(),
prelude_lower_isle.clone(),
src_isa_x64.join("inst.isle"),
src_isa_x64.join("lower.isle"),
],
untracked_inputs: vec![clif_isle.clone()],
untracked_inputs: vec![clif_lower_isle.clone()],
},
// The aarch64 instruction selector.
IsleCompilation {
output: out_dir.join("isle_aarch64.rs"),
inputs: vec![
prelude_isle.clone(),
prelude_lower_isle.clone(),
src_isa_aarch64.join("inst.isle"),
src_isa_aarch64.join("inst_neon.isle"),
src_isa_aarch64.join("lower.isle"),
src_isa_aarch64.join("lower_dynamic_neon.isle"),
],
untracked_inputs: vec![clif_isle.clone()],
untracked_inputs: vec![clif_lower_isle.clone()],
},
// The s390x instruction selector.
IsleCompilation {
output: out_dir.join("isle_s390x.rs"),
inputs: vec![
prelude_isle.clone(),
prelude_lower_isle.clone(),
src_isa_s390x.join("inst.isle"),
src_isa_s390x.join("lower.isle"),
],
untracked_inputs: vec![clif_isle.clone()],
untracked_inputs: vec![clif_lower_isle.clone()],
},
// The risc-v instruction selector.
IsleCompilation {
output: out_dir.join("isle_riscv64.rs"),
inputs: vec![
prelude_isle.clone(),
prelude_lower_isle.clone(),
src_isa_risc_v.join("inst.isle"),
src_isa_risc_v.join("lower.isle"),
],
untracked_inputs: vec![clif_isle.clone()],
untracked_inputs: vec![clif_lower_isle.clone()],
},
],
})
Expand Down
Loading