unicode-org / icu4x

Solving i18n for client-side and resource-constrained environments.
https://icu4x.unicode.org
Other
1.35k stars 174 forks source link

Iai benches in icu_collections fail with latest valgrind version #5105

Open zamazan4ik opened 3 months ago

zamazan4ik commented 3 months ago

Hi!

I tried to run the benchmarks for the library with RUST_BACKTRACE=full cargo bench --workspace --all-features -p icu_collections --bench iai_cpt but got the following error:

RUST_BACKTRACE=full cargo bench --workspace --all-features -p icu_collections --bench iai_cpt
warning: /home/zamazan4ik/open_source/icu4x/provider/data/normalizer/Cargo.toml: unused manifest key: lints.rust.unexpected_cfgs.check-cfg
warning: /home/zamazan4ik/open_source/icu4x/provider/data/list/Cargo.toml: unused manifest key: lints.rust.unexpected_cfgs.check-cfg
warning: /home/zamazan4ik/open_source/icu4x/provider/data/collator/Cargo.toml: unused manifest key: lints.rust.unexpected_cfgs.check-cfg
warning: /home/zamazan4ik/open_source/icu4x/provider/data/segmenter/Cargo.toml: unused manifest key: lints.rust.unexpected_cfgs.check-cfg
warning: /home/zamazan4ik/open_source/icu4x/ffi/freertos/Cargo.toml: unused manifest key: lints.rust.unexpected_cfgs.check-cfg
warning: /home/zamazan4ik/open_source/icu4x/provider/data/calendar/Cargo.toml: unused manifest key: lints.rust.unexpected_cfgs.check-cfg
warning: /home/zamazan4ik/open_source/icu4x/provider/data/locale/Cargo.toml: unused manifest key: lints.rust.unexpected_cfgs.check-cfg
warning: /home/zamazan4ik/open_source/icu4x/provider/data/timezone/Cargo.toml: unused manifest key: lints.rust.unexpected_cfgs.check-cfg
warning: /home/zamazan4ik/open_source/icu4x/provider/data/plurals/Cargo.toml: unused manifest key: lints.rust.unexpected_cfgs.check-cfg
warning: /home/zamazan4ik/open_source/icu4x/provider/data/decimal/Cargo.toml: unused manifest key: lints.rust.unexpected_cfgs.check-cfg
warning: /home/zamazan4ik/open_source/icu4x/provider/data/properties/Cargo.toml: unused manifest key: lints.rust.unexpected_cfgs.check-cfg
warning: /home/zamazan4ik/open_source/icu4x/components/datetime/Cargo.toml: unused manifest key: lints.rust.unexpected_cfgs.check-cfg
warning: /home/zamazan4ik/open_source/icu4x/components/collections/codepointtrie_builder/Cargo.toml: unused manifest key: lints.rust.unexpected_cfgs.check-cfg
warning: /home/zamazan4ik/open_source/icu4x/provider/data/datetime/Cargo.toml: unused manifest key: lints.rust.unexpected_cfgs.check-cfg
warning: /home/zamazan4ik/open_source/icu4x/provider/data/casemap/Cargo.toml: unused manifest key: lints.rust.unexpected_cfgs.check-cfg
warning: /home/zamazan4ik/open_source/icu4x/provider/data/experimental/Cargo.toml: unused manifest key: lints.rust.unexpected_cfgs.check-cfg
    Finished `bench` profile [optimized] target(s) in 0.15s
     Running benches/iai_cpt.rs (target/release/deps/iai_cpt-1b6b5bef78d4bc51)
