Stream: git-wasmtime

Topic: wasmtime / issue #4953 egraph-based midend: draw the rest...


view this post on Zulip Wasmtime GitHub notifications bot (Oct 04 2022 at 06:55):

nivkner commented on issue #4953:

tested using cranelift-tools with the following clif code:

target x86_64

function u0:359(i64) -> i8 system_v {

    ss0 = explicit_slot 16
    sig0 = (i64) -> i8, i8 system_v
    fn0 = colocated u0:521 sig0

    block0(v0: i64):
    v3, v4 = call fn0(v0)
    return v3
}

when calling

./target/debug/clif-util compile --set use_egraphs=false --target x86_64-unknown-linux-gnu example.clif

the code compiles with out error.

when setting --set use_egraphs=true
the following error is produced:

thread 'main' panicked at 'enode depends directly on multi-value result', cranelift/codegen/src/egraph/elaborate.rs:396:33

<details>
<summary>backtrace</summary>

stack backtrace: 0: rust_begin_unwind at /rustc/a55dd71d5fb0ec5a6a3a9e8c27b2127ba491ce52/library/std/src/panicking.rs:584:5 1: core::panicking::panic_fmt at /rustc/a55dd71d5fb0ec5a6a3a9e8c27b2127ba491ce52/library/core/src/panicking.rs:142:14 2: cranelift_codegen::egraph::elaborate::Elaborator::process_elab_stack::{{closure}} at ./cranelift/codegen/src/egraph/elaborate.rs:396:33 3: core::ops::function::impls::<impl core::ops::function::FnOnce<A> for &mut F>::call_once at /rustc/a55dd71d5fb0ec5a6a3a9e8c27b2127ba491ce52/library/core/src/ops/function.rs:301:13 4: core::option::Option<T>::map at /rustc/a55dd71d5fb0ec5a6a3a9e8c27b2127ba491ce52/library/core/src/option.rs:929:29 5: <core::iter::adapters::map::Map<I,F> as core::iter::traits::iterator::Iterator>::next at /rustc/a55dd71d5fb0ec5a6a3a9e8c27b2127ba491ce52/library/core/src/iter/adapters/map.rs:103:9 6: <smallvec::SmallVec<A> as core::iter::traits::collect::Extend<<A as smallvec::Array>::Item>>::extend at /home/user/.local/share/cargo/registry/src/github.com-1ecc6299db9ec823/smallvec-1.8.0/src/lib.rs:1742:36 7: <smallvec::SmallVec<A> as core::iter::traits::collect::FromIterator<<A as smallvec::Array>::Item>>::from_iter at /home/user/.local/share/cargo/registry/src/github.com-1ecc6299db9ec823/smallvec-1.8.0/src/lib.rs:1727:9 8: core::iter::traits::iterator::Iterator::collect at /rustc/a55dd71d5fb0ec5a6a3a9e8c27b2127ba491ce52/library/core/src/iter/traits/iterator.rs:1836:9 9: cranelift_codegen::egraph::elaborate::Elaborator::process_elab_stack at ./cranelift/codegen/src/egraph/elaborate.rs:391:60 10: cranelift_codegen::egraph::elaborate::Elaborator::elaborate_eclass_use at ./cranelift/codegen/src/egraph/elaborate.rs:285:9 11: cranelift_codegen::egraph::elaborate::Elaborator::elaborate_block at ./cranelift/codegen/src/egraph/elaborate.rs:511:13 12: cranelift_codegen::egraph::elaborate::Elaborator::elaborate_domtree at ./cranelift/codegen/src/egraph/elaborate.rs:532:21 13: cranelift_codegen::egraph::elaborate::Elaborator::elaborate at ./cranelift/codegen/src/egraph/elaborate.rs:583:9 14: cranelift_codegen::egraph::FuncEGraph::elaborate at ./cranelift/codegen/src/egraph.rs:348:9 15: cranelift_codegen::context::Context::optimize at ./cranelift/codegen/src/context.rs:203:13 16: cranelift_codegen::context::Context::compile_stencil at ./cranelift/codegen/src/context.rs:149:13 17: cranelift_codegen::context::Context::compile at ./cranelift/codegen/src/context.rs:224:23 18: cranelift_codegen::context::Context::compile_and_emit at ./cranelift/codegen/src/context.rs:132:29 19: clif_util::compile::handle_module at ./cranelift/src/compile.rs:71:33 20: clif_util::compile::run at ./cranelift/src/compile.rs:46:9 21: clif_util::main at ./cranelift/src/clif-util.rs:106:33 22: core::ops::function::FnOnce::call_once at /rustc/a55dd71d5fb0ec5a6a3a9e8c27b2127ba491ce52/library/core/src/ops/function.rs:248:5 note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
</details>

view this post on Zulip Wasmtime GitHub notifications bot (Oct 04 2022 at 06:57):

nivkner edited a comment on issue #4953:

tested using cranelift-tools with the following clif code:

target x86_64

function u0:359(i64) -> i8 system_v {

    ss0 = explicit_slot 16
    sig0 = (i64) -> i8, i8 system_v
    fn0 = colocated u0:521 sig0

    block0(v0: i64):
    v3, v4 = call fn0(v0)
    return v3
}

when calling

./target/debug/clif-util compile --set use_egraphs=false --target x86_64-unknown-linux-gnu example.clif

the code compiles with out error.

when setting --set use_egraphs=true
the following error is produced:

thread 'main' panicked at 'enode depends directly on multi-value result', cranelift/codegen/src/egraph/elaborate.rs:396:33

<details>
<summary>backtrace</summary>

