Skip to content

Commit 908bdef

Browse files
committed
use single variable instead of array
1 parent c3e14be commit 908bdef

File tree

1 file changed

+2
-7
lines changed

1 file changed

+2
-7
lines changed

libc/benchmarks/gpu/src/math/sin_benchmark.cpp

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,8 @@ constexpr int RANDOM_INPUT_SIZE = 256;
2525
// easily register NVPTX benchmarks.
2626
#define BM_RANDOM_INPUT(Func) \
2727
[]() { \
28-
LIBC_NAMESPACE::cpp::array<double, RANDOM_INPUT_SIZE> random_input; \
29-
LIBC_NAMESPACE::benchmarks::init_random_double_input(random_input); \
30-
uint64_t total_time = 0; \
31-
for (double i : random_input) { \
32-
total_time += LIBC_NAMESPACE::latency(Func, i); \
33-
} \
34-
return total_time / random_input.size(); \
28+
double x = LIBC_NAMESPACE::benchmarks::get_rand_double(); \
29+
return LIBC_NAMESPACE::latency(Func, x); \
3530
}
3631
BENCHMARK(LlvmLibcSinGpuBenchmark, Sin, BM_RANDOM_INPUT(LIBC_NAMESPACE::sin));
3732

0 commit comments

Comments
 (0)