Add ISA check to QU8 GEMM benchmark
- resolves crash on devices that dont have dot product.
PiperOrigin-RevId: 405968179
diff --git a/bench/qu8-gemm.cc b/bench/qu8-gemm.cc
index c4c75a5..df27ff0 100644
--- a/bench/qu8-gemm.cc
+++ b/bench/qu8-gemm.cc
@@ -16,6 +16,8 @@
#include <random>
#include <vector>
+#include <cpuinfo.h>
+
#include <benchmark/benchmark.h>
#ifdef BENCHMARK_GEMMLOWP
#include "gemmlowp/public/gemmlowp.h"
@@ -39,6 +41,14 @@
size_t mr, size_t nr, size_t kr, size_t sr,
benchmark::utils::IsaCheckFunction isa_check = nullptr)
{
+ if (!cpuinfo_initialize()) {
+ state.SkipWithError("cpuinfo initialization failed");
+ return;
+ }
+ if (isa_check && !isa_check(state)) {
+ return;
+ }
+
const size_t mc = state.range(0);
const size_t nc = state.range(1);
const size_t kc = state.range(2);