stack backtrace: 0: rust_begin_unwind at /rustc/a55dd71d5fb0ec5a6a3a9e8c27b2127ba491ce52/library/std/src/panicking.rs:584:5 1: core::panicking::panic_fmt at /rustc/a55dd71d5fb0ec5a6a3a9e8c27b2127ba491ce52/library/core/src/panicking.rs:142:14 2: cranelift_codegen::egraph::elaborate::Elaborator::process_elab_stack::{{closure}} at ./cranelift/codegen/src/egraph/elaborate.rs:396:33 3: core::ops::function::impls::<impl core::ops::function::FnOnce<A> for &mut F>::call_once at /rustc/a55dd71d5fb0ec5a6a3a9e8c27b2127ba491ce52/library/core/src/ops/function.rs:301:13 4: core::option::Option<T>::map at /rustc/a55dd71d5fb0ec5a6a3a9e8c27b2127ba491ce52/library/core/src/option.rs:929:29 5: <core::iter::adapters::map::Map<I,F> as core::iter::traits::iterator::Iterator>::next at /rustc/a55dd71d5fb0ec5a6a3a9e8c27b2127ba491ce52/library/core/src/iter/adapters/map.rs:103:9 6: <smallvec::SmallVec<A> as core::iter::traits::collect::Extend<<A as smallvec::Array>::Item>>::extend at /home/user/.local/share/cargo/registry/src/github.com-1ecc6299db9ec823/smallvec-1.8.0/src/lib.rs:1742:36 7: <smallvec::SmallVec<A> as core::iter::traits::collect::FromIterator<<A as smallvec::Array>::Item>>::from_iter at /home/user/.local/share/cargo/registry/src/github.com-1ecc6299db9ec823/smallvec-1.8.0/src/lib.rs:1727:9 8: core::iter::traits::iterator::Iterator::collect at /rustc/a55dd71d5fb0ec5a6a3a9e8c27b2127ba491ce52/library/core/src/iter/traits/iterator.rs:1836:9 9: cranelift_codegen::egraph::elaborate::Elaborator::process_elab_stack at ./cranelift/codegen/src/egraph/elaborate.rs:391:60 10: cranelift_codegen::egraph::elaborate::Elaborator::elaborate_eclass_use at ./cranelift/codegen/src/egraph/elaborate.rs:285:9 11: cranelift_codegen::egraph::elaborate::Elaborator::elaborate_block at ./cranelift/codegen/src/egraph/elaborate.rs:511:13 12: cranelift_codegen::egraph::elaborate::Elaborator::elaborate_domtree at ./cranelift/codegen/src/egraph/elaborate.rs:532:21 13: cranelift_codegen::egraph::elaborate::Elaborator::elaborate at ./cranelift/codegen/src/egraph/elaborate.rs:583:9 14: cranelift_codegen::egraph::FuncEGraph::elaborate at ./cranelift/codegen/src/egraph.rs:348:9 15: cranelift_codegen::context::Context::optimize at ./cranelift/codegen/src/context.rs:203:13 16: cranelift_codegen::context::Context::compile_stencil at ./cranelift/codegen/src/context.rs:149:13 17: cranelift_codegen::context::Context::compile at ./cranelift/codegen/src/context.rs:224:23 18: cranelift_codegen::context::Context::compile_and_emit at ./cranelift/codegen/src/context.rs:132:29 19: clif_util::compile::handle_module at ./cranelift/src/compile.rs:71:33 20: clif_util::compile::run at ./cranelift/src/compile.rs:46:9 21: clif_util::main at ./cranelift/src/clif-util.rs:106:33 22: core::ops::function::FnOnce::call_once at /rustc/a55dd71d5fb0ec5a6a3a9e8c27b2127ba491ce52/library/core/src/ops/function.rs:248:5 note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
</details>

file reduced from clif of core produced when attempting to compile core with https://github.com/bjorn3/rustc_codegen_cranelift patched to use this PR

view this post on Zulip Wasmtime GitHub notifications bot (Oct 04 2022 at 06:58):

nivkner edited a comment on issue #4953:

tested using cranelift-tools with the following clif code:

target x86_64

function u0:359(i64) -> i8 system_v {

    ss0 = explicit_slot 16
    sig0 = (i64) -> i8, i8 system_v
    fn0 = colocated u0:521 sig0

    block0(v0: i64):
    v3, v4 = call fn0(v0)
    return v3
}

when calling

./target/debug/clif-util compile --set use_egraphs=false --target x86_64-unknown-linux-gnu example.clif

the code compiles without error.

when setting --set use_egraphs=true
the following error is produced:

thread 'main' panicked at 'enode depends directly on multi-value result', cranelift/codegen/src/egraph/elaborate.rs:396:33

<details>
<summary>backtrace</summary>

