[libc-commits] [libc] [libc] [gpu] Change Time To Be Per Iteration (PR #101919)
via libc-commits
libc-commits at lists.llvm.org
Sun Aug 4 20:28:44 PDT 2024
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-libc
Author: None (jameshu15869)
<details>
<summary>Changes</summary>
Previously, the time field was the total time take to run all iterations of the benchmark. This PR changes the value displayed to be the average time take by each iteration.
---
Full diff: https://github.com/llvm/llvm-project/pull/101919.diff
1 Files Affected:
- (modified) libc/benchmarks/gpu/LibcGpuBenchmark.cpp (+5-5)
``````````diff
diff --git a/libc/benchmarks/gpu/LibcGpuBenchmark.cpp b/libc/benchmarks/gpu/LibcGpuBenchmark.cpp
index a5dbc62a2087b..28235cf137c18 100644
--- a/libc/benchmarks/gpu/LibcGpuBenchmark.cpp
+++ b/libc/benchmarks/gpu/LibcGpuBenchmark.cpp
@@ -115,7 +115,7 @@ void print_results(Benchmark *b) {
cpp::atomic_thread_fence(cpp::MemoryOrder::RELEASE);
LIBC_NAMESPACE::printf(
- "%-20s |%8ld |%8ld |%8ld |%11d |%9ld %2s |%9ld |%9d |\n",
+ "%-20s |%8ld |%8ld |%8ld |%11d |%14ld %2s |%9ld |%9d |\n",
b->get_test_name().data(), result.cycles, result.min, result.max,
result.total_iterations, result.total_time, time_unit,
static_cast<uint64_t>(result.standard_deviation), num_threads);
@@ -126,9 +126,9 @@ void print_header() {
LIBC_NAMESPACE::printf("Running Suite: %-10s\n",
benchmarks[0]->get_suite_name().data());
LIBC_NAMESPACE::printf("%s", RESET);
- LIBC_NAMESPACE::printf("Benchmark | Cycles | Min | Max | "
- "Iterations | "
- "Time | Stddev | Threads |\n");
+ LIBC_NAMESPACE::printf(
+ "Benchmark | Cycles | Min | Max | "
+ "Iterations | Time / Iteration | Stddev | Threads |\n");
LIBC_NAMESPACE::printf(
"---------------------------------------------------------------------"
"--------------------------------\n");
@@ -222,7 +222,7 @@ BenchmarkResult benchmark(const BenchmarkOptions &options,
result.max = max;
result.samples = samples;
result.total_iterations = total_iterations;
- result.total_time = total_time;
+ result.total_time = total_time / total_iterations;
return result;
};
``````````
</details>
https://github.com/llvm/llvm-project/pull/101919
More information about the libc-commits
mailing list