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

Panic in subgroup_fft_in_place benchmark #281

Closed
daira opened this issue May 17, 2021 · 4 comments · Fixed by #284
Closed

Panic in subgroup_fft_in_place benchmark #281

daira opened this issue May 17, 2021 · 4 comments · Fixed by #284

Comments

@daira
Copy link
Contributor

daira commented May 17, 2021

$ cargo +nightly bench
[...]
Benchmarking "mnt6_753 - mixed radix" - subgroup_fft_in_place/1048576: Warming up for 3.0000 sthread 'main' panicked at 'called `Option::unwrap()` on a `None` value', poly-benches/benches/fft.rs:43:33
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

error: bench failed

This was on the add-biginterger-into-from-biguint branch; not sure if that's relevant. I will try later to see if I can reproduce this with a backtrace and on master.

@daira
Copy link
Contributor Author

daira commented May 17, 2021

This is reproducible on master:

daira@katava:~/research/algebra/poly-benches$ git rev-parse HEAD
ebd1c3f14a46f2a9992727d5ef51cf9ca963fb97
daira@katava:~/research/algebra/poly-benches$ RUST_BACKTRACE=full cargo +nightly bench 'subgroup_fft_in_place/1048576'
    Finished bench [optimized] target(s) in 0.05s
     Running /home/daira/research/algebra/target/release/deps/dense_multilinear-f05f1341652c05a9