stack backtrace: 0: rust_begin_unwind at /rustc/a55dd71d5fb0ec5a6a3a9e8c27b2127ba491ce52/library/std/src/panicking.rs:584:5 1: core::panicking::panic_fmt at /rustc/a55dd71d5fb0ec5a6a3a9e8c27b2127ba491ce52/library/core/src/panicking.rs:142:14 2: cranelift_codegen::egraph::elaborate::Elaborator::process_elab_stack::{{closure}} at ./cranelift/codegen/src/egraph/elaborate.rs:396:33 3: core::ops::function::impls::<impl core::ops::function::FnOnce<A> for &mut F>::call_once at /rustc/a55dd71d5fb0ec5a6a3a9e8c27b2127ba491ce52/library/core/src/ops/function.rs:301:13 4: core::option::Option<T>::map at /rustc/a55dd71d5fb0ec5a6a3a9e8c27b2127ba491ce52/library/core/src/option.rs:929:29 5: <core::iter::adapters::map::Map<I,F> as core::iter::traits::iterator::Iterator>::next at /rustc/a55dd71d5fb0ec5a6a3a9e8c27b2127ba491ce52/library/core/src/iter/adapters/map.rs:103:9 6: <smallvec::SmallVec<A> as core::iter::traits::collect::Extend<<A as smallvec::Array>::Item>>::extend at /home/user/.local/share/cargo/registry/src/github.com-1ecc6299db9ec823/smallvec-1.8.0/src/lib.rs:1742:36 7: <smallvec::SmallVec<A> as core::iter::traits::collect::FromIterator<<A as smallvec::Array>::Item>>::from_iter at /home/user/.local/share/cargo/registry/src/github.com-1ecc6299db9ec823/smallvec-1.8.0/src/lib.rs:1727:9 8: core::iter::traits::iterator::Iterator::collect at /rustc/a55dd71d5fb0ec5a6a3a9e8c27b2127ba491ce52/library/core/src/iter/traits/iterator.rs:1836:9 9: cranelift_codegen::egraph::elaborate::Elaborator::process_elab_stack at ./cranelift/codegen/src/egraph/elaborate.rs:391:60 10: cranelift_codegen::egraph::elaborate::Elaborator::elaborate_eclass_use at ./cranelift/codegen/src/egraph/elaborate.rs:285:9 11: cranelift_codegen::egraph::elaborate::Elaborator::elaborate_block at ./cranelift/codegen/src/egraph/elaborate.rs:511:13 12: cranelift_codegen::egraph::elaborate::Elaborator::elaborate_domtree at ./cranelift/codegen/src/egraph/elaborate.rs:532:21 13: cranelift_codegen::egraph::elaborate::Elaborator::elaborate at ./cranelift/codegen/src/egraph/elaborate.rs:583:9 14: cranelift_codegen::egraph::FuncEGraph::elaborate at ./cranelift/codegen/src/egraph.rs:348:9 15: cranelift_codegen::context::Context::optimize at ./cranelift/codegen/src/context.rs:203:13 16: cranelift_codegen::context::Context::compile_stencil at ./cranelift/codegen/src/context.rs:149:13 17: cranelift_codegen::context::Context::compile at ./cranelift/codegen/src/context.rs:224:23 18: cranelift_codegen::context::Context::compile_and_emit at ./cranelift/codegen/src/context.rs:132:29 19: clif_util::compile::handle_module at ./cranelift/src/compile.rs:71:33 20: clif_util::compile::run at ./cranelift/src/compile.rs:46:9 21: clif_util::main at ./cranelift/src/clif-util.rs:106:33 22: core::ops::function::FnOnce::call_once at /rustc/a55dd71d5fb0ec5a6a3a9e8c27b2127ba491ce52/library/core/src/ops/function.rs:248:5 note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
</details>

file reduced from clif of core produced when attempting to compile core with https://github.com/bjorn3/rustc_codegen_cranelift patched to use this PR

view this post on Zulip Wasmtime GitHub notifications bot (Oct 04 2022 at 07:05):

nivkner edited a comment on issue #4953:

tested using cranelift-tools with the following clif code:

target x86_64

function u0:359(i64) -> i8 system_v {

    sig0 = (i64) -> i8, i8 system_v
    fn0 = colocated u0:521 sig0

    block0(v0: i64):
    v3, v4 = call fn0(v0)
    return v3
}

when calling

./target/debug/clif-util compile --set use_egraphs=false --target x86_64-unknown-linux-gnu example.clif

the code compiles without error.

when setting --set use_egraphs=true
the following error is produced:

thread 'main' panicked at 'enode depends directly on multi-value result', cranelift/codegen/src/egraph/elaborate.rs:396:33

<details>
<summary>backtrace</summary>

stack backtrace: 0: rust_begin_unwind at /rustc/a55dd71d5fb0ec5a6a3a9e8c27b2127ba491ce52/library/std/src/panicking.rs:584:5 1: core::panicking::panic_fmt at /rustc/a55dd71d5fb0ec5a6a3a9e8c27b2127ba491ce52/library/core/src/panicking.rs:142:14 2: cranelift_codegen::egraph::elaborate::Elaborator::process_elab_stack::{{closure}} at ./cranelift/codegen/src/egraph/elaborate.rs:396:33 3: core::ops::function::impls::<impl core::ops::function::FnOnce<A> for &mut F>::call_once at /rustc/a55dd71d5fb0ec5a6a3a9e8c27b2127ba491ce52/library/core/src/ops/function.rs:301:13 4: core::option::Option<T>::map at /rustc/a55dd71d5fb0ec5a6a3a9e8c27b2127ba491ce52/library/core/src/option.rs:929:29 5: <core::iter::adapters::map::Map<I,F> as core::iter::traits::iterator::Iterator>::next at /rustc/a55dd71d5fb0ec5a6a3a9e8c27b2127ba491ce52/library/core/src/iter/adapters/map.rs:103:9 6: <smallvec::SmallVec<A> as core::iter::traits::collect::Extend<<A as smallvec::Array>::Item>>::extend at /home/user/.local/share/cargo/registry/src/github.com-1ecc6299db9ec823/smallvec-1.8.0/src/lib.rs:1742:36 7: <smallvec::SmallVec<A> as core::iter::traits::collect::FromIterator<<A as smallvec::Array>::Item>>::from_iter at /home/user/.local/share/cargo/registry/src/github.com-1ecc6299db9ec823/smallvec-1.8.0/src/lib.rs:1727:9 8: core::iter::traits::iterator::Iterator::collect at /rustc/a55dd71d5fb0ec5a6a3a9e8c27b2127ba491ce52/library/core/src/iter/traits/iterator.rs:1836:9 9: cranelift_codegen::egraph::elaborate::Elaborator::process_elab_stack at ./cranelift/codegen/src/egraph/elaborate.rs:391:60 10: cranelift_codegen::egraph::elaborate::Elaborator::elaborate_eclass_use at ./cranelift/codegen/src/egraph/elaborate.rs:285:9 11: cranelift_codegen::egraph::elaborate::Elaborator::elaborate_block at ./cranelift/codegen/src/egraph/elaborate.rs:511:13 12: cranelift_codegen::egraph::elaborate::Elaborator::elaborate_domtree at ./cranelift/codegen/src/egraph/elaborate.rs:532:21 13: cranelift_codegen::egraph::elaborate::Elaborator::elaborate at ./cranelift/codegen/src/egraph/elaborate.rs:583:9 14: cranelift_codegen::egraph::FuncEGraph::elaborate at ./cranelift/codegen/src/egraph.rs:348:9 15: cranelift_codegen::context::Context::optimize at ./cranelift/codegen/src/context.rs:203:13 16: cranelift_codegen::context::Context::compile_stencil at ./cranelift/codegen/src/context.rs:149:13 17: cranelift_codegen::context::Context::compile at ./cranelift/codegen/src/context.rs:224:23 18: cranelift_codegen::context::Context::compile_and_emit at ./cranelift/codegen/src/context.rs:132:29 19: clif_util::compile::handle_module at ./cranelift/src/compile.rs:71:33 20: clif_util::compile::run at ./cranelift/src/compile.rs:46:9 21: clif_util::main at ./cranelift/src/clif-util.rs:106:33 22: core::ops::function::FnOnce::call_once at /rustc/a55dd71d5fb0ec5a6a3a9e8c27b2127ba491ce52/library/core/src/ops/function.rs:248:5 note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
</details>

