kernel_code
stringlengths
49
1.22M
kernel void compiler_abs_int(global int* src, global unsigned int* dst) { int i = get_global_id(0); dst[i] = abs(src[i]); }
kernel void test_csr_opencl(global int* val, unsigned int nx, global int* err, int factor) { const int i = get_global_id(0); if (i >= nx) return; if (val[i] != (i + 1) * factor) *err = 1; else val[i] = -val[i]; }
kernel void nbody2_kern(float dt1, float eps, global float4* pos_old, global float4* pos_new, global float4* vel, local float4* pblock, global float4* int2) { const float4 dt = (float4)(dt1, dt1, dt1, 0.0f); int gti = get_global_id(0); int ti = get_local_id(0); int n = get_global_size(0); int nt = get_local...
kernel void bench_workgroup_scan_inclusive_min_int(global int* src, global int* dst, int reduce_loop) { int val; int result; for (; reduce_loop > 0; reduce_loop--) { val = src[get_global_id(0)]; result = work_group_scan_inclusive_add(val); } dst[get_global_id(0)] = result; }
kernel void add(global const int2* a, global const int2* b, global int2* result) { int gid = get_global_id(0); result[gid] = a[gid] + b[gid]; }
kernel void options_test_kernel(global float* src, global int* dst) { size_t tid = get_global_id(0); dst[tid] = src[tid]; }
kernel void permutate(global float8* a, global float8* b, global uint16* mask, global float16* result) { unsigned int id = get_global_id(0); float8 in1 = a[id]; float8 in2 = b[id]; result[id] = shuffle2(in1, in2, *mask); }
kernel void not_equal_uint8uint8(global uint8* src_0, global uint8* src_1, global int8* dst) { int gid = get_global_id(0); dst[gid] = (int8)(src_0[gid] != src_1[gid]); }
kernel void simple_kernel_3(global unsigned int* dst) { dst[get_global_id(0)] = 0; }
kernel void BloomFilterPlugin_Merge(const unsigned int filmWidth, const unsigned int filmHeight, global float* channel_IMAGEPIPELINE, global float* bloomBuffer, const float bloomWeight) { const size_t gid = get_global_id(0); if (gid >= filmWidth * filmHeight) return; if (!isinf(channel_IMAGEPIPELINE[gid * 3]...
kernel void add_vector(global float* a, global float* b, global float* c, int num_els) { int idx = get_global_id(0); if (idx < num_els) { c[idx] = a[idx] + b[idx]; } }
kernel void rotate_ushort2ushort2(global ushort2* src_0, global ushort2* src_1, global ushort2* dst) { int gid = get_global_id(0); dst[gid] = rotate(src_0[gid], src_1[gid]); }
kernel void test_fa1_4_1_kern(global float* a0, global float* a1, global float* a2, global float* a3, global float* b0) { unsigned int gtid = get_global_id(0); float tmp0 = a0[gtid] + 0.1f; float tmp1 = a1[gtid] + 1.1f; float tmp2 = a2[gtid] + 2.1f; float tmp3 = a3[gtid] + 3.1f; b0[gtid] = (0.0f + 1.1f) * (...
kernel void scale_alpha_dev(int nstates, global float* alpha_d, int offset, float scale) { unsigned int idx = get_group_id(0) * get_local_size(0) + get_local_id(0); if (idx < nstates) { alpha_d[offset + idx] = alpha_d[offset + idx] / scale; } }
kernel void frameDiffCharDouble(global char* v, global double* v2) { unsigned int i = get_global_id(0); if (abs(v[i] - (int)v2[i]) < 20) { v[i] = 0; } }
int comp_long(long x, long y); inline int greater(long x, long y) { return x > y; } int comp_long(long x, long y) { return x < y; } kernel void runtime_compile_link_a(global long* src1, global long* src2, global long* dst) { int i = get_global_id(0); int j = comp_long(src1[i], src2[i]); dst[i] = j ? 3 : 4; ...
kernel void min_long2long2(global long2* src_0, global long2* src_1, global long2* dst) { int gid = get_global_id(0); dst[gid] = min(src_0[gid], src_1[gid]); }
inline int get_index(int nelems, int index) { if (index == -1) { index = get_global_id(0); } else { index += get_global_size(0); } if (index >= nelems) index = -1; return index; } kernel void single_scalar_times(global float* out, float w, global const float* x, int N) { int id = get_index(N,...
kernel void inplace_mult(global float16* vec, global const float* fac, unsigned int size) { float factor = *fac; for (unsigned int i = get_global_id(0); i < size / 16; i += get_global_size(0)) vec[i] *= factor; }
kernel void reduce4(global float* g_idata, global float* g_odata, unsigned int n, local volatile float* sdata) { unsigned int tid = get_local_id(0); unsigned int i = get_group_id(0) * (get_local_size(0) * 2) + get_local_id(0); sdata[tid] = (i < n) ? g_idata[i] : 0; if (i + get_local_size(0) < n) sdata[tid]...
kernel void test_arg_2_2_kern(global int4* a0, global int4* a1, global int4* b0, global int4* b1) { int4 za = (int4)(0, 1, 2, 3); unsigned int gtid = get_global_id(0); int4 tmp0 = a0[gtid] + 0 + za; int4 tmp1 = a1[gtid] + 1 + za; b0[gtid] = (0 + 1) * (+tmp0 + tmp1); b1[gtid] = (1 + 1) * (+tmp0 + tmp1); }
kernel void profile_edges_d(global double* x, global double* f, unsigned int NxNr, unsigned int Nx, unsigned int Nf) { unsigned int i_cell = (unsigned int)get_global_id(0); if (i_cell < NxNr) { unsigned int ir = i_cell / Nx; unsigned int ix = i_cell - ir * Nx; if (ix < Nf) { x[i_cell] *= f[ix]; ...
const sampler_t smp = 0x10; kernel void Mouse(int x, int y, int W, int H, int flag, int p1, int p2, global float2* pD) { if (flag) { pD[0] = (float2)(x, y); } pD[1].x = (float)p1 / (float)(1 << 5); pD[1].y = (float)p2 / (float)(1 << 5); }
unsigned int div_up(unsigned int a, unsigned int b) { return (a + b - 1) / b; } unsigned int round_mul_up(unsigned int a, unsigned int b) { return div_up(a, b) * b; } int scan_pass(int gi, int nels, global int* restrict out, global const int* restrict in, local int* restrict lmem, int corr) { const unsigned int...
kernel void vload_bench_1short8(global short* src, global unsigned int* dst, unsigned int offset) { int id = (int)get_global_id(0); uint8 srcV = 0; for (int i = 0; i < 1; i++) { srcV += convert_uint8(vload8(id + (i & 0xFFFF), src + offset)); } vstore8(srcV, id, dst); }
constant float chn_6RB_filter_coef[47] = {8.193313185354206e-04, 3.535548569572820e-04, -1.453429245341695e-03, 1.042805860697287e-03, 1.264224526451337e-03, -3.219586065044259e-03, 1.423981657254563e-03, 3.859884310477692e-03, -6.552708013395765e-03, 8.590509694961493e-04, 9.363722386299336e-03, -1.120357391780316e-02...
union BufferType { float f; unsigned int u; }; kernel void totalEnergySum(global float* pointEnergy, global float* energyReturn, const int numWorkItems) { float energy = (float)0; for (int wi = 0; wi < numWorkItems; wi++) { energy += pointEnergy[wi]; } *energyReturn = energy; }
kernel void compiler_clz_long(global long* src, global long* dst) { global long* A = &src[get_global_id(0)]; global long* B = &dst[get_global_id(0)]; *B = clz(*A); }
kernel void odd_squares_kernel_gpu(global int* out) { int i = (get_global_id(0) * 2) + 1; out[i] = out[i - 1] + (2 * i) - 1; }
struct stable_info { double k1; double theta0; double alfa; double alfainvalfa1; double mu_0; double sigma; double xi; double xxi_th; double c2_part; double c1; double THETA_TH; double beta; double xi_coef; short is_xxi_negative; unsigned int integrand; double final_pdf_factor; double ...
kernel void Reduction_DecompAtomics(const global unsigned int* inArray, global unsigned int* outArray, unsigned int N, local unsigned int* localSum) { unsigned int id = get_local_id(0); unsigned int group_id = get_group_id(0); unsigned int sum = inArray[group_id * N * 2 + id] + inArray[group_id * N * 2 + N + id]...
kernel void Strmv_naive(int uplo, int trans, int diag, int n, int lda, global float* A, global float* x, int incx) { bool isUp = (uplo == 0); bool isDiag = (diag == 1); bool isNTrans = (trans == 0); if (isUp && isNTrans) { for (int row = 0; row < n; row++) { x[row * incx] = isDiag ? x[row * incx] : A...
kernel void asin_float(global float* src_0, global float* dst) { int gid = get_global_id(0); dst[gid] = asin(src_0[gid]); }
kernel void op_coalesced(global const int* src, global int* trgt, int work_per_workitem, int src_size) { int i = get_global_id(0); while (i < src_size) { int r = src[i]; trgt[i] = (r) / ((r) + 1010) + (r) / 1319 + (r) * ((r)-13); i += get_global_size(0); } }
kernel void relational_greater_than_float4float4(global float4* src_0, global float4* src_1, global int4* dst) { int gid = get_global_id(0); dst[gid] = (int4)(src_0[gid] > src_1[gid]); }
kernel void compute_integer_v4(global int* ptr, int _A) { int4 x = (int4)(_A, (_A + 1), (_A + 2), (_A + 3)); int4 y = (int4)get_local_id(0); x = (y * x) + y; y = (x * y) + x; x = (y * x) + y; y = (x * y) + x; ; x = (y * x) + y; y = (x * y) + x; x = (y * x) + y; y = (x * y) + x; ; x = (y * x) ...
inline long indexFromImagePosition(int2 imgpos, unsigned int width, unsigned int height, unsigned int buckets, unsigned int currentBucket) { return currentBucket + (imgpos.x * buckets) + (imgpos.y * width * buckets); } kernel void reduceImage(global uchar* input, global uchar* output, global uchar* q, unsigned int w...
kernel void xcorr_byte(global char* in1, global char* in2, global char* out) { int offset = get_global_id(0); int len = get_global_size(0); int res = 0, i = 0; do { res += in1[i] * in2[i + offset]; i++; } while (i != len); out[offset] = res; }
kernel void compiler_generic_pointer_char(global char* src, global char* dst) { size_t gid = get_global_id(0); size_t lid = get_local_id(0); private char pdata[16]; local char ldata[16]; char* p1 = &pdata[lid]; char* p2 = &ldata[lid]; char* p = (gid & 1) ? p1 : p2; *p = src[gid]; if (gid & 1) { l...
void helper_inner_prod_parallel_reduction(local float* tmp_buffer) { for (unsigned int stride = get_local_size(0) / 2; stride > 0; stride /= 2) { barrier(0x01); if (get_local_id(0) < stride) tmp_buffer[get_local_id(0)] += tmp_buffer[get_local_id(0) + stride]; } } float impl_inner_prod(global const fl...
kernel void clz_char16(global char16* src_0, global char16* dst) { int gid = get_global_id(0); dst[gid] = clz(src_0[gid]); }
kernel void wait_event_chained(global int* data, local int* scratch) { event_t event; event = async_work_group_copy(scratch, data, 1, 0); for (int i = 1; i < 4; i++) { async_work_group_copy(scratch + i, data + i, 1, event); } wait_group_events(1, &event); int i = get_local_id(0); data[get_local_size(...
kernel void test_arg_6_3_kern(global float4* a0, global float4* a1, global float4* a2, global float4* a3, global float4* a4, global float4* a5, global float4* b0, global float4* b1, global float4* b2) { float4 za = (float4)(0.75f, 0.5f, 0.25f, 0.33f); unsigned int gtid = get_global_id(0); float4 tmp0 = a0[gtid] +...
kernel void vecsmooth_lmem(global int* restrict s, global const int* restrict v, local volatile int* cache, int nels) { const int gi = get_global_id(0); const int li = get_local_id(0); if (gi >= nels) return; int v1 = 0, v2 = v[gi], v3 = 0; int c = 1; cache[li + 1] = v2; if (li == 0 && gi > 0) c...
kernel void addVectors(const int entries, global const float* a, global const float* b, global float* ab) { const int N = get_local_id(0) + (16 * get_group_id(0)); if (N < entries) ab[N] = a[N] + b[N]; }
kernel void add_sat_ulong16ulong16(global ulong16* src_0, global ulong16* src_1, global ulong16* dst) { int gid = get_global_id(0); dst[gid] = add_sat(src_0[gid], src_1[gid]); }
kernel void scan_hs(global int* A, global int* B) { int id = get_global_id(0); int N = get_global_size(0); global int* C; for (int stride = 1; stride < N; stride *= 2) { B[id] = A[id]; if (id >= stride) B[id] += A[id - stride]; barrier(0x02); C = A; A = B; B = C; } }
kernel void Axpy(int n, int img_size, global const float* scale, global const float* x, global const float* y, global float* dst) { int idx = get_global_id(0); int scale_id = idx / img_size; if (idx < n) { dst[idx] = scale[scale_id] * x[idx] + y[idx]; } }
kernel void generate(global int* output) { int i = get_global_id(0); output[i] = i; }
kernel void sub_sat_int16int16(global int16* src_0, global int16* src_1, global int16* dst) { int gid = get_global_id(0); dst[gid] = sub_sat(src_0[gid], src_1[gid]); }
kernel void builtin_remquo(global float* x, global float* y, global float* dst, global int* quo) { int i = get_global_id(0); int q; dst[i] = remquo(x[i], y[i], &q); quo[i] = q; }
kernel void compiler_long_mult(global long* src1, global long* src2, global long* dst) { int i = get_global_id(0); if (i < 3) dst[i] = src1[i] + src2[i]; else dst[i] = src1[i] * src2[i]; }
kernel void half_cos_float(global float* src_0, global float* dst) { int gid = get_global_id(0); dst[gid] = half_cos(src_0[gid]); }
kernel void _opencl_unsigned_inc(global unsigned* val) { val[0]++; }
kernel void advance_ptcls_velocity_kick(global float* xGlob, global float* yGlob, global float* zGlob, global float* vxGlob, global float* vyGlob, global float* vzGlob, const global float* charge, const global float* mass, global float* axGlob, global float* ayGlob, global float* azGlob, float dt, int nPtcls) { privat...
kernel void sample_test(global short16* sourceA, global short16* sourceB, global short16* sourceC, global short16* destValues) { int tid = get_global_id(0); short16 sA = sourceA[tid]; short16 sB = sourceB[tid]; short16 sC = sourceC[tid]; short16 dst = clamp(sA, sB, sC); destValues[tid] = dst; }
constant unsigned long k[] = { 0x428a2f98d728ae22UL, 0x7137449123ef65cdUL, 0xb5c0fbcfec4d3b2fUL, 0xe9b5dba58189dbbcUL, 0x3956c25bf348b538UL, 0x59f111f1b605d019UL, 0x923f82a4af194f9bUL, 0xab1c5ed5da6d8118UL, 0xd807aa98a3030242UL, 0x12835b0145706fbeUL, 0x243185be4ee4b28cUL, 0x550c7dc3d5ffb4e2UL, 0x72be5d74f27b896fUL,...
kernel void rgbNorm(global float* in, global float* out) { unsigned int gX = get_global_id(0); float3 pixel = vload3(gX, in); float sum_ = dot(pixel, 1.f); float factor = select(native_recip(sum_), 0.f, isequal(sum_, 0.f)); pixel *= factor; vstore3(pixel, gX, out); }
kernel void half_divide_floatfloat(global float* src_0, global float* src_1, global float* dst) { int gid = get_global_id(0); dst[gid] = half_divide(src_0[gid], src_1[gid]); }
constant int removed_constant_1 = 1; constant int* constant removed_constant_pointer_1 = &removed_constant_1; constant int removed_constant_array_1[1] = {1}; constant int preserved_constant_f2 = 2, removed_constant_l2 = 2; constant int *constant preserved_constant_pointer_f2 = &removed_constant_l2, *constant removed_c...
kernel void div(global ulong* out, ulong a, ulong b) { out[0] = a / b; }
int modularPow(int base, int exponent, int modulus) { int c = 1; for (int e = 0; e < exponent; ++e) { c = (c * base) % modulus; } return c; } float4 functionP(const int n) { float4 sums = {0.0f, 0.0f, 0.0f, 0.0f}; const int4 COEFS = {1, 4, 5, 6}; const float4 MULTIPLIERS = {+4.0f, -2.0f, -1.0f, -1.0f...
kernel void kernel_modf_withDD1(global float* result_modf, int N) { float t1 = 1.2; float t2; int i = 0; for (i = 0; i < N; i++) { t1 = modf(t1, &t2); t1 = modf(t1, &t2); t1 = modf(t1, &t2); t1 = modf(t1, &t2); t1 = modf(t1, &t2); t1 = modf(t1, &t2); t1 = modf(t1, &t2); t1 = modf...
kernel void serial_insertion_sort_short(local short* data, unsigned int n, global short* _buf0) { for (unsigned int i = 0; i < n; i++) { data[i] = _buf0[i]; } for (unsigned int i = 1; i < n; i++) { const short value = data[i]; unsigned int pos = i; while (pos > 0 && ((value) < (data[pos - 1]))) { ...
kernel void vector_add(global const int* A, global const int* B, global int* C, const int len) { int tid = get_global_id(0); if (tid < len) C[tid] = A[tid] + B[tid]; }
int volume_coords(int3 coords, int3 size) { return coords.x + coords.y * size.x + coords.z * size.x * size.y; } int3 volume_position(int index, int3 size) { return (int3)(index % size.x, (index / (size.x)) % size.y, index / (size.x * size.y)); } float smoothstepmap(float val) { return val * val * (3 - 2 * val);...
kernel void default_function(global float* restrict input_image, global float* restrict weight_conv1, global float* restrict weight_conv2, global float* restrict weight_fc1, global float* restrict weight_fc2, global float* restrict lenet) { float conv2d; for (int nn = 0; nn < 1; ++nn) { for (int yy = 0; yy < -1...
kernel void not_equal_uint4uint4(global uint4* src_0, global uint4* src_1, global int4* dst) { int gid = get_global_id(0); dst[gid] = (int4)(src_0[gid] != src_1[gid]); }
kernel void postdec(global unsigned int* out, unsigned int in) { out[0] = in--; }
kernel void runtime_alloc_host_ptr_buffer(global int* buf) { int id = (int)get_global_id(0); buf[id] = id / 2; }
kernel void compiler_byte_scatter(global char* dst) { int id = (int)get_global_id(0); dst[id] = (char)id; }
float linear_to_gamma_2_2(float value); float gamma_2_2_to_linear(float value); float linear_to_gamma_2_2(float value) { if (value > 0.003130804954f) return 1.055f * native_powr(value, (1.0f / 2.4f)) - 0.055f; return 12.92f * value; } float gamma_2_2_to_linear(float value) { if (value > 0.04045f) return ...
kernel void kernel_expm1_withoutDD1(global float* result_expm1, int N) { float t1 = 1.2; float t2 = 1.2; float t3 = 1.2; float t4 = 1.2; float t5 = 1.2; float t6 = 1.2; float t7 = 1.2; float t8 = 1.2; float t9 = 1.2; float t10 = 1.2; float i = 1.0; float n = 0.07 * (float)(N); for (i = 1.0; i...
kernel void set_vector(global float4* vec, float x, float y, float z, float w) { int i = get_global_id(0); vec[i] = (float4)(x, y, z, w); }
kernel void readGlobalMemory(global float* data, global float* output, int size, int stride) { int gid = get_global_id(0); int j = 0; float sum = 0; int s = gid * stride; for (j = 0; j < 1024; ++j) { float a0 = data[(s + 0) & (size - 1)]; float a1 = data[(s + 15360) & (size - 1)]; float a2 = data[...
kernel void DecodeBBoxesCORNER(const int nthreads, global const float* loc_data, global const float* prior_data, const int variance_encoded_in_target, const int num_priors, const int share_location, const int num_loc_classes, const int background_label_id, const int clip_bbox, global float* bbox_data) { for (int inde...
bool boundingRectComputed(int childId_memStatusBit); bool lockIfNotAlready(global int* childId_memStatusBit, int id); bool isInBoundingRect(int4 boundingRect, int2 imgCoord); int getChildId(int childId_memStatusBit); int numberOfHighBitsWithinBoundary(uchar map, int boundary); void computeSubcorners(uchar reference, in...
kernel void test_char(global char* C, global char* A, global char* B) { int id = get_global_id(0); C[id] = sub_sat(A[id], B[id]); }
kernel void ParallelSelection_byte(global unsigned char* in, global unsigned char* out) { int i = get_global_id(0); int n = get_global_size(0); unsigned ith = in[i]; unsigned pos = 0, j = 0; do { unsigned jth = in[j]; bool smaller = (jth < ith); bool equal_and_smaller = (jth == ith && j < i); ...
inline void AtomicAdd(volatile global float* source, const float operand) { union { unsigned int intVal; float floatVal; } newVal; union { unsigned int intVal; float floatVal; } prevVal; prevVal.floatVal = *source; while (true) { newVal.floatVal = prevVal.floatVal + operand; newVal...
kernel void kernel_fmax_withoutDD1(global float* result_fmax, int N) { float t1 = -1; float t2 = -1; float t3 = t1; float t4 = t3; float t5 = t4; float t6 = t5; float t7 = t6; float t8 = t7; float t9 = t8; float t10 = t9; float t11 = -1; float t12 = -1; float t13 = t1; float t14 = t3; floa...
kernel void test_fa1_6_3_kern(global float* a0, global float* a1, global float* a2, global float* a3, global float* a4, global float* a5, global float* b0, global float* b1, global float* b2) { unsigned int gtid = get_global_id(0); float tmp0 = a0[gtid] + 0.1f; float tmp1 = a1[gtid] + 1.1f; float tmp2 = a2[gtid...
kernel void global_bandwidth_v2_global_offset(global float2* A, global float* B) { int id = get_global_id(0); float2 sum = 0; sum += A[id]; id += get_global_size(0); sum += A[id]; id += get_global_size(0); ; sum += A[id]; id += get_global_size(0); sum += A[id]; id += get_global_size(0); ; ; ...
kernel void write_float(global float* dest, float src) { dest[0] = src; }
kernel void vecsum_vecadd(global const float4* input_, global float* output_, local float* scratch_, const int length_) { int local_index = get_local_id(0); int global_index = get_global_id(0); int local_size = get_local_size(0); int global_size = get_global_size(0); int length4 = length_ / 4; float4 accu...
kernel void reduce(global float* buffer, local float* scratch, local float* scratch_index, const int length, global float* result, global float* result_index) { int global_index = get_global_id(0); float accumulator = -(__builtin_inff()); int index = -1; while (global_index < length) { float element = fabs...
kernel void not_equal_int4int4(global int4* src_0, global int4* src_1, global int4* dst) { int gid = get_global_id(0); dst[gid] = src_0[gid] != src_1[gid]; }
kernel void matvec_mult00(global float4* matrix, global float4* vector, global float* result) { int i = get_global_id(0); result[i] = dot(matrix[i], vector[0]); }
kernel void test_arg_2_2_kern(global int* a0, global int* a1, global int* b0, global int* b1) { unsigned int gtid = get_global_id(0); int tmp0 = a0[gtid] + 0; int tmp1 = a1[gtid] + 1; b0[gtid] = (0 + 1) * (+tmp0 + tmp1); b1[gtid] = (1 + 1) * (+tmp0 + tmp1); }
kernel void wait_event_divergent(global int* data, local int* scratch) { int i = get_local_id(0); scratch[i] = 0; barrier(0x01); event_t events[2]; events[0] = async_work_group_copy(scratch, data, 1, 0); events[1] = async_work_group_copy(scratch + 1, data + 1, 1, 0); wait_group_events(1, events + i); ...
constant size_t ELEMENTS_PER_WORK_ITEM_SCAN = 2; constant size_t ELEMENTS_PER_WORK_ITEM_OTHERS = 2; kernel void addGroupPrefix(global unsigned int* prefixSums, global unsigned int* sums, global unsigned int* elements, const unsigned int count, const unsigned int bitMask, const unsigned int doWriteTotalFalses, global un...
kernel void simpleAdd_2(global float* a, global float* b, global float* c) { *c = *a + *b; }
uint4 GetAddressMapping(int index) { const unsigned int local_id = get_local_id(0); const unsigned int group_id = get_global_id(0) / get_local_size(0); const unsigned int group_size = get_local_size(0); uint2 global_index; global_index.x = index + local_id; global_index.y = global_index.x + group_size; ...
kernel void bitselect_int2int2int2(global int2* src_0, global int2* src_1, global int2* src_2, global int2* dst) { int gid = get_global_id(0); dst[gid] = bitselect(src_0[gid], src_1[gid], src_2[gid]); }
kernel void SAXPY(global const float* restrict x, global float* restrict y, const int a, const int size) { for (int i = 0; i < size; i++) y[i] = a * x[i] + y[i]; }
kernel void mod(global ushort* out, ushort a, ushort b) { out[0] = a % b; }
kernel void postinc(global int* out, int in) { out[0] = in++; }
int whoHasWon(global const float* ballPosX, global const int* ballRad, global const int* width, global const float* ballVelX) { if (*ballPosX + *ballRad >= *width && *ballVelX > 0) return -1; else if (*ballPosX <= 0 && *ballVelX < 0) return 1; else return 0; } void reset(global float* ballPosX, globa...
kernel void person_corr_red(global float* matrix, const int wMatrix, const int numtraces, const float inv_traces, const int is_pm_matrix, const int offset_matrix, const int offset_sum, const int offset_sum_pow_2) { global float* pmm_matrix = matrix + offset_matrix; global float* somatorio = matrix + offset_sum; g...
kernel void prod_c_column(global float* A, float c, unsigned int col, unsigned int n) { unsigned int i = get_global_id(0); if (i >= n) return; A[i + col * n] *= c; }