Files
vortex/tests/opencl/vecadd-loop/kernel.alll1hit.loop1000.cl
Hansung Kim 2f4fd11c93 Add vecadd-loop
This is the same kernel as vecadd but repeated in a for-loop many times so that
the runtime overhead at the startup is amortized.
2023-10-31 23:35:11 -07:00

13 lines
298 B
Common Lisp

__kernel void vecadd (__global const float *A,
__global const float *B,
__global float *C)
{
int gid = get_global_id(0);
float sum = 0.;
for (int i = 0; i < 1000; i++) {
int addr = gid + (i % 2);
sum += A[addr] + B[addr];
}
C[gid] = sum;
}