file reduced from clif of core produced when attempting to compile core with https://github.com/bjorn3/rustc_codegen_cranelift patched to use this PR

view this post on Zulip Wasmtime GitHub notifications bot (Oct 04 2022 at 07:09):

nivkner edited a comment on issue #4953:

tested using cranelift-tools with the following clif code:

target x86_64

function u0:359(i64) -> i8 system_v {

    sig0 = (i64) -> i8, i8 system_v
    fn0 = colocated u0:521 sig0

    block0(v0: i64):
    v3, v4 = call fn0(v0)
    return v3
}

when calling

./target/debug/clif-util compile --set use_egraphs=false --target x86_64-unknown-linux-gnu example.clif

the code compiles without error.

when setting --set use_egraphs=true the following error is produced:

thread 'main' panicked at 'enode depends directly on multi-value result', cranelift/codegen/src/egraph/elaborate.rs:396:33

<details>
<summary>backtrace</summary>

stack backtrace: 0: rust_begin_unwind at /rustc/a55dd71d5fb0ec5a6a3a9e8c27b2127ba491ce52/library/std/src/panicking.rs:584:5 1: core::panicking::panic_fmt at /rustc/a55dd71d5fb0ec5a6a3a9e8c27b2127ba491ce52/library/core/src/panicking.rs:142:14 2: cranelift_codegen::egraph::elaborate::Elaborator::process_elab_stack::{{closure}} at ./cranelift/codegen/src/egraph/elaborate.rs:396:33 3: core::ops::function::impls::<impl core::ops::function::FnOnce<A> for &mut F>::call_once at /rustc/a55dd71d5fb0ec5a6a3a9e8c27b2127ba491ce52/library/core/src/ops/function.rs:301:13 4: core::option::Option<T>::map at /rustc/a55dd71d5fb0ec5a6a3a9e8c27b2127ba491ce52/library/core/src/option.rs:929:29 5: <core::iter::adapters::map::Map<I,F> as core::iter::traits::iterator::Iterator>::next at /rustc/a55dd71d5fb0ec5a6a3a9e8c27b2127ba491ce52/library/core/src/iter/adapters/map.rs:103:9 6: <smallvec::SmallVec<A> as core::iter::traits::collect::Extend<<A as smallvec::Array>::Item>>::extend at /home/user/.local/share/cargo/registry/src/github.com-1ecc6299db9ec823/smallvec-1.8.0/src/lib.rs:1742:36 7: <smallvec::SmallVec<A> as core::iter::traits::collect::FromIterator<<A as smallvec::Array>::Item>>::from_iter at /home/user/.local/share/cargo/registry/src/github.com-1ecc6299db9ec823/smallvec-1.8.0/src/lib.rs:1727:9 8: core::iter::traits::iterator::Iterator::collect at /rustc/a55dd71d5fb0ec5a6a3a9e8c27b2127ba491ce52/library/core/src/iter/traits/iterator.rs:1836:9 9: cranelift_codegen::egraph::elaborate::Elaborator::process_elab_stack at ./cranelift/codegen/src/egraph/elaborate.rs:391:60 10: cranelift_codegen::egraph::elaborate::Elaborator::elaborate_eclass_use at ./cranelift/codegen/src/egraph/elaborate.rs:285:9 11: cranelift_codegen::egraph::elaborate::Elaborator::elaborate_block at ./cranelift/codegen/src/egraph/elaborate.rs:511:13 12: cranelift_codegen::egraph::elaborate::Elaborator::elaborate_domtree at ./cranelift/codegen/src/egraph/elaborate.rs:532:21 13: cranelift_codegen::egraph::elaborate::Elaborator::elaborate at ./cranelift/codegen/src/egraph/elaborate.rs:583:9 14: cranelift_codegen::egraph::FuncEGraph::elaborate at ./cranelift/codegen/src/egraph.rs:348:9 15: cranelift_codegen::context::Context::optimize at ./cranelift/codegen/src/context.rs:203:13 16: cranelift_codegen::context::Context::compile_stencil at ./cranelift/codegen/src/context.rs:149:13 17: cranelift_codegen::context::Context::compile at ./cranelift/codegen/src/context.rs:224:23 18: cranelift_codegen::context::Context::compile_and_emit at ./cranelift/codegen/src/context.rs:132:29 19: clif_util::compile::handle_module at ./cranelift/src/compile.rs:71:33 20: clif_util::compile::run at ./cranelift/src/compile.rs:46:9 21: clif_util::main at ./cranelift/src/clif-util.rs:106:33 22: core::ops::function::FnOnce::call_once at /rustc/a55dd71d5fb0ec5a6a3a9e8c27b2127ba491ce52/library/core/src/ops/function.rs:248:5 note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
</details>

file reduced from clif of core produced when attempting to compile core with https://github.com/bjorn3/rustc_codegen_cranelift patched to use this PR

view this post on Zulip Wasmtime GitHub notifications bot (Oct 04 2022 at 07:09):

nivkner edited a comment on issue #4953:

tested using cranelift-tools with the following clif code:

target x86_64

function u0:359(i64) -> i8 system_v {

    sig0 = (i64) -> i8, i8 system_v
    fn0 = colocated u0:521 sig0

    block0(v0: i64):
    v3, v4 = call fn0(v0)
    return v3
}

when calling

