[go: nahoru, domu]

Skip to content

Commit

Permalink
Make comparative benchmarks compile with old STL
Browse files Browse the repository at this point in the history
  • Loading branch information
Maratyszcza committed Feb 19, 2017
1 parent 7580a53 commit 43020c3
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 8 deletions.
6 changes: 4 additions & 2 deletions bench/from-ieee-array.cc
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,8 @@ BENCHMARK(fp16_ieee_to_fp32_value)->RangeMultiplier(2)->Range(1<<10, 64<<20);
float* output = fp32.data();
const size_t n = state.range(0);
for (size_t i = 0; i < n; i++) {
output[i] = half_float::detail::half2float_impl(input[i], std::true_type());
output[i] = half_float::detail::half2float_impl(input[i],
half_float::detail::true_type());
}

benchmark::DoNotOptimize(output);
Expand All @@ -308,7 +309,8 @@ BENCHMARK(fp16_ieee_to_fp32_value)->RangeMultiplier(2)->Range(1<<10, 64<<20);
float* output = fp32.data();
const size_t n = state.range(0);
for (size_t i = 0; i < n; i++) {
output[i] = half_float::detail::half2float_impl(input[i], std::false_type());
output[i] = half_float::detail::half2float_impl(input[i],
half_float::detail::false_type());
}

benchmark::DoNotOptimize(output);
Expand Down
12 changes: 8 additions & 4 deletions bench/ieee-element.cc
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,8 @@ BENCHMARK(fp16_ieee_to_fp32_value);
uint16_t fp16 = UINT16_C(0x7C00);
while (state.KeepRunning()) {
const float fp32 =
half_float::detail::half2float_impl(fp16, std::true_type());
half_float::detail::half2float_impl(fp16,
half_float::detail::true_type());

fp16 = next_xorshift16(fp16);
benchmark::DoNotOptimize(fp32);
Expand All @@ -153,7 +154,8 @@ BENCHMARK(fp16_ieee_to_fp32_value);
uint16_t fp16 = UINT16_C(0x7C00);
while (state.KeepRunning()) {
const float fp32 =
half_float::detail::half2float_impl(fp16, std::false_type());
half_float::detail::half2float_impl(fp16,
half_float::detail::false_type());

fp16 = next_xorshift16(fp16);
benchmark::DoNotOptimize(fp32);
Expand Down Expand Up @@ -243,7 +245,8 @@ BENCHMARK(fp16_ieee_from_fp32_value);
while (state.KeepRunning()) {
const uint16_t fp16 =
half_float::detail::float2half_impl<std::round_to_nearest>(
fp32_from_bits(fp32), std::true_type());
fp32_from_bits(fp32),
half_float::detail::true_type());

fp32 = next_xorshift32(fp32);
benchmark::DoNotOptimize(fp16);
Expand All @@ -256,7 +259,8 @@ BENCHMARK(fp16_ieee_from_fp32_value);
while (state.KeepRunning()) {
const uint16_t fp16 =
half_float::detail::float2half_impl<std::round_to_nearest>(
fp32_from_bits(fp32), std::false_type());
fp32_from_bits(fp32),
half_float::detail::false_type());

fp32 = next_xorshift32(fp32);
benchmark::DoNotOptimize(fp16);
Expand Down
4 changes: 2 additions & 2 deletions bench/to-ieee-array.cc
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ BENCHMARK(fp16_ieee_from_fp32_value)->RangeMultiplier(2)->Range(1<<10, 64<<20);
for (size_t i = 0; i < n; i++) {
output[i] =
half_float::detail::float2half_impl<std::round_to_nearest>(
input[i], std::true_type());
input[i], half_float::detail::true_type());
}

benchmark::DoNotOptimize(output);
Expand All @@ -242,7 +242,7 @@ BENCHMARK(fp16_ieee_from_fp32_value)->RangeMultiplier(2)->Range(1<<10, 64<<20);
for (size_t i = 0; i < n; i++) {
output[i] =
half_float::detail::float2half_impl<std::round_to_nearest>(
input[i], std::false_type());
input[i], half_float::detail::false_type());
}

benchmark::DoNotOptimize(output);
Expand Down

0 comments on commit 43020c3

Please sign in to comment.