[Libre-soc-bugs] [Bug 236] Atomics Standard writeup needed

bugzilla-daemon at libre-soc.org bugzilla-daemon at libre-soc.org
Thu Jul 21 11:39:43 BST 2022


https://bugs.libre-soc.org/show_bug.cgi?id=236

--- Comment #41 from Jacob Lifshay <programmerjake at gmail.com> ---
I got the benchmarks to run correctly:
I tested it on both my desktop and on the talos server. It currently just has
the standard c++11 atomic ops, I'll add more OpenPower-specific benchmarks
later.

If you don't specify iteration counts and/or thread counts, it automatically
picks a good value, using all available cpu cores and aiming for the average
elapsed time to be 0.5-1s by doubling iteration counts until running for that
iteration count took >0.5s 

Demo:
./build-x86_64/benchmarks --bench atomic_fetch_add_i64_seq_cst --bench
atomic_load_i64_relaxed -j4
Running: atomic_fetch_add_i64_seq_cst
Thread #0 took 0.936348 sec for 33554432 iterations -- 27.9053 ns/iter.
Thread #1 took 0.909495 sec for 33554432 iterations -- 27.1051 ns/iter.
Thread #2 took 0.91187 sec for 33554432 iterations -- 27.1758 ns/iter.
Thread #3 took 0.936216 sec for 33554432 iterations -- 27.9014 ns/iter.
Average elapsed time: 0.923482 sec for 33554432 iterations -- 27.5219 ns/iter.

Running: atomic_load_i64_relaxed
Thread #0 took 0.681217 sec for 1073741824 iterations -- 0.634432 ns/iter.
Thread #1 took 0.679786 sec for 1073741824 iterations -- 0.6331 ns/iter.
Thread #2 took 0.67332 sec for 1073741824 iterations -- 0.627078 ns/iter.
Thread #3 took 0.675972 sec for 1073741824 iterations -- 0.629548 ns/iter.
Average elapsed time: 0.677574 sec for 1073741824 iterations -- 0.63104
ns/iter.


./build-x86_64/benchmarks --help
Usage: ./build-x86_64/benchmarks [-h|--help] [-j|--thread-count <value>]
[-n|--iter-count <value>] [--log2-mem-loc-count <value>] [--log2-stride
<value>] [-b|--bench <value>]
Options:
-h|--help   Display usage and exit.
-j|--thread-count   Number of threads to run on
-n|--iter-count   Number of iterations to run per thread
--log2-mem-loc-count   Log base 2 of the number of memory locations to access
--log2-stride   Log base 2 of the stride used for accessing memory locations
-b|--bench   List of benchmarks that should be run


./build-x86_64/benchmarks --bench list
Available Benchmarks:
atomic_exchange_u8_relaxed
atomic_fetch_add_u8_relaxed
atomic_fetch_sub_u8_relaxed
atomic_fetch_and_u8_relaxed
atomic_fetch_or_u8_relaxed
atomic_fetch_xor_u8_relaxed
atomic_exchange_u8_acquire
atomic_fetch_add_u8_acquire
atomic_fetch_sub_u8_acquire
atomic_fetch_and_u8_acquire
atomic_fetch_or_u8_acquire
atomic_fetch_xor_u8_acquire
atomic_exchange_u8_release
atomic_fetch_add_u8_release
atomic_fetch_sub_u8_release
atomic_fetch_and_u8_release
atomic_fetch_or_u8_release
atomic_fetch_xor_u8_release
atomic_exchange_u8_acq_rel
atomic_fetch_add_u8_acq_rel
atomic_fetch_sub_u8_acq_rel
atomic_fetch_and_u8_acq_rel
atomic_fetch_or_u8_acq_rel
atomic_fetch_xor_u8_acq_rel
atomic_exchange_u8_seq_cst
atomic_fetch_add_u8_seq_cst
atomic_fetch_sub_u8_seq_cst
atomic_fetch_and_u8_seq_cst
atomic_fetch_or_u8_seq_cst
atomic_fetch_xor_u8_seq_cst
atomic_load_u8_relaxed
atomic_load_u8_acquire
atomic_load_u8_seq_cst
atomic_store_u8_relaxed
atomic_store_u8_release
atomic_store_u8_seq_cst
atomic_compare_exchange_weak_u8_relaxed_relaxed
atomic_compare_exchange_strong_u8_relaxed_relaxed
atomic_compare_exchange_weak_u8_acquire_relaxed
atomic_compare_exchange_strong_u8_acquire_relaxed
atomic_compare_exchange_weak_u8_acquire_acquire
atomic_compare_exchange_strong_u8_acquire_acquire
atomic_compare_exchange_weak_u8_release_relaxed
atomic_compare_exchange_strong_u8_release_relaxed
atomic_compare_exchange_weak_u8_acq_rel_relaxed
atomic_compare_exchange_strong_u8_acq_rel_relaxed
atomic_compare_exchange_weak_u8_acq_rel_acquire
atomic_compare_exchange_strong_u8_acq_rel_acquire
atomic_compare_exchange_weak_u8_seq_cst_relaxed
atomic_compare_exchange_strong_u8_seq_cst_relaxed
atomic_compare_exchange_weak_u8_seq_cst_acquire
atomic_compare_exchange_strong_u8_seq_cst_acquire
atomic_compare_exchange_weak_u8_seq_cst_seq_cst
atomic_compare_exchange_strong_u8_seq_cst_seq_cst
<same for u16 u32 u64 i8 i16 i32 i64>

-- 
You are receiving this mail because:
You are on the CC list for the bug.


More information about the libre-soc-bugs mailing list