thread 'main' panicked at /home/zamazan4ik/.cargo/registry/src/index.crates.io-6f17d22bba15001f/iai-0.1.1/src/lib.rs:162:46:
no entry found for key
stack backtrace:
   0:     0x55f5e7a8c697 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::hffecb437d922f988
   1:     0x55f5e7a4895c - core::fmt::write::hd9a8d7d029f9ea1a
   2:     0x55f5e7a61752 - std::io::Write::write_fmt::h0e1226b2b8d973fe
   3:     0x55f5e7a9177f - std::sys_common::backtrace::print::he907f6ad7eee41cb
   4:     0x55f5e7a9155a - std::panicking::default_hook::{{closure}}::h3926193b61c9ca9b
   5:     0x55f5e7a91dac - std::panicking::rust_panic_with_hook::h0ad14d90dcf5224f
   6:     0x55f5e7a91940 - std::panicking::begin_panic_handler::{{closure}}::h4a1838a06f542647
   7:     0x55f5e7a91896 - std::sys_common::backtrace::__rust_end_short_backtrace::h77cc4dc3567ca904
   8:     0x55f5e7a91883 - rust_begin_unwind
   9:     0x55f5e7a411f4 - core::panicking::panic_fmt::h940d4fd01a4b4fd1
  10:     0x55f5e7a4a040 - core::panicking::panic_display::h277de99b44f66bbb
  11:     0x55f5e7a415fb - core::option::expect_failed::h9d76e63e47b0f089
  12:     0x55f5e7a54c56 - iai::parse_cachegrind_output::h1d6fca6b55903ab1
  13:     0x55f5e7a528e5 - iai::run_bench::h95b1c897770e8e5f
  14:     0x55f5e7a45058 - iai_cpt::main::he712d3e7175d150c
  15:     0x55f5e7a44043 - std::sys_common::backtrace::__rust_begin_short_backtrace::h9ad18cab30d9800d
  16:     0x55f5e7a469da - main
  17:     0x7fd0f90ec088 - __libc_start_call_main
  18:     0x7fd0f90ec14b - __libc_start_main_impl
  19:     0x55f5e7a43f75 - _start
  20:                0x0 - <unknown>
error: bench failed, to rerun pass `-p icu_collections --bench iai_cpt`

Expected behavior: the benchmark finishes successfully.

Library version: main branch, 4eeb7b7ab2a148c6ff37918a5a246af3759d4fd1 commit OS: Fedora 40 (Linux kernel 6.9.4) Compiler: Rustc 1.78

If you need more information - I will provide as much as possible.

sffc commented 3 months ago

Doesn't reproduce for me on Debian, 6.6.15:

$ RUST_BACKTRACE=full cargo bench --workspace --all-features -p icu_collections --bench iai_cpt
...
   Compiling icu v1.5.0
    Finished `bench` profile [optimized] target(s) in 1m 05s
     Running benches/iai_cpt.rs (target/release/deps/iai_cpt-1b6b5bef78d4bc51)
bench_iai_cpt_latin_fast
  Instructions:                 809 (-97.28441%)
  L1 Accesses:                  939 (-98.14837%)
  L2 Accesses:                    1 (-96.29630%)
  RAM Accesses:                  14 (-87.61062%)
  Estimated Cycles:            1434 (-97.38331%)

bench_iai_cpt_latin_small
  Instructions:                 808 (-97.29150%)
  L1 Accesses:                  938 (-98.15191%)
  L2 Accesses:                    2 (-92.30769%)
  RAM Accesses:                  13 (-88.39286%)
  Estimated Cycles:            1403 (-97.44001%)

bench_iai_cpt_mixed_fast
  Instructions:                1586 (-96.87445%)
  L1 Accesses:                 1786 (-97.93040%)
  L2 Accesses:                    1 (-96.77419%)
  RAM Accesses:                  34 (-79.39394%)
  Estimated Cycles:            2981 (-96.76776%)

bench_iai_cpt_mixed_small
  Instructions:                1699 (-96.88423%)
  L1 Accesses:                 1911 (-97.94064%)
  L2 Accesses:                    5 (-81.48148%)
  RAM Accesses:                  30 (-80.64516%)
  Estimated Cycles:            2986 (-96.96409%)
zamazan4ik commented 3 months ago

Hmm, it's interesting. Are there any special requirements regarding configuring the dev environment after cloning the repo? Maybe some "dependency" is missing or something like that - just guessing.

sffc commented 3 months ago

These benches use iai, which says you need to have valgrind installed and working:

https://github.com/bheisler/iai

zamazan4ik commented 3 months ago

I will recheck this requirement a bit later - thanks! If it works - I will report back.

zamazan4ik commented 3 months ago

@sffc what is your Valgrind version? My is 3.23.0 and seems like I met this issue: https://github.com/bheisler/iai/issues/34 + https://github.com/bheisler/iai/issues/36

sffc commented 3 months ago
$ valgrind --version
valgrind-3.20.0