diff options
author | Jerry Zhao <jerryz123@berkeley.edu> | 2023-02-14 15:29:15 -0800 |
---|---|---|
committer | Jerry Zhao <jerryz123@berkeley.edu> | 2023-05-22 14:58:36 -0700 |
commit | 9c8677c39e7959d3acd425f0c8032edda51375f0 (patch) | |
tree | d1c1d78d21311d3f78a8ebfbcedc4c51268c65e4 /benchmarks/common/util.h | |
parent | e7c3232eb35e63b7b6ad1439a93a7e1f47db8d60 (diff) | |
download | riscv-tests-9c8677c39e7959d3acd425f0c8032edda51375f0.zip riscv-tests-9c8677c39e7959d3acd425f0c8032edda51375f0.tar.gz riscv-tests-9c8677c39e7959d3acd425f0c8032edda51375f0.tar.bz2 |
Add vec-sgemm
Diffstat (limited to 'benchmarks/common/util.h')
-rw-r--r-- | benchmarks/common/util.h | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/benchmarks/common/util.h b/benchmarks/common/util.h index 081cfd6..6258709 100644 --- a/benchmarks/common/util.h +++ b/benchmarks/common/util.h @@ -41,6 +41,22 @@ static int verifyDouble(int n, const volatile double* test, const double* verify return 0; } +static int verifyFloat(int n, const volatile float* test, const float* verify) +{ + int i; + // Unrolled for faster verification + for (i = 0; i < n/2*2; i+=2) + { + float t0 = test[i], t1 = test[i+1]; + float v0 = verify[i], v1 = verify[i+1]; + int eq1 = t0 == v0, eq2 = t1 == v1; + if (!(eq1 & eq2)) return i+1+eq1; + } + if (n % 2 != 0 && test[n-1] != verify[n-1]) + return n; + return 0; +} + static void __attribute__((noinline)) barrier(int ncores) { static volatile int sense; |