Fix carry over benchmark mismatch count Benchmark mismatch count should reset per test, and in the device test the mismatch count should not be reported. Bug: 345095360 Change-Id: I55e0cf229d314bc2f4c7910c39a7d06d9856f14b
diff --git a/benchmarks/benchmark_kelvin.cc b/benchmarks/benchmark_kelvin.cc index fdec54a..9c3eabb 100644 --- a/benchmarks/benchmark_kelvin.cc +++ b/benchmarks/benchmark_kelvin.cc
@@ -166,6 +166,7 @@ uint64_t end = mcycle_read(); uint64_t num_cycles = end - begin; + output_header.mismatch_count = 0; #if (TEST_DATA_OUTPUT == 1) TfLiteTensor* output = interpreter->output(0); int mismatch_count = 0;
diff --git a/benchmarks/benchmark_smc.c b/benchmarks/benchmark_smc.c index 7edaf46..757ffe8 100644 --- a/benchmarks/benchmark_smc.c +++ b/benchmarks/benchmark_smc.c
@@ -140,13 +140,15 @@ uint64_t average_cycles = udiv64_slow(cycles, iterations, NULL); uint64_t wall_time_us = timer_finish - timer_start; uint64_t average_wall_time_us = udiv64_slow(wall_time_us, iterations, NULL); - uint32_t mismatch_count = output_header_ptr->mismatch_count; LOG_INFO("Iterations: %d", iterations); _print64("Total Cycles", cycles); _print64("Average Cycles per Iteration", average_cycles); _print64("Wall time (us)", wall_time_us); _print64("Wall time per Iteration (us)", average_wall_time_us); +#if (TEST_DATA_OUTPUT == 1) + uint32_t mismatch_count = output_header_ptr->mismatch_count; LOG_INFO("Mismatch count: %d", mismatch_count); +#endif LOG_INFO("========== End Benchmark =========="); while (true) { wait_for_interrupt();
diff --git a/benchmarks/benchmarks.bzl b/benchmarks/benchmarks.bzl index c941f22..8ad5f0a 100644 --- a/benchmarks/benchmarks.bzl +++ b/benchmarks/benchmarks.bzl
@@ -199,7 +199,10 @@ "@kelvin_sw//benchmarks:benchmark_smc.c", "@kelvin_sw//benchmarks:benchmark.h", ], - copts = ["-DBENCHMARK_NAME={}".format(name)], + copts = [ + "-DBENCHMARK_NAME={}".format(name), + "-DTEST_DATA_OUTPUT={}".format(1 if test_data_output else 0), + ], per_device_deps = { device_type: device_deps("smc").get(device_type), },