WARNING: HTML report generation will become a non-default optional feature in Criterion.rs 0.4.0.
This feature is being moved to cargo-criterion (https://github.com/bheisler/cargo-criterion) and will be optional in a future version of Criterion.rs. To silence this warning, either switch to cargo-criterion or enable the 'html_reports' feature in your Cargo.toml.

     Running /home/daira/research/algebra/target/release/deps/dense_uv_polynomial-44cf4355ca5d175a
WARNING: HTML report generation will become a non-default optional feature in Criterion.rs 0.4.0.
This feature is being moved to cargo-criterion (https://github.com/bheisler/cargo-criterion) and will be optional in a future version of Criterion.rs. To silence this warning, either switch to cargo-criterion or enable the 'html_reports' feature in your Cargo.toml.

     Running /home/daira/research/algebra/target/release/deps/fft-a2ece2d48720aaf1
WARNING: HTML report generation will become a non-default optional feature in Criterion.rs 0.4.0.
This feature is being moved to cargo-criterion (https://github.com/bheisler/cargo-criterion) and will be optional in a future version of Criterion.rs. To silence this warning, either switch to cargo-criterion or enable the 'html_reports' feature in your Cargo.toml.

Benchmarking "bls12_381 - radix2" - subgroup_fft_in_place/1048576: Warming up for 3.0000 s
Warning: Unable to complete 100 samples in 5.0s. You may wish to increase target time to 56.1s, or reduce sample count to 10.
"bls12_381 - radix2" - subgroup_fft_in_place/1048576                                                                            
                        time:   [550.66 ms 551.61 ms 552.74 ms]
                        change: [-2.1659% -1.9715% -1.7114%] (p = 0.00 < 0.05)
                        Performance has improved.
Found 4 outliers among 100 measurements (4.00%)
  3 (3.00%) high mild
  1 (1.00%) high severe

Benchmarking "mnt6_753 - mixed radix" - subgroup_fft_in_place/1048576: Warming up for 3.0000 sthread 'main' panicked at 'called `Option::unwrap()` on a `None` value', poly-benches/benches/fft.rs:43:33
stack backtrace:
   0:     0x55674bd09f31 - std::backtrace_rs::backtrace::libunwind::trace::hb4de9797f80b7b8c
                               at /rustc/3e826bb11228508fbe749e594038d6727208aa94/library/std/src/../../backtrace/src/backtrace/libunwind.rs:90:5
   1:     0x55674bd09f31 - std::backtrace_rs::backtrace::trace_unsynchronized::h59566d0bd20efff7
                               at /rustc/3e826bb11228508fbe749e594038d6727208aa94/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x55674bd09f31 - std::sys_common::backtrace::_print_fmt::hcfa5ce6be50275d4
                               at /rustc/3e826bb11228508fbe749e594038d6727208aa94/library/std/src/sys_common/backtrace.rs:67:5
   3:     0x55674bd09f31 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::hd8c307a38b9bab04
                               at /rustc/3e826bb11228508fbe749e594038d6727208aa94/library/std/src/sys_common/backtrace.rs:46:22
   4:     0x55674bbabe7c - core::fmt::write::h3868db8542c90941
                               at /rustc/3e826bb11228508fbe749e594038d6727208aa94/library/core/src/fmt/mod.rs:1092:17
   5:     0x55674bd04e52 - std::io::Write::write_fmt::hab90295d5a0f197d
                               at /rustc/3e826bb11228508fbe749e594038d6727208aa94/library/std/src/io/mod.rs:1568:15
   6:     0x55674bd0bba5 - std::sys_common::backtrace::_print::h19224910b8700cf1
                               at /rustc/3e826bb11228508fbe749e594038d6727208aa94/library/std/src/sys_common/backtrace.rs:49:5
   7:     0x55674bd0bba5 - std::sys_common::backtrace::print::h25dedfa68c5fb84a
                               at /rustc/3e826bb11228508fbe749e594038d6727208aa94/library/std/src/sys_common/backtrace.rs:36:9
   8:     0x55674bd0bba5 - std::panicking::default_hook::{{closure}}::h12c5765653a72a42
                               at /rustc/3e826bb11228508fbe749e594038d6727208aa94/library/std/src/panicking.rs:208:50
   9:     0x55674bd0c5c1 - std::panicking::default_hook::he65cee71c4209f0c
                               at /rustc/3e826bb11228508fbe749e594038d6727208aa94/library/std/src/panicking.rs:225:9
  10:     0x55674bd0c5c1 - std::panicking::rust_panic_with_hook::h01a674d863fe0d8a
                               at /rustc/3e826bb11228508fbe749e594038d6727208aa94/library/std/src/panicking.rs:591:17
  11:     0x55674bd0bdbe - std::panicking::begin_panic_handler::{{closure}}::h9b9fecf185178864
                               at /rustc/3e826bb11228508fbe749e594038d6727208aa94/library/std/src/panicking.rs:495:13
  12:     0x55674bd0a5ac - std::sys_common::backtrace::__rust_end_short_backtrace::h57be46a42dc7f24b
                               at /rustc/3e826bb11228508fbe749e594038d6727208aa94/library/std/src/sys_common/backtrace.rs:141:18
  13:     0x55674bd0bd5d - rust_begin_unwind
                               at /rustc/3e826bb11228508fbe749e594038d6727208aa94/library/std/src/panicking.rs:493:5
  14:     0x55674bbaa771 - core::panicking::panic_fmt::h20225113c4a2f8fd
                               at /rustc/3e826bb11228508fbe749e594038d6727208aa94/library/core/src/panicking.rs:92:14
  15:     0x55674bbaa6bd - core::panicking::panic::h35b77276aa4b0c12
                               at /rustc/3e826bb11228508fbe749e594038d6727208aa94/library/core/src/panicking.rs:50:5
  16:     0x55674bb2aca0 - fft::fft_common_setup::h49f1cd2bc295e71d
  17:     0x55674bb2ad8f - fft::bench_fft_in_place::habe6d95ccfed1e0a
  18:     0x55674bb34ae7 - <criterion::routine::Function<M,F,T> as criterion::routine::Routine<M,T>>::warm_up::h160df70a7595e4bf
  19:     0x55674bb34f3e - criterion::routine::Routine::sample::heae47f72909b8536
  20:     0x55674bb4bb6c - criterion::analysis::common::h5fa265362077573f
  21:     0x55674bb407b5 - criterion::benchmark_group::BenchmarkGroup<M>::bench_with_input::h73e08d1cb5335dd0
  22:     0x55674bc90950 - fft::setup_bench::h8f9c51cf5671ea12
  23:     0x55674bb2b569 - fft::fft_benches::hae5473918f4490d4
  24:     0x55674bc90a4f - fft::main::h41dbcd916ce7d852
  25:     0x55674bb177d6 - std::sys_common::backtrace::__rust_begin_short_backtrace::h37b0da6974e60185
  26:     0x55674bb1f80c - std::rt::lang_start::{{closure}}::h385306b3b4228dbe
  27:     0x55674bd0cc03 - core::ops::function::impls::<impl core::ops::function::FnOnce<A> for &F>::call_once::h2c4fd7d4128112a8
                               at /rustc/3e826bb11228508fbe749e594038d6727208aa94/library/core/src/ops/function.rs:259:13
  28:     0x55674bd0cc03 - std::panicking::try::do_call::h41fb7dbbbe7bece6
                               at /rustc/3e826bb11228508fbe749e594038d6727208aa94/library/std/src/panicking.rs:379:40
  29:     0x55674bd0cc03 - std::panicking::try::hd38008ccba72bce1
                               at /rustc/3e826bb11228508fbe749e594038d6727208aa94/library/std/src/panicking.rs:343:19
  30:     0x55674bd0cc03 - std::panic::catch_unwind::h057e765cd60f2d13
                               at /rustc/3e826bb11228508fbe749e594038d6727208aa94/library/std/src/panic.rs:431:14
  31:     0x55674bd0cc03 - std::rt::lang_start_internal::hdb9d0b9d2cdcda8b
                               at /rustc/3e826bb11228508fbe749e594038d6727208aa94/library/std/src/rt.rs:51:25
  32:     0x55674bc90b85 - main
  33:     0x7fad67204e0b - __libc_start_main
  34:     0x55674bb160aa - _start
  35:                0x0 - <unknown>

error: bench failed

@Pratyush
Copy link
Member

Hmm, let me try to reproduce this. Thanks for the heads up!

@weikengchen
Copy link
Member

Found the reason.

The bench program considers degrees of 2^15 to 2^22.

This is okay for BLS12-381::Fr, but not good for MNT6-753::Fr

use ark_test_curves::mnt4_753::Fq as mnt6_753_fr;

use ark_test_curves::mnt4_753::Fq as mnt6_753_fr;

The latter only has 2^15 * 5^2, which is smaller than 1048576, aka 2^20.

We can separate the benchmark size of the two curves, by separating the default_size_range for each curve.

@weikengchen
Copy link
Member

A PR is on the way.

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 a pull request may close this issue.

3 participants