./target/debug/clif-util compile --set use_egraphs=false --target x86_64-unknown-linux-gnu example.clif

the code compiles without error.

when setting use_egraphs=true the following error is produced:

thread 'main' panicked at 'enode depends directly on multi-value result', cranelift/codegen/src/egraph/elaborate.rs:396:33

<details>
<summary>backtrace</summary>

stack backtrace: 0: rust_begin_unwind at /rustc/a55dd71d5fb0ec5a6a3a9e8c27b2127ba491ce52/library/std/src/panicking.rs:584:5 1: core::panicking::panic_fmt at /rustc/a55dd71d5fb0ec5a6a3a9e8c27b2127ba491ce52/library/core/src/panicking.rs:142:14 2: cranelift_codegen::egraph::elaborate::Elaborator::process_elab_stack::{{closure}} at ./cranelift/codegen/src/egraph/elaborate.rs:396:33 3: core::ops::function::impls::<impl core::ops::function::FnOnce<A> for &mut F>::call_once at /rustc/a55dd71d5fb0ec5a6a3a9e8c27b2127ba491ce52/library/core/src/ops/function.rs:301:13 4: core::option::Option<T>::map at /rustc/a55dd71d5fb0ec5a6a3a9e8c27b2127ba491ce52/library/core/src/option.rs:929:29 5: <core::iter::adapters::map::Map<I,F> as core::iter::traits::iterator::Iterator>::next at /rustc/a55dd71d5fb0ec5a6a3a9e8c27b2127ba491ce52/library/core/src/iter/adapters/map.rs:103:9 6: <smallvec::SmallVec<A> as core::iter::traits::collect::Extend<<A as smallvec::Array>::Item>>::extend at /home/user/.local/share/cargo/registry/src/github.com-1ecc6299db9ec823/smallvec-1.8.0/src/lib.rs:1742:36 7: <smallvec::SmallVec<A> as core::iter::traits::collect::FromIterator<<A as smallvec::Array>::Item>>::from_iter at /home/user/.local/share/cargo/registry/src/github.com-1ecc6299db9ec823/smallvec-1.8.0/src/lib.rs:1727:9 8: core::iter::traits::iterator::Iterator::collect at /rustc/a55dd71d5fb0ec5a6a3a9e8c27b2127ba491ce52/library/core/src/iter/traits/iterator.rs:1836:9 9: cranelift_codegen::egraph::elaborate::Elaborator::process_elab_stack at ./cranelift/codegen/src/egraph/elaborate.rs:391:60 10: cranelift_codegen::egraph::elaborate::Elaborator::elaborate_eclass_use at ./cranelift/codegen/src/egraph/elaborate.rs:285:9 11: cranelift_codegen::egraph::elaborate::Elaborator::elaborate_block at ./cranelift/codegen/src/egraph/elaborate.rs:511:13 12: cranelift_codegen::egraph::elaborate::Elaborator::elaborate_domtree at ./cranelift/codegen/src/egraph/elaborate.rs:532:21 13: cranelift_codegen::egraph::elaborate::Elaborator::elaborate at ./cranelift/codegen/src/egraph/elaborate.rs:583:9 14: cranelift_codegen::egraph::FuncEGraph::elaborate at ./cranelift/codegen/src/egraph.rs:348:9 15: cranelift_codegen::context::Context::optimize at ./cranelift/codegen/src/context.rs:203:13 16: cranelift_codegen::context::Context::compile_stencil at ./cranelift/codegen/src/context.rs:149:13 17: cranelift_codegen::context::Context::compile at ./cranelift/codegen/src/context.rs:224:23 18: cranelift_codegen::context::Context::compile_and_emit at ./cranelift/codegen/src/context.rs:132:29 19: clif_util::compile::handle_module at ./cranelift/src/compile.rs:71:33 20: clif_util::compile::run at ./cranelift/src/compile.rs:46:9 21: clif_util::main at ./cranelift/src/clif-util.rs:106:33 22: core::ops::function::FnOnce::call_once at /rustc/a55dd71d5fb0ec5a6a3a9e8c27b2127ba491ce52/library/core/src/ops/function.rs:248:5 note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
</details>

file reduced from clif of core produced when attempting to compile core with https://github.com/bjorn3/rustc_codegen_cranelift patched to use this PR

view this post on Zulip Wasmtime GitHub notifications bot (Oct 04 2022 at 14:19):

alexcrichton commented on issue #4953:

it's surprising that this fails if all the other builds work fine?

You'll need to edit this list to include automatic publishing of a new crate.

view this post on Zulip Wasmtime GitHub notifications bot (Oct 04 2022 at 16:18):

cfallin commented on issue #4953:

it's surprising that this fails if all the other builds work fine?

You'll need to edit this list to include automatic publishing of a new crate.

It’s actually already there, from the earlier PR that introduced the crate (line 28); this seems to be something new related to the workspaces change?

view this post on Zulip Wasmtime GitHub notifications bot (Oct 04 2022 at 16:24):

alexcrichton commented on issue #4953:

Ah I only checked the diff of this PR, the list also needs to be topologically sorted so if cranelift-codegen is picking up a new dep then the list needs to be reordered.

view this post on Zulip Wasmtime GitHub notifications bot (Oct 04 2022 at 16:41):

cfallin commented on issue #4953:

Ah, that makes sense, thanks!

view this post on Zulip Wasmtime GitHub notifications bot (Oct 04 2022 at 18:13):

cfallin commented on issue #4953:

when setting use_egraphs=true the following error is produced:

thread 'main' panicked at 'enode depends directly on multi-value result', cranelift/codegen/src/egraph/elaborate.rs:396:33

Fixed, thanks! This was an issue introduced in my non-recursive rewrite of the extraction (best-cost node) procedure's handling of value projections.

view this post on Zulip Wasmtime GitHub notifications bot (Oct 04 2022 at 20:29):

nivkner commented on issue #4953:

the following code compiles without error when setting use_egraphs=false but produces an error when use_egraphs=true:

target x86_64

