Skip to content

Conversation

@BramOtte
Copy link
Contributor

@BramOtte BramOtte commented Feb 5, 2025

Currently the constant coalesce pass is broken, it crashes the plot both on chungus2 and on mpu8.
This pull request fixes this issue and also simplifies the constant coalesce pass by only having 1 constant node instead of 1 for each signal strength

@BramOtte
Copy link
Contributor Author

BramOtte commented Feb 5, 2025

Stack trace
`ERROR mchprs_core::server: plot panicked at /home/bram/.cargo/registry/src/index.crates.io-6f17d22bba15001f/petgraph-0.7.1/src/graph_impl/stable_graph/mod.rs:402:17:
StableGraph::add_edge: node index 235438 is not a node in the graph
0: mchprs_core::server::MinecraftServer::run::{{closure}}
at /home/bram/SynologyDrive/sync/coding/mchprs/MCHPRS/crates/core/src/server.rs:142:29
1: <alloc::boxed::Box<F,A> as core::ops::function::Fn>::call
at /rustc/e71f9a9a98b0faf423844bf0ba7438f29dc27d58/library/alloc/src/boxed.rs:1986:9
std::panicking::rust_panic_with_hook
at /rustc/e71f9a9a98b0faf423844bf0ba7438f29dc27d58/library/std/src/panicking.rs:809:13
2: std::panicking::begin_panic_handler::{{closure}}
at /rustc/e71f9a9a98b0faf423844bf0ba7438f29dc27d58/library/std/src/panicking.rs:674:13
3: std::sys::backtrace::__rust_end_short_backtrace
at /rustc/e71f9a9a98b0faf423844bf0ba7438f29dc27d58/library/std/src/sys/backtrace.rs:170:18
4: rust_begin_unwind
at /rustc/e71f9a9a98b0faf423844bf0ba7438f29dc27d58/library/std/src/panicking.rs:665:5
5: core::panicking::panic_fmt
at /rustc/e71f9a9a98b0faf423844bf0ba7438f29dc27d58/library/core/src/panicking.rs:76:14
6: petgraph::graph_impl::stable_graph::StableGraph<N,E,Ty,Ix>::add_edge
at /home/bram/.cargo/registry/src/index.crates.io-6f17d22bba15001f/petgraph-0.7.1/src/graph_impl/stable_graph/mod.rs:402:17
7: <mchprs_redpiler::passes::constant_coalesce::ConstantCoalesce as mchprs_redpiler::passes::Pass>::run_pass
at /home/bram/SynologyDrive/sync/coding/mchprs/MCHPRS/crates/redpiler/src/passes/constant_coalesce.rs:56:17
8: mchprs_redpiler::passes::PassManager::run_passes
at /home/bram/SynologyDrive/sync/coding/mchprs/MCHPRS/crates/redpiler/src/passes/mod.rs:73:13
9: mchprs_redpiler::Compiler::compile
at /home/bram/SynologyDrive/sync/coding/mchprs/MCHPRS/crates/redpiler/src/lib.rs:135:21
10: mchprs_core::plot::Plot::start_redpiler::{{closure}}::{{closure}}
at /home/bram/SynologyDrive/sync/coding/mchprs/MCHPRS/crates/core/src/plot/mod.rs:697:17
std::sys::backtrace::rust_begin_short_backtrace
at /home/bram/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/sys/backtrace.rs:154:18
11: std::thread::Builder::spawn_unchecked
::{{closure}}::{{closure}}
at /home/bram/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/thread/mod.rs:561:17
<core::panic::unwind_safe::AssertUnwindSafe as core::ops::function::FnOnce<()>>::call_once
at /home/bram/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/panic/unwind_safe.rs:272:9
std::panicking::try::do_call
at /home/bram/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/panicking.rs:557:40
std::panicking::try
at /home/bram/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/panicking.rs:520:19
std::panic::catch_unwind
at /home/bram/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/panic.rs:358:14
std::thread::Builder::spawn_unchecked
::{{closure}}
at /home/bram/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/thread/mod.rs:559:30
core::ops::function::FnOnce::call_once{{vtable.shim}}
at /home/bram/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/ops/function.rs:250:5
12: <alloc::boxed::Box<F,A> as core::ops::function::FnOnce>::call_once
at /rustc/e71f9a9a98b0faf423844bf0ba7438f29dc27d58/library/alloc/src/boxed.rs:1972:9
<alloc::boxed::Box<F,A> as core::ops::function::FnOnce>::call_once
at /rustc/e71f9a9a98b0faf423844bf0ba7438f29dc27d58/library/alloc/src/boxed.rs:1972:9
std::sys::pal::unix::thread::Thread::new::thread_start
at /rustc/e71f9a9a98b0faf423844bf0ba7438f29dc27d58/library/std/src/sys/pal/unix/thread.rs:105:17
13: start_thread
at ./nptl/pthread_create.c:442:8
14: __GI___clone3
at ./misc/../sysdeps/unix/sysv/linux/x86_64/clone3.S:81:0

2025-02-05T18:53:55.869953Z ERROR mchprs_core::server: plot panicked at crates/core/src/plot/mod.rs:695:9:
a scoped thread panicked
0: mchprs_core::server::MinecraftServer::run::{{closure}}
at /home/bram/SynologyDrive/sync/coding/mchprs/MCHPRS/crates/core/src/server.rs:142:29
1: <alloc::boxed::Box<F,A> as core::ops::function::Fn>::call
at /rustc/e71f9a9a98b0faf423844bf0ba7438f29dc27d58/library/alloc/src/boxed.rs:1986:9
std::panicking::rust_panic_with_hook
at /rustc/e71f9a9a98b0faf423844bf0ba7438f29dc27d58/library/std/src/panicking.rs:809:13
2: std::panicking::begin_panic_handler::{{closure}}
at /rustc/e71f9a9a98b0faf423844bf0ba7438f29dc27d58/library/std/src/panicking.rs:667:13
3: std::sys::backtrace::__rust_end_short_backtrace
at /rustc/e71f9a9a98b0faf423844bf0ba7438f29dc27d58/library/std/src/sys/backtrace.rs:170:18
4: rust_begin_unwind
at /rustc/e71f9a9a98b0faf423844bf0ba7438f29dc27d58/library/std/src/panicking.rs:665:5
5: core::panicking::panic_fmt
at /rustc/e71f9a9a98b0faf423844bf0ba7438f29dc27d58/library/core/src/panicking.rs:76:14
6: std::thread::scoped::scope
at /home/bram/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/thread/scoped.rs:162:13
7: mchprs_core::plot::Plot::start_redpiler
at /home/bram/SynologyDrive/sync/coding/mchprs/MCHPRS/crates/core/src/plot/mod.rs:695:9
8: mchprs_core::plot::commands::::handle_redpiler_command
at /home/bram/SynologyDrive/sync/coding/mchprs/MCHPRS/crates/core/src/plot/commands.rs:189:17
mchprs_core::plot::commands::::handle_command
at /home/bram/SynologyDrive/sync/coding/mchprs/MCHPRS/crates/core/src/plot/commands.rs:403:17
mchprs_core::plot::Plot::handle_commands
at /home/bram/SynologyDrive/sync/coding/mchprs/MCHPRS/crates/core/src/plot/mod.rs:843:20
9: mchprs_core::plot::Plot::update
at /home/bram/SynologyDrive/sync/coding/mchprs/MCHPRS/crates/core/src/plot/mod.rs:1066:9
10: mchprs_core::plot::Plot::run
at /home/bram/SynologyDrive/sync/coding/mchprs/MCHPRS/crates/core/src/plot/mod.rs:1213:17
11: mchprs_core::plot::Plot::load_and_run::{{closure}}
at /home/bram/SynologyDrive/sync/coding/mchprs/MCHPRS/crates/core/src/plot/mod.rs:1259:37
std::sys::backtrace::rust_begin_short_backtrace
at /home/bram/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/sys/backtrace.rs:154:18
12: std::thread::Builder::spawn_unchecked
::{{closure}}::{{closure}}
at /home/bram/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/thread/mod.rs:561:17
<core::panic::unwind_safe::AssertUnwindSafe as core::ops::function::FnOnce<()>>::call_once
at /home/bram/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/panic/unwind_safe.rs:272:9
std::panicking::try::do_call
at /home/bram/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/panicking.rs:557:40
std::panicking::try
at /home/bram/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/panicking.rs:520:19
std::panic::catch_unwind
at /home/bram/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/panic.rs:358:14
std::thread::Builder::spawn_unchecked
::{{closure}}
at /home/bram/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/thread/mod.rs:559:30
core::ops::function::FnOnce::call_once{{vtable.shim}}
at /home/bram/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/ops/function.rs:250:5
13: <alloc::boxed::Box<F,A> as core::ops::function::FnOnce>::call_once
at /rustc/e71f9a9a98b0faf423844bf0ba7438f29dc27d58/library/alloc/src/boxed.rs:1972:9
<alloc::boxed::Box<F,A> as core::ops::function::FnOnce>::call_once
at /rustc/e71f9a9a98b0faf423844bf0ba7438f29dc27d58/library/alloc/src/boxed.rs:1972:9
std::sys::pal::unix::thread::Thread::new::thread_start
at /rustc/e71f9a9a98b0faf423844bf0ba7438f29dc27d58/library/std/src/sys/pal/unix/thread.rs:105:17
14: start_thread
at ./nptl/pthread_create.c:442:8
15: __GI___clone3
at ./misc/../sysdeps/unix/sysv/linux/x86_64/clone3.S:81:0`

@BramOtte BramOtte changed the title simplify constant_coalesce pass Simplify constant_coalesce pass Feb 5, 2025
@BramOtte BramOtte force-pushed the simple-constant_coalesce branch from 864ffc0 to 300a927 Compare July 12, 2025 17:06
@BramOtte BramOtte changed the title Simplify constant_coalesce pass Fix and simplify constant_coalesce pass Aug 3, 2025
@BramOtte
Copy link
Contributor Author

The crash this PR fixes is already resolved in another PR and the simplification is also already present in #222
Since there is no urgency for this fix the simplification can simply come with PR 222 thus I am closing this PR.

@BramOtte BramOtte closed this Dec 29, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant