Add log and log2 benchmark

Similar to exp/exp2, this patch add two benchmarks for log and log2:
one which measures thoughput and one which measures latency.

The input data is based on logf/log2f one (reduced trace based on 2.8
billion samples extracted from specpu2017 521.wrf_r benchmark).

Test: ran 32-bit and 64-bit x86 tests on host

Change-Id: I51a9e2960e45d5619585e685eaa7634cc7be901b
This commit is contained in:
Adhemerval Zanella 2018-08-08 11:02:26 -03:00
parent 099835ad2a
commit 56f4511c39

View file

@ -355,6 +355,9 @@ BIONIC_BENCHMARK(BM_math_powf_speccpu2017_latency);
#include "logf_input.cpp"
static const std::vector<double> log_input (logf_input.begin(),
logf_input.end());
static void BM_math_logf_speccpu2017(benchmark::State& state) {
f = 0.0;
auto cin = logf_input.cbegin();
@ -377,6 +380,28 @@ static void BM_math_logf_speccpu2017_latency(benchmark::State& state) {
}
BIONIC_BENCHMARK(BM_math_logf_speccpu2017_latency);
static void BM_math_log_speccpu2017(benchmark::State& state) {
d = 0.0;
auto cin = log_input.cbegin();
for (auto _ : state) {
d = log(*cin);
if (++cin == log_input.cend())
cin = log_input.cbegin();
}
}
BIONIC_BENCHMARK(BM_math_log_speccpu2017);
static void BM_math_log_speccpu2017_latency(benchmark::State& state) {
d = 0.0;
auto cin = log_input.cbegin();
for (auto _ : state) {
d = log(d * zerod + *cin);
if (++cin == log_input.cend())
cin = log_input.cbegin();
}
}
BIONIC_BENCHMARK(BM_math_log_speccpu2017_latency);
static void BM_math_log2f_speccpu2017(benchmark::State& state) {
f = 0.0;
auto cin = logf_input.cbegin();
@ -388,6 +413,28 @@ static void BM_math_log2f_speccpu2017(benchmark::State& state) {
}
BIONIC_BENCHMARK(BM_math_log2f_speccpu2017);
static void BM_math_log2_speccpu2017_latency(benchmark::State& state) {
d = 0.0;
auto cin = log_input.cbegin();
for (auto _ : state) {
d = log2(d * zerod + *cin);
if (++cin == log_input.cend())
cin = log_input.cbegin();
}
}
BIONIC_BENCHMARK(BM_math_log2_speccpu2017_latency);
static void BM_math_log2_speccpu2017(benchmark::State& state) {
d = 0.0;
auto cin = log_input.cbegin();
for (auto _ : state) {
d = log2(*cin);
if (++cin == log_input.cend())
cin = log_input.cbegin();
}
}
BIONIC_BENCHMARK(BM_math_log2_speccpu2017);
static void BM_math_log2f_speccpu2017_latency(benchmark::State& state) {
f = 0.0;
auto cin = logf_input.cbegin();