function u0:1302(i64) -> i64 system_v {

        block0(v0: i64):
                v9 = atomic_rmw.i64 add v0, v0
                return v0
}

the error is

thread 'main' panicked at 'index out of bounds: the len is 1 but the index is 1', /home/user/Documents/wasmtime/target/debug/build/cranelift-codegen-ae89adb74262e952/out/opcodes.rs:1979:39

<details>
<summary>backtrace</summary>

stack backtrace:
   0: rust_begin_unwind
             at /rustc/a55dd71d5fb0ec5a6a3a9e8c27b2127ba491ce52/library/std/src/panicking.rs:584:5
   1: core::panicking::panic_fmt
             at /rustc/a55dd71d5fb0ec5a6a3a9e8c27b2127ba491ce52/library/core/src/panicking.rs:142:14
   2: core::panicking::panic_bounds_check
             at /rustc/a55dd71d5fb0ec5a6a3a9e8c27b2127ba491ce52/library/core/src/panicking.rs:84:5
   3: cranelift_codegen::ir::instructions::InstructionImms::with_args
             at ./target/debug/build/cranelift-codegen-ae89adb74262e952/out/opcodes.rs:1979:39
   4: cranelift_codegen::egraph::elaborate::Elaborator::add_node
             at ./cranelift/codegen/src/egraph/elaborate.rs:197:17
   5: cranelift_codegen::egraph::elaborate::Elaborator::process_elab_stack
             at ./cranelift/codegen/src/egraph/elaborate.rs:445:35
   6: cranelift_codegen::egraph::elaborate::Elaborator::elaborate_eclass_use
             at ./cranelift/codegen/src/egraph/elaborate.rs:285:9
   7: cranelift_codegen::egraph::elaborate::Elaborator::elaborate_block
             at ./cranelift/codegen/src/egraph/elaborate.rs:513:13
   8: cranelift_codegen::egraph::elaborate::Elaborator::elaborate_domtree
             at ./cranelift/codegen/src/egraph/elaborate.rs:534:21
   9: cranelift_codegen::egraph::elaborate::Elaborator::elaborate
             at ./cranelift/codegen/src/egraph/elaborate.rs:585:9
  10: cranelift_codegen::egraph::FuncEGraph::elaborate
             at ./cranelift/codegen/src/egraph.rs:348:9
  11: cranelift_codegen::context::Context::optimize
             at ./cranelift/codegen/src/context.rs:203:13
  12: cranelift_codegen::context::Context::compile_stencil
             at ./cranelift/codegen/src/context.rs:149:13
  13: cranelift_codegen::context::Context::compile
             at ./cranelift/codegen/src/context.rs:224:23
  14: cranelift_codegen::context::Context::compile_and_emit
             at ./cranelift/codegen/src/context.rs:132:29
  15: clif_util::compile::handle_module
             at ./cranelift/src/compile.rs:71:33
  16: clif_util::compile::run
             at ./cranelift/src/compile.rs:46:9
  17: clif_util::main
             at ./cranelift/src/clif-util.rs:106:33
  18: core::ops::function::FnOnce::call_once
             at /rustc/a55dd71d5fb0ec5a6a3a9e8c27b2127ba491ce52/library/core/src/ops/function.rs:248:5

</details>

view this post on Zulip Wasmtime GitHub notifications bot (Oct 04 2022 at 20:32):

nivkner edited a comment on issue #4953:

the following code compiles without error when setting use_egraphs=false but produces an error when use_egraphs=true:

target x86_64

function u0:1302(i64) -> i64 system_v {

        block0(v0: i64):
                v9 = atomic_rmw.i64 add v0, v0
                return v0
}

the error is

thread 'main' panicked at 'index out of bounds: the len is 1 but the index is 1', /home/user/Documents/wasmtime/target/debug/build/cranelift-codegen-ae89adb74262e952/out/opcodes.rs:1979:39

<details>
<summary>backtrace</summary>

stack backtrace:
   0: rust_begin_unwind
             at /rustc/a55dd71d5fb0ec5a6a3a9e8c27b2127ba491ce52/library/std/src/panicking.rs:584:5
   1: core::panicking::panic_fmt
             at /rustc/a55dd71d5fb0ec5a6a3a9e8c27b2127ba491ce52/library/core/src/panicking.rs:142:14
   2: core::panicking::panic_bounds_check
             at /rustc/a55dd71d5fb0ec5a6a3a9e8c27b2127ba491ce52/library/core/src/panicking.rs:84:5
   3: cranelift_codegen::ir::instructions::InstructionImms::with_args
             at ./target/debug/build/cranelift-codegen-ae89adb74262e952/out/opcodes.rs:1979:39
   4: cranelift_codegen::egraph::elaborate::Elaborator::add_node
             at ./cranelift/codegen/src/egraph/elaborate.rs:197:17
   5: cranelift_codegen::egraph::elaborate::Elaborator::process_elab_stack
             at ./cranelift/codegen/src/egraph/elaborate.rs:445:35
   6: cranelift_codegen::egraph::elaborate::Elaborator::elaborate_eclass_use
             at ./cranelift/codegen/src/egraph/elaborate.rs:285:9
   7: cranelift_codegen::egraph::elaborate::Elaborator::elaborate_block
             at ./cranelift/codegen/src/egraph/elaborate.rs:513:13
   8: cranelift_codegen::egraph::elaborate::Elaborator::elaborate_domtree
             at ./cranelift/codegen/src/egraph/elaborate.rs:534:21
   9: cranelift_codegen::egraph::elaborate::Elaborator::elaborate
             at ./cranelift/codegen/src/egraph/elaborate.rs:585:9
  10: cranelift_codegen::egraph::FuncEGraph::elaborate
             at ./cranelift/codegen/src/egraph.rs:348:9
  11: cranelift_codegen::context::Context::optimize
             at ./cranelift/codegen/src/context.rs:203:13
  12: cranelift_codegen::context::Context::compile_stencil
             at ./cranelift/codegen/src/context.rs:149:13
  13: cranelift_codegen::context::Context::compile
             at ./cranelift/codegen/src/context.rs:224:23
  14: cranelift_codegen::context::Context::compile_and_emit
             at ./cranelift/codegen/src/context.rs:132:29
  15: clif_util::compile::handle_module
             at ./cranelift/src/compile.rs:71:33
  16: clif_util::compile::run
             at ./cranelift/src/compile.rs:46:9
  17: clif_util::main
             at ./cranelift/src/clif-util.rs:106:33
  18: core::ops::function::FnOnce::call_once
             at /rustc/a55dd71d5fb0ec5a6a3a9e8c27b2127ba491ce52/library/core/src/ops/function.rs:248:5

