Skip to content

Great utility for benchmarks, but ran into verification of unsigned c… #616

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions benchmarks/common/util.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,22 @@ static int verifyFloat(int n, const volatile float* test, const float* verify)
return 0;
}

static int verifyChar(int n, const volatile char* test, const char* verify)
{
int i;
// Unrolled for faster verification
for (i = 0; i < n / 2 * 2; i += 2)
{
char t0 = test[i], t1 = test[i + 1];
char v0 = verify[i], v1 = verify[i + 1];
if (t0 != v0) return i + 1;
if (t1 != v1) return i + 2;
}
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;
Expand Down