Skip to content

Commit 439fc00

Browse files
authored
Merge pull request #248 from coredac/testbench
Testbench update axpy kernel
2 parents cd2ae13 + 3d7625f commit 439fc00

File tree

3 files changed

+154
-110
lines changed

3 files changed

+154
-110
lines changed

test/benchmark/axpy/axpy_int.cpp

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,20 @@
1+
namespace {
2+
constexpr int kN = 16;
3+
constexpr int kA = 3;
4+
} // namespace
5+
16
// Keep the function name matching "kernel" so llvm-extract --rfunc=".*kernel.*" can find it.
2-
extern "C" void kernel_axpy_int(int n, int a, const int *x, int *y) {
3-
for (int i = 0; i < n; ++i) {
4-
y[i] = a * x[i] + y[i];
7+
extern "C" void kernel_axpy_int(const int *x, int *y) {
8+
for (int i = 0; i < kN; ++i) {
9+
y[i] = kA * x[i] + y[i];
510
}
611
}
712

813
// Provide a tiny main so clang emits a complete TU; tests extract only the kernel anyway.
914
int main() {
10-
const int N = 16;
11-
static int x[N];
12-
static int y[N];
13-
kernel_axpy_int(N, /*a=*/3, x, y);
15+
static int x[kN];
16+
static int y[kN];
17+
kernel_axpy_int(x, y);
1418
return 0;
1519
}
1620

0 commit comments

Comments
 (0)