</details>

view this post on Zulip Wasmtime GitHub notifications bot (Oct 04 2022 at 20:33):

nivkner edited a comment on issue #4953:

the following code compiles without error when setting use_egraphs=false but produces an error when use_egraphs=true:

target x86_64

function u0:1302(i64) -> i64 system_v {

        block0(v0: i64):
                v9 = atomic_rmw.i64 add v0, v0
                return v0
}

the error is

thread 'main' panicked at 'index out of bounds: the len is 1 but the index is 1', /home/user/Documents/wasmtime/target/debug/build/cranelift-codegen-ae89adb74262e952/out/opcodes.rs:1979:39

<details>
<summary>backtrace</summary>

stack backtrace:
   0: rust_begin_unwind
             at /rustc/a55dd71d5fb0ec5a6a3a9e8c27b2127ba491ce52/library/std/src/panicking.rs:584:5
   1: core::panicking::panic_fmt
             at /rustc/a55dd71d5fb0ec5a6a3a9e8c27b2127ba491ce52/library/core/src/panicking.rs:142:14
   2: core::panicking::panic_bounds_check
             at /rustc/a55dd71d5fb0ec5a6a3a9e8c27b2127ba491ce52/library/core/src/panicking.rs:84:5
   3: cranelift_codegen::ir::instructions::InstructionImms::with_args
             at ./target/debug/build/cranelift-codegen-ae89adb74262e952/out/opcodes.rs:1979:39
   4: cranelift_codegen::egraph::elaborate::Elaborator::add_node
             at ./cranelift/codegen/src/egraph/elaborate.rs:197:17
   5: cranelift_codegen::egraph::elaborate::Elaborator::process_elab_stack
             at ./cranelift/codegen/src/egraph/elaborate.rs:445:35
   6: cranelift_codegen::egraph::elaborate::Elaborator::elaborate_eclass_use
             at ./cranelift/codegen/src/egraph/elaborate.rs:285:9
   7: cranelift_codegen::egraph::elaborate::Elaborator::elaborate_block
             at ./cranelift/codegen/src/egraph/elaborate.rs:513:13
   8: cranelift_codegen::egraph::elaborate::Elaborator::elaborate_domtree
             at ./cranelift/codegen/src/egraph/elaborate.rs:534:21
   9: cranelift_codegen::egraph::elaborate::Elaborator::elaborate
             at ./cranelift/codegen/src/egraph/elaborate.rs:585:9
  10: cranelift_codegen::egraph::FuncEGraph::elaborate
             at ./cranelift/codegen/src/egraph.rs:348:9
  11: cranelift_codegen::context::Context::optimize
             at ./cranelift/codegen/src/context.rs:203:13
  12: cranelift_codegen::context::Context::compile_stencil
             at ./cranelift/codegen/src/context.rs:149:13
  13: cranelift_codegen::context::Context::compile
             at ./cranelift/codegen/src/context.rs:224:23
  14: cranelift_codegen::context::Context::compile_and_emit
             at ./cranelift/codegen/src/context.rs:132:29
  15: clif_util::compile::handle_module
             at ./cranelift/src/compile.rs:71:33
  16: clif_util::compile::run
             at ./cranelift/src/compile.rs:46:9
  17: clif_util::main
             at ./cranelift/src/clif-util.rs:106:33
  18: core::ops::function::FnOnce::call_once
             at /rustc/a55dd71d5fb0ec5a6a3a9e8c27b2127ba491ce52/library/core/src/ops/function.rs:248:5

</details>

also reduced from rustc_codegen_cranelift output

view this post on Zulip Wasmtime GitHub notifications bot (Oct 04 2022 at 21:31):

cfallin commented on issue #4953:

the following code compiles without error when setting use_egraphs=false but produces an error when use_egraphs=true:

Thanks! Fixed now -- atomic ops were incorrectly being handled as ordinary loads by the alias-analysis machinery in egraph optimization.

view this post on Zulip Wasmtime GitHub notifications bot (Oct 06 2022 at 21:35):

cfallin commented on issue #4953:

Thanks @jameysharp! I've addressed your comments so far and merged the latest main in again (including resolving overlaps in the current mid-end rules, as overlap checking is now on by default). Happy to address any other comments as you have them.

view this post on Zulip Wasmtime GitHub notifications bot (Oct 07 2022 at 00:51):

nivkner commented on issue #4953:

when modifying https://github.com/bjorn3/rustc_codegen_cranelift to use this PR, and running the tests of rand_chacha using cargo-clif as described in the rustc_codegen_cranelift repo,
without this PR all the tests pass, with this PR test_chacha_true_values_c fails.

view this post on Zulip Wasmtime GitHub notifications bot (Oct 07 2022 at 02:30):

cfallin commented on issue #4953:

when modifying https://github.com/bjorn3/rustc_codegen_cranelift to use this PR, and running the tests of rand_chacha using cargo-clif as described in the rustc_codegen_cranelift repo,
without this PR all the tests pass, with this PR test_chacha_true_values_c fails.

Could you see if you can minimize this to a CLIF file? Or at least, provide more details on the failure?

Reports from out-of-repo users are absolutely valuable, but are hard to act upon: generally we should strive for development of Cranelift to require only the Cranelift repo, and if failures are seen only outside of the repo, that means we need more tests in-repo. We definitely should not have to create a cg\_clif development setup to chase down bugs. If/when a bug report with sufficient detail exists, we can work through it.

