kernel_code
stringlengths
49
1.22M
kernel void test_add_sat_int3(global int* srcA, global int* srcB, global int* dst) { int tid = get_global_id(0); int3 tmp = add_sat(vload3(tid, srcA), vload3(tid, srcB)); vstore3(tmp, tid, dst); }
kernel void add_int(global float* restrict u1, global float* restrict u2, global float* restrict u3, global int* restrict a, float sig) { float du1[100 + 1], du2[100 + 1], du3[100 + 1]; int l, ky, kx, nl1, nl2; for (l = 1; l <= 100; l++) { nl1 = 0; nl2 = 1; for (kx = 1; kx < 3; kx++) { for (ky ...
kernel void set_boolean_output_non_greedy_stochastic(global char* last_boolean_output, global const float* last_output, unsigned int index, float rand) { if (get_global_id(0) == 0) { last_boolean_output[index] = (rand < last_output[index]); } }
float pulseWave(float x, float length) { float h = -0.5 * cospi(2 * x) + 0.5; if (h > (1.0 - length)) { return 1.0; } else { return 0.0; } } float bricks(float x, float y) { float cx = 5.0 * x; float cy = 12.5 * (y - 10.0); float c = 0.0; if (((int)cy) % 2 == 0) { c = pulseWave(cx, 0.99); ...
kernel void kernel_sin_withDD1(global float* result_sin, int N) { float t1 = 1.0; int i = 0; for (i = 0; i < N; i++) { t1 = sin(t1); t1 = sin(t1); t1 = sin(t1); t1 = sin(t1); t1 = sin(t1); t1 = sin(t1); t1 = sin(t1); t1 = sin(t1); t1 = sin(t1); t1 = sin(t1); t1 = sin(t1...
kernel void hello_kernel(global const float* a, global const float* b, global float* result) { int gid = get_global_id(0); result[gid] = a[gid] + b[gid]; }
kernel void kernel_energy(global float* m, global float* E) { int i = get_global_id(0); float c = 299792458; E[i] = m[i] * c * c; }
short constant sin_lookup[126] = {32767, 0, 32767, 0, 0, 32767, 32767, 0, 23169, 23169, 0, 32767, -23169, 23169, 32767, 0, 30272, 12539, 23169, 23169, 12539, 30272, 0, 32767, -12539, 30272, -23169, 23169, -30272, 12539, 32767, 0, 32137, 6392, 30272, 12539, 27244, 18204, 23169, 23169, 18204, 27244, 12539, 30272, 6392, 3...
kernel void simple(int N, global float* x) { int id = get_global_id(0); if (id < N) x[id] = id; }
kernel void HelloWorld(global char* data) { data[0] = 'H'; data[1] = 'e'; data[2] = 'l'; data[3] = 'l'; data[4] = 'o'; data[5] = ' '; data[6] = 'W'; data[7] = 'o'; data[8] = 'r'; data[9] = 'l'; data[10] = 'd'; data[11] = '!'; data[12] = '\n'; }
kernel void kernel_mad_withDD1(global float* result_mad, int N) { float t1 = 1.0; float t2 = 0.0; float t3 = 1.0; int i; for (i = 0; i < N; i++) { t1 = mad(t1, t2, t3); t1 = mad(t1, t2, t3); t1 = mad(t1, t2, t3); t1 = mad(t1, t2, t3); t1 = mad(t1, t2, t3); t1 = mad(t1, t2, t3); t1 ...
float sph_j1c(float q); float sph_j1c(float q) { const float q2 = q * q; float sin_q, cos_q; do { const float _t_ = q; sin_q = sin(_t_); cos_q = cos(_t_); } while (0); const float bessel = (q < 0.384038453352533f) ? (1.0f + q2 * (-3.f / 30.f + q2 * (3.f / 840.f))) : 3.0f * (sin_q / q - cos_q) / ...
kernel void VectVectAddKernel(global float* d_VectA, global float* d_VectB, global float* output) { size_t id = get_global_id(0); output[id] = d_VectA[id] + d_VectB[id]; }
kernel void vectorAdd(global const int* A, global const int* B, global int* C, const int numberOfElements) { unsigned int index = get_global_id(0); if (index >= numberOfElements) return; C[index] = A[index] + B[index]; }
kernel void mul_hi_uint4uint4(global uint4* src_0, global uint4* src_1, global uint4* dst) { int gid = get_global_id(0); dst[gid] = mul_hi(src_0[gid], src_1[gid]); }
kernel void memset(global unsigned int* dst, unsigned int dstofs, unsigned int val) { dst[get_global_id(0) + dstofs] = val; }
kernel void rdwdot_kernel(global const float* RKF, global const float* RKR, global float* WDOT, const float rateconv, global const float* molwt) { float ROP5 = ((RKF[(((5) - 1) * (4)) + (get_global_id(0))]) - (RKR[(((5) - 1) * (4)) + (get_global_id(0))])) + ((RKF[(((6) - 1) * (4)) + (get_global_id(0))]) - (RKR[(((6) ...
typedef float float3 __attribute__((ext_vector_type(3))); typedef float float4 __attribute__((ext_vector_type(4))); kernel void float3_to_float4(global float3* a, global float4* b) { *b = __builtin_astype(*a, float4); }
kernel void mandelbrot(global int* A, const int N, const int largeur, const int hauteur, const int start_hauteur, const int end_hauteur) { int idx = get_global_id(0); int y = idx / hauteur; int x = idx - (y * largeur); if (y < (end_hauteur - start_hauteur) && x < largeur) { int cpt = 0; float x1 = 0.f...
kernel void kernel_log10_withoutDD1(global float* result_log10, int N) { float t1; float t2; float t3; float t4; float t5; float t6; float t7; float t8; float t9; float t10; float i = 0.0; float n = 7 * (float)(N); for (i = 0.0; i < n; i = i + 1.0) { t1 = log10(i); t2 = log10(i); ...
kernel void vector_operation(global const int* src, global int* trgt) { int gidx = get_global_id(0); float r = src[gidx]; trgt[gidx] = (int)((sin(r)) / 1319 + (cos(r)) / 1317 + (cos(r + 13)) * (sin(r - 13))); }
kernel void subtract_shortshort(global short* src_0, global short* src_1, global short* dst) { int gid = get_global_id(0); dst[gid] = src_0[gid] - src_1[gid]; }
kernel void Saxpy_noinc(float alpha, global float* x, global float* y) { unsigned int gid = get_global_id(0); float this_x = x[gid]; float this_y = y[gid]; this_y += alpha * this_x; y[gid] = this_y; }
constant const float twoPi = (float)6.283185307179586476; constant const float invTwoPi = (float)(1. / 6.283185307179586476); constant const float invFourPi = (float)0.07957747154594767; constant float2 cmp0 = (float2)(0, 0); constant float2 cmpi1 = (float2)(0, 1); constant const float2 cfactor = (float2)(0, -0.0795774...
float t_logpdf(float theta, float df, float loc, float scale) { float part1 = lgamma((df + 1) / 2.0f) - lgamma(0.5f * df) - log(pow(df * 3.14159265358979323846264338327950288f, 0.5f) * scale); float part2 = -0.5f * (df + 1) * log(1 + (1 / df) * pow((theta - loc) / scale, 2.0f)); return part1 + part2; } float max...
kernel void abs_diff_ushort8ushort8(global ushort8* src_0, global ushort8* src_1, global ushort8* dst) { int gid = get_global_id(0); dst[gid] = abs_diff(src_0[gid], src_1[gid]); }
kernel void min_f32_gpu(unsigned int length, global float* a, local float* scratch, global float* out) { const unsigned int globalSize = get_global_size(0); unsigned int globalIndex = get_global_id(0); float accumulator = (__builtin_inff()); while (globalIndex < length) { accumulator = min(accumulator, a[gl...
kernel void render(global char* input, global char* output, int width, int height) { unsigned int i = get_global_id(0); unsigned int x, y; unsigned int i_mul_4 = i * 4; y = i / width; x = i % width; unsigned int x2, y2; x2 = y; y2 = x; if ((x2 < width) && (y2 < height)) { unsigned int i_mul_...
kernel void kernel_round_withDD1(global float* result_round, int N) { float t1 = 5.6; int i = 0; for (i = 0; i < N; i++) { t1 = round(t1); t1 = round(t1); t1 = round(t1); t1 = round(t1); t1 = round(t1); t1 = round(t1); t1 = round(t1); t1 = round(t1); t1 = round(t1); t1 = r...
inline void AtomicAddG(volatile global float* source, const float operand) { union { unsigned int intVal; float floatVal; } newVal; union { unsigned int intVal; float floatVal; } prevVal; do { prevVal.floatVal = *source; newVal.floatVal = prevVal.floatVal + operand; } while (atomic_c...
kernel void nbody_kernel(float dt1, global float4* pos_old, global float4* pos_new, global float4* oldVel, global float4* newVel, float damping, float softeningSqr) { 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...
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; } kernel void vecinit(global int* out, int n) { const int i = get_global_id(0); if (i < n) out[i] = (i + 1); }
kernel void vload_bench_10000float8(global float* src, global unsigned int* dst, unsigned int offset) { int id = (int)get_global_id(0); uint8 srcV = 0; for (int i = 0; i < 10000; i++) { srcV += convert_uint8(vload8(id + (i & 0xFFFF), src + offset)); } vstore8(srcV, id, dst); }
constant char hw[] = "Hello, World"; kernel void hello(global char* out) { size_t tid = get_global_id(0); out[tid] = hw[tid]; }
kernel void rhadd_ulong2ulong2(global ulong2* src_0, global ulong2* src_1, global ulong2* dst) { int gid = get_global_id(0); dst[gid] = rhadd(src_0[gid], src_1[gid]); }
kernel void vec_mul(global const float* matrix, unsigned int matrix_rows, unsigned int matrix_cols, unsigned int matrix_internal_rows, unsigned int matrix_internal_cols, global const float* vector, global float* result) { for (unsigned int row = get_global_id(0); row < matrix_rows; row += get_global_size(0)) { fl...
kernel void linear_move(global float* positions, global float* velocities, int vertex_count, float multiplier) { int index = get_global_id(0) * 3; float4 this_velocity = (float4)(velocities[index], velocities[index + 1], velocities[index + 2], 0); positions[index] += this_velocity.x * multiplier; positions[in...
kernel void hdrvdp_mtfCL(global double* rho, global double* result, global double* params_A, global double* params_B) { int pos = get_global_id(0); result[pos] = result[pos] + params_A[0] * exp(-params_B[0] * rho[pos]); result[pos] = result[pos] + params_A[1] * exp(-params_B[1] * rho[pos]); result[pos] = resul...
kernel void ratt9_kernel(global const float* T, global const float* RF, global float* RB, global const float* EG, const float TCONV) { const float TEMP = T[get_global_id(0)] * TCONV; const float ALOGT = log(TEMP); const float SMALL_INV = 1e+20f; const float RU = 8.31451e7f; const float PATM = 1.01325e6f; ...
kernel void dfun(global float* state, global float* coupling, global float* param, global float* deriv) { int i = get_global_id(0), n = get_global_size(0); float V = state[0 * n + i], W = param[1 * n + i], Z = param[2 * n + i]; float c_0 = coupling[i]; float gCa = param[0 * n + i]; float gK = param[1 * n + ...
kernel void test_ushort16(global ushort* pin, global ushort* pout) { int x = get_global_id(0); ushort16 value; value = vload16(x, pin); value += (ushort16){(ushort)1, (ushort)2, (ushort)3, (ushort)4, (ushort)5, (ushort)6, (ushort)7, (ushort)8, (ushort)9, (ushort)10, (ushort)11, (ushort)12, (ushort)13, (ushort)1...
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 native_powr((value + 0.055f) / 1.055f, 2.4f); return value / 12.92f; } kernel...
kernel void zeroFloatMemory(global float* buffer) { const int globalX = get_global_id(0); buffer[globalX] = 0.0f; }
kernel void reduceViaScratch(global float* inout, local float* scratch) { int localId = get_local_id(0); int workgroupSize = get_local_size(0); scratch[localId] = inout[localId]; barrier(0x01); for (int offset = (workgroupSize >> 1); offset > 0; offset >>= 1) { if (localId < offset) { scratch[loca...
kernel void compiler_mul_short(global short* src0, global short* src1, global short* dst) { int id = (int)get_global_id(0); dst[id] = src0[id] * src1[id]; }
kernel void op_exp(global double* a, const int offset) { int i = get_global_id(0) + offset; a[i] = exp(a[i]); }
kernel void bench_workgroup_broadcast_1D_int(global int* src, global int* dst, int reduce_loop, unsigned int wg_local_x, unsigned int wg_local_y) { unsigned int offset = 0; unsigned int index = offset + get_global_id(0); int val = src[index]; volatile int result; for (; reduce_loop > 0; reduce_loop--) { ...
kernel void vload_bench_10000uchar3(global uchar* src, global unsigned int* dst, unsigned int offset) { int id = (int)get_global_id(0); uint3 srcV = 0; for (int i = 0; i < 10000; i++) { srcV += convert_uint3(vload3(id + (i & 0xFFFF), src + offset)); } vstore3(srcV, id, dst); }
kernel void log10_float4(global float4* src_0, global float4* dst) { int gid = get_global_id(0); dst[gid] = log10(src_0[gid]); }
constant uint3 ppp[2] = {(uint3)(1, 2, 3), (uint3)(5)}; kernel void foo(global unsigned int* A, unsigned int i) { *A = ppp[i].x; }
kernel void reduce_lmem(global int* restrict out, global const int4* restrict in, local int* restrict lmem, int nquarts) { const int gws = get_global_size(0); int i = get_global_id(0); int acc = 0; while (i < nquarts) { int4 v0 = in[i + 0 * gws]; int4 v1 = i < nquarts - 1 * gws ? in[i + 1 * gws] : (int4...
kernel void test_clamp(global long4* out, global long4* in) { *out = clamp(*in, (long4)7, (long4)42); }
kernel void writeGlobalMemory(global float* output, int size, int stride) { int gid = get_global_id(0); int j = 0; int s = gid * stride; for (j = 0; j < 1024; ++j) { output[(s + 0) & (size - 1)] = gid; output[(s + 15360) & (size - 1)] = gid; output[(s + 30720) & (size - 1)] = gid; output[(s + 46...
kernel void cosh_float8(global float8* src_0, global float8* dst) { int gid = get_global_id(0); dst[gid] = cosh(src_0[gid]); }
kernel void compiler_long_mul_sat(global long* src, global long* dst, long num0, long num1) { int i = get_local_id(0); long c; c = mad_sat(src[i], num0, num1); dst[i] = c; }
kernel void test_arg_4_5_kern(global float4* a0, global float4* a1, global float4* a2, global float4* a3, global float4* b0, global float4* b1, global float4* b2, global float4* b3, global float4* b4) { float4 za = (float4)(0.75f, 0.5f, 0.25f, 0.33f); unsigned int gtid = get_global_id(0); float4 tmp0 = a0[gtid] +...
kernel void render(global char* input, global char* output, int width, int height) { unsigned int i = get_global_id(0); unsigned int i_mul_4 = i * 4; unsigned char temp; temp = input[i_mul_4]; output[i_mul_4] = input[i_mul_4 + 2]; output[i_mul_4] = input[i_mul_4 + 1]; output[i_mul_4 + 2] = temp; out...
kernel void fabs_float16(global float16* src_0, global float16* dst) { int gid = get_global_id(0); dst[gid] = fabs(src_0[gid]); }
kernel void group_size(global int* E) { int lo_id = get_local_id(0); int gl_id = get_global_id(0); int gr_id = get_group_id(0); int s = get_local_size(0); E[gl_id] = s; }
kernel void update(global float4* accel, global float8* tParticle, const float t) { if (get_global_id(0) == 0) { float4 v = (*tParticle).hi; (*tParticle).s0 += v.x * t + 0.5 * accel[0].x * t * t; (*tParticle).s1 += v.y * t + 0.5 * accel[0].y * t * t; (*tParticle).s2 += v.z * t + 0.5 * accel[0].z * t *...
kernel void assign(global float* input, global float* output) { const int idx = get_global_id(0); input[idx] = output[idx]; }
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 compiler_insn_selection_masked_min_max(global float* src, global float* dst) { int id = (int)get_global_id(0); if (get_local_id(0) > 5) dst[id] = max(src[id], src[7]); else dst[id] = min(src[id], src[10]); }
kernel void Scan_WorkEfficientAdd(global unsigned int* higherLevelArray, global unsigned int* array, local unsigned int* block) { int GID = get_global_id(0); int group = get_group_id(0); if (group > 0) array[GID] += higherLevelArray[group - 1]; }
kernel void s_vector_scale_scalar(global float* a, float alpha, int N) { int i = get_global_id(0); if (i < N) a[i] *= alpha; }
float form_volume(float radius, float num_pearls); float Iq(float q, float radius, float edge_sep, float num_pearls, float pearl_sld, float solvent_sld); float Iqxy(float qx, float qy, float radius, float edge_sep, float num_pearls, float pearl_sld, float solvent_sld); float linear_pearls_kernel(float q, float radius, ...
kernel void VectorAdd(global const float* a, global const float* b, global float* c, int iNumElements) { int iGID = get_global_id(0); if (iGID >= iNumElements) { return; } c[iGID] = a[iGID] + b[iGID]; }
kernel void clear_buffer(global uchar4* buffer, unsigned int size) { if (get_global_id(0) >= size) return; buffer[get_global_id(0)] = 0; }
kernel void multiplyem(global float* a, global float* b, global float* c) { int i = get_global_id(0); c[i] = a[i] * b[i]; }
kernel void prescanReduce(global unsigned int const* restrict a, global unsigned int* restrict sum, unsigned int m, unsigned int n) { size_t localID = get_local_id(0); size_t groupID = get_group_id(0); local unsigned int lsum[256]; m >>= 2; global uint4* a4 = (global uint4*)a; size_t startIndex = m * gro...
kernel void test_arg_1_6_kern(global float4* a0, global float4* b0, global float4* b1, global float4* b2, global float4* b3, global float4* b4, global float4* b5) { float4 za = (float4)(0.75f, 0.5f, 0.25f, 0.33f); unsigned int gtid = get_global_id(0); float4 tmp0 = a0[gtid] + 0.1f + za; b0[gtid] = (0.0f + 1.1f)...
kernel void Scan_Naive(const global unsigned int* inArray, global unsigned int* outArray, unsigned int N, unsigned int offset) { int id = get_global_id(0); unsigned int sum; if (id < N) { sum = inArray[id]; } if (id >= offset) { sum += inArray[id - offset]; } outArray[id] = sum; }
kernel void vector_multi(global const float* a, global const float* b, global float* result) { int gid = get_global_id(0); result[gid] = a[gid] * b[gid]; }
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 test_store_double(double foo, global float* bar) { __builtin_store_half(foo, bar); }
kernel void dfun(global float* state, global float* coupling, global float* param, global float* deriv) { int i = get_global_id(0), n = get_global_size(0); float x = state[0 * n + i], theta = param[1 * n + i]; float c = coupling[i]; float taux = param[0 * n + i], tauT = param[1 * n + i], dynamic = param[2 * n...
kernel void pown_bw_kernel(const global float* px, const global float* py, const global float* pgy, const int k, const unsigned size, global float* pgx) { const unsigned i = get_global_id(0); if (i < size) pgx[i] += k * pgy[i] * py[i] / px[i]; }
kernel void mandel_kernel(global char* mandleset, const int width, const int height, const float scale, const float offsetX, const float offsetY, const int iterations) { int tid = get_global_id(0); int i = tid % width; int j = tid / height; float x0 = ((i * scale) - ((scale / 2) * width)) / width + offsetX; ...
kernel void hello_world(global const float* a, global const float* b, global float* c, int n) { int id = get_global_id(0); if (id < n) { c[id] = a[id] + b[id]; } }
inline int isValidImageIndex(int idx, int numElements) { return (idx >= 0 && idx < numElements); } inline int isTransparencyNotColor(int idx) { return (idx % 4) == 3; } inline uchar make8Bit(int val) { if (val < 0) { val = 0; } if (val > 255) { val = 255; } return (uchar)val; } kernel void conv...
kernel void EM_sum_alphabeta(global const float* alpha_beta, global float* ll_d, const int N, local float* sm) { size_t gid = get_global_id(0); size_t lid = get_local_id(0); size_t gls = get_global_size(0); size_t bls = get_local_size(0); float tidsum = 0.f; for (int i = gid; i < N; i += gls) { tidsum ...
kernel void foo(global int* data, global float* x) { float y = data[0]; barrier(0x02); *x = frexp(y, data + 1); }
kernel void unary_plus_ulong4(global ulong4* src_0, global ulong4* dst) { int gid = get_global_id(0); dst[gid] = +src_0[gid]; }
kernel void init(int m, global int* depths, global int* path_counts, global float* deltas) { int id = get_global_id(0); if (id < m) { depths[id] = -1; path_counts[id] = 0; deltas[id] = 0; } }
kernel void root(global float4* a) { int i = get_global_id(0); a[i] = sqrt(a[i]); }
kernel void lzo1x_1_15_decompress(global const unsigned char* in, global unsigned char* out, unsigned short NUM_THREADS, unsigned int startidx, unsigned start_inp, unsigned short cpy_len, unsigned short m_len, unsigned short m_off) { int loops = cpy_len / NUM_THREADS; int rem = cpy_len % NUM_THREADS; int lcid = g...
; ; ; ; ; ; ; ; kernel void compiler_half_math_exp(global float* src, global float* dst) { int i = get_global_id(0); dst[i] = exp(src[i]); }
kernel void divideBy(global float* gridA, global const float* gridB, int const num_elements) { int global_id = get_global_id(0); if (global_id >= num_elements) return; gridA[global_id] /= gridB[global_id]; }
kernel void rotate_short4short4(global short4* src_0, global short4* src_1, global short4* dst) { int gid = get_global_id(0); dst[gid] = rotate(src_0[gid], src_1[gid]); }
kernel void clean_mod13a2_qa(global const float* ndvi, global const float* ndviqa, global float* ndvi_clean, global const int* N) { int i = get_global_id(0); if (i < N) { if (ndviqa[i] > 1) { ndvi_clean[i] = -28768; } else { ndvi_clean[i] = ndvi[i]; } } }
kernel void Iteration3D(global float* xIn, global float* xOut, global float* bIn, global float* AIn, int resX, int resY, int resZ, global float* residuum) { const int idx = get_global_id(0); const int size = get_global_size(0); int3 ijk; int3 res = (int3)(resX, resY, resZ); (ijk).z = idx / ((res).x * (res).y...
kernel void advance_ptcls_axial_damping(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, float eToTheMinusKappaDt, int nPtcls) { private int n = get_global_id(0); if (n < nPtcls) { ...
kernel void map(global float* data) { int id = get_global_id(0); float square = data[id] * data[id]; data[id] = square; }
kernel void LDSBandwidth_linear(local float* sharedMemory, global float* output) { float val1 = (float)(0); float val2 = val1; unsigned int gid = get_global_id(0); unsigned int lid = get_local_id(0); val1 = val1 + sharedMemory[0 + lid]; val2 = val2 + sharedMemory[1 + lid]; val1 = val1 + sharedMemory[2 + l...
kernel void frameDiffDoubleChar(global double* v, global char* v2) { unsigned int i = get_global_id(0); if (abs((int)(v[i] - v2[i])) < 20) { v[i] = 0; } }
kernel void vecsum_loadadd(global const float* input_, global float* output_, local float* scratch_, const int length_) { int local_index = get_local_id(0); int local_size = get_local_size(0); int global_index = get_global_id(0); int global_size = get_global_size(0); int global_index2 = global_index + global_...
kernel void polygon_edge_expand(int group_length, global int* group, int group_temp_length, global int* group_temp, int neighbours_length, global int* neighbours_index, global int* neighbours) { int idx = get_global_id(0); if (idx >= group_length || group[idx]) return; for (int i = neighbours_index[idx]; i < ...
kernel void testKernel(float number, global float* a, global float* b, global float* result) { int index = get_global_id(0); result[index] = a[index] + b[index] + number; }
kernel void set_fields_from_output(global float* output, global float* fields, unsigned int fields_internal_size2, global bool* illegalMove, int current_player) { if (get_global_id(0) == 0) { for (unsigned int i = 0; i < 9; i++) { if (output[i] > 0.5f) { int x = i / 3; int y = i % 3; ...
kernel void simple_sum_kernel(global float* input, global float* output, float scale, int a) { const int c = get_global_id(0); if (a == 0) output[c] = (scale * input[c]); else output[c] += (scale * input[c]); }