diff options
Diffstat (limited to 'handcoded-opencl/sql11.cl')
-rw-r--r-- | handcoded-opencl/sql11.cl | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/handcoded-opencl/sql11.cl b/handcoded-opencl/sql11.cl new file mode 100644 index 0000000..7cd574d --- /dev/null +++ b/handcoded-opencl/sql11.cl @@ -0,0 +1,22 @@ +#define workUnits 128 +#define workUnitsM1 127 + +__kernel void x1_search_kernel(int totalRows, + __global float *data, + __global float *resultArray) { + + int i = get_global_id(0); + size_t offset = i * totalRows/workUnits; + int endOffset = totalRows/workUnits; + float accum = 0.0f; + + if (i == workUnitsM1) + endOffset = (totalRows/workUnits) + (totalRows % workUnits); + do { + accum += data[offset]; + offset++; + endOffset--; + } while(endOffset); + + resultArray[i] = accum; +} |