Thank you for trying this out, though.

view this post on Zulip Wasmtime GitHub notifications bot (Oct 07 2022 at 17:24):

cfallin commented on issue #4953:

@jameysharp I've addressed everything except for the one open thread above; thanks!

view this post on Zulip Wasmtime GitHub notifications bot (Oct 07 2022 at 23:57):

cfallin commented on issue #4953:

Just merged in main once more. Hopefully that's the last merge from main into this PR, if all goes well :-) @jameysharp I'm eagerly awaiting any more comments you have!

view this post on Zulip Wasmtime GitHub notifications bot (Oct 08 2022 at 10:23):

nivkner edited a comment on issue #4953:

when modifying https://github.com/bjorn3/rustc_codegen_cranelift to use this PR, and running the tests of rand_chacha using cargo-clif as described in the rustc_codegen_cranelift repo,
without this PR all the tests pass, with this PR test_chacha_true_values_c fails.

EDIT: unable to reproduce the above bug as of e992197b405b8976094b26489955e271379fcda3.

view this post on Zulip Wasmtime GitHub notifications bot (Oct 10 2022 at 20:03):

bjorn3 commented on issue #4953:

To be clear this doesn't change anything if the respective setting isn't explicitly enabled? If it does change things I would like to test it with cg_clif first tomorrow.

view this post on Zulip Wasmtime GitHub notifications bot (Oct 10 2022 at 20:05):

cfallin commented on issue #4953:

To be clear this doesn't change anything if the respective setting isn't explicitly enabled? If it does change things I would like to test it with cg_clif first tomorrow.

Yes, there is no change by default; the option has to be specifically enabled. At some later point we'll want to turn it on by default but only after it's tested and mature.

view this post on Zulip Wasmtime GitHub notifications bot (Oct 11 2022 at 05:20):

cfallin commented on issue #4953:

Have you measured the performance impact of this PR with egraphs disabled? I see that ScopedHashMap is used by simple_gvn, which I was recently noticing takes a non-trivial amount of time. It looks to me like the ScopedHashMap changes should make some operations faster, so it could be an improvement, but it would be nice to check that it's not a regression.

I did earlier on, and testing again just now with SpiderMonkey.wasm, I see, uh... a 6% speedup?

cfallin@min:~/work/wasmtime % RAYON_NUM_THREADS=1 hyperfine './wasmtime.main compile ../wasm-tests/spidermonkey.wasm'
Benchmark 1: ./wasmtime.main compile ../wasm-tests/spidermonkey.wasm
  Time (mean ± σ):      6.028 s ±  0.196 s    [User: 5.821 s, System: 0.157 s]
  Range (min  max):    5.883 s   6.483 s    10 runs

cfallin@min:~/work/wasmtime % RAYON_NUM_THREADS=1 hyperfine './wasmtime.egraph compile ../wasm-tests/spidermonkey.wasm'
Benchmark 1: ./wasmtime.egraph compile ../wasm-tests/spidermonkey.wasm
  Time (mean ± σ):      5.761 s ±  0.030 s    [User: 5.613 s, System: 0.139 s]
  Range (min  max):    5.702 s   5.808 s    10 runs

(That's measuring on my M1 Air laptop, pinned to 1 core but otherwise no special measures. I verified looking at the context.rs diff again that the list of passes being run is not any different. I suspect the difference could be at least partly due to the faster ScopedHashMap but I can look a bit deeper into this)

I don't think I can review the code-motion changes in the ISLE preludes, on either the Rust or .isle sides. I tried some basic diffs but it looks like things are in a different order as well as being moved to different files.

Yeah, sorry, that's a bit of a mess now due to all the rebasing -- there was a good amount of manual cherrypicking of new definitions. I'll see if I can clean up the diff a bit (given that this is hopefully merging soon there won't be other work that'll invalidate this with more conflicts later!).

Ignoring those, I think I just have egraph.rs and elaborate.rs left, which I'll have to tackle tomorrow.

Thanks (and uh, bon voyage and good luck; those are some of the most exciting bits of this PR)!

view this post on Zulip Wasmtime GitHub notifications bot (Oct 11 2022 at 20:00):

cfallin commented on issue #4953:

Yeah, sorry, that's a bit of a mess now due to all the rebasing -- there was a good amount of manual cherrypicking of new definitions. I'll see if I can clean up the diff a bit (given that this is hopefully merging soon there won't be other work that'll invalidate this with more conflicts later!).

I've gone over the diff to the ISLE-side and Rust-side definitions of the prelude and ensured that the common bits, which are new files from git's point of view, now have contents that are strictly in the same order and exactly match the removed lines from the old (lowering-only) prelude. (Latest commit does some reordering to make this true.)

(This involved a "diff-of-diffs" workflow and was a little ugly; and I wish git had better ways of showing code provenance for cross-file moves; but in the end at least I'm confident no definition was inadvertently missed or reverted to an older version.)

view this post on Zulip Wasmtime GitHub notifications bot (Oct 12 2022 at 00:31):

cfallin commented on issue #4953:

Thanks so much for the detailed review -- it was really helpful!

So ends one long saga, and begins another (actually using this thing) :-)

view this post on Zulip Wasmtime GitHub notifications bot (Oct 12 2022 at 00:44):

jameysharp commented on issue #4953:

Have you measured the performance impact of this PR with egraphs disabled? I see that ScopedHashMap is used by simple_gvn, which I was recently noticing takes a non-trivial amount of time. It looks to me like the ScopedHashMap changes should make some operations faster, so it could be an improvement, but it would be nice to check that it's not a regression.

I did earlier on, and testing again just now with SpiderMonkey.wasm, I see, uh... a 6% speedup?

I was curious about this so I've just compared the current merge-base from main (d68ca3711) with this branch (ec8a1a932). I see a 1% improvement in compile time/CPU cycles/instructions retired on the bz2, pulldown-cmark, and spidermonkey benchmarks. Not 6% but definitely nice!


Last updated: Nov 22 2024 at 17:03 UTC