aboutsummaryrefslogtreecommitdiff
path: root/handcoded-opencl/sql4.cl.works
blob: 80cba39575a92b2303161ca9b1d8472790ca1111 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
__kernel void x1_search_kernel(int totalRows,
							   int stride,
							   __global float *data,
							   __global float *resultArray,
							   __global int *roffsetResult) {

	int i = get_global_id(0);
	int workingSet = totalRows/16;
	int startRow = i * workingSet;
	int endOffset = (startRow + workingSet)*stride;
	size_t offset = startRow*stride;
	size_t roffset = startRow*stride;

	if (i == 15)
		endOffset = totalRows * stride;
	for(;offset < endOffset; offset+=stride) {
		if ((data[offset+4] > -60.0f) && (data[offset+5] < -5.0f)) {
			resultArray[roffset]=data[offset];
			resultArray[roffset+1]=data[offset+4];
			resultArray[roffset+2]=data[offset+5];
			roffset+= 3;
		}
	}

	roffsetResult[i] = (roffset-(startRow*stride))/3; 
}