kernel_code
stringlengths
49
1.22M
kernel void test_pointer_cast(global unsigned char* src, global unsigned int* dst) { int tid = get_global_id(0); global unsigned int* p = (global unsigned int*)src; dst[tid] = p[tid]; }
constant int array[32] = {0, 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, 27, 28, 29, 30, 31}; kernel void with_branch16(global int* out) { int lid = get_local_id(0); int gid = get_global_id(0); int id = lid % 32; int t1 = id; int t2 = 1; if (id == 0 || id...
kernel void reduceSubHists(global unsigned int* hist, unsigned int histSize, global unsigned int* subHists, unsigned int nSubHists) { unsigned int gid = get_global_id(0); for (unsigned int i = gid; i < histSize; i += get_global_size(0)) { unsigned int bin = 0; for (unsigned int j = 0; j < nSubHists; ++j) {...
inline float sigmoid(float z) { return 1.0f / (1.0f + exp(-z)); } inline float sigmoid_gradient(float y) { return y * (1.0f - y); } inline float relu(float z) { return z > 0 ? z : 0; } inline float relu_gradient(float y) { return y > 0 ? 1 : 0; } inline float tanh_gradient(float y) { return 1.0f - y * y; } ...
kernel void run(global float* randNumArray, global int* sum) { int gid = get_global_id(0); int baseIndex = gid * 2; float x = (randNumArray[baseIndex] * 2.0f) - 1.0f; float y = (randNumArray[(baseIndex + 1)] * 2.0f) - 1.0f; sum[gid] = (((x * x) + (y * y)) < 1.0f) ? 1 : 0; return; }
inline uint4 cl_random_state(uint4 state) { state.s1 = (((state.s1 & 4294967294) << 12)) ^ ((((state.s1 << 13)) ^ state.s1) >> 19); state.s2 = (((state.s2 & 4294967288) << 4)) ^ ((((state.s2 << 2)) ^ state.s2) >> 25); state.s3 = (((state.s3 & 4294967280) << 17)) ^ ((((state.s3 << 3)) ^ state.s3) >> 11); state....
kernel void testMemAndCL(global unsigned int* memoryC, global const unsigned int* memoryA, global const unsigned int* memoryB) { size_t id = get_global_id(0); memoryC[id] = memoryA[id] & memoryB[id]; }
kernel void test_select_read_write_address_simple(global int* mem0, global int* mem1) { unsigned int gid = (unsigned int)get_global_id(0); global int* in = (gid & 1) ? mem0 : mem1; global int* out = !(gid & 1) ? mem0 : mem1; int tmp = in[gid]; out[gid] = tmp + 17; }
kernel void update_cells(const unsigned int N, global int* cells, global int* links, global float* px, global float* py, global float* pz, const float xmin, const float ymin, const float zmin, const float xmax, const float ymax, const float zmax, const unsigned int nx, const unsigned int ny, const unsigned int nz) { ...
constant unsigned int K[] = { 0x428a2f98, 0x71374491, 0xb5c0fbcf, 0xe9b5dba5, 0x3956c25b, 0x59f111f1, 0x923f82a4, 0xab1c5ed5, 0xd807aa98, 0x12835b01, 0x243185be, 0x550c7dc3, 0x72be5d74, 0x80deb1fe, 0x9bdc06a7, 0xc19bf174, 0xe49b69c1, 0xefbe4786, 0x0fc19dc6, 0x240ca1cc, 0x2de92c6f, 0x4a7484aa, 0x5cb0a9dc, 0x76f988da...
kernel void test_arg_8_1_kern(global int4* a0, global int4* a1, global int4* a2, global int4* a3, global int4* a4, global int4* a5, global int4* a6, global int4* a7, global int4* b0) { 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 + z...
kernel void clkernel_le(const int num, global const float* in, const float x, global float* out) { const int i = get_global_id(0); if (i >= num) return; out[i] = (in[i] <= x) ? 1.0f : 0.0f; }
constant float beta = 0.66666f; kernel void calc_conjugate_gradient_direction(global const float* layer_gradient, global const float* beta, global float* direction, global float* prev_gradient) { int gid = get_global_id(0); prev_gradient[gid] = layer_gradient[gid]; direction[gid] = layer_gradient[gid] + beta[0] ...
kernel void divide_uintuint(global unsigned int* src_0, global unsigned int* src_1, global float* dst) { int gid = get_global_id(0); dst[gid] = (float)(src_0[gid] / src_1[gid]); }
kernel void DeletionBox(global float4* positions, global int* deletionBuffer, float4 minBox, float4 maxBox) { const int idx = get_global_id(0); float3 position = positions[idx].xyz; if (any(isless(position, minBox.xyz)) || any(isgreater(position, maxBox.xyz))) deletionBuffer[idx] = 1; }
kernel void equal_ushortushort(global ushort* src_0, global ushort* src_1, global int* dst) { int gid = get_global_id(0); dst[gid] = (int)(src_0[gid] == src_1[gid]); }
kernel void array_sub_i16(global const short* a, global const short* b, global short* c) { unsigned int i = get_global_id(0); c[i] = a[i] - b[i]; }
kernel void compObjWave_MultiPass_aligned(global float4* pc, unsigned int pc_size, global float2* of, int offset, int num_cols, float hologram_z, float k, float pitch, float corner_x, float corner_y) { size_t gid = get_global_id(0); int row = (gid + offset) / num_cols; int col = (gid + offset) - (row * num_cols);...
kernel void abs_diff_long2long2(global long2* src_0, global long2* src_1, global ulong2* dst) { int gid = get_global_id(0); dst[gid] = (ulong2)(abs_diff(src_0[gid], src_1[gid])); }
kernel void compiler_half_to_char_sat(global float* src, global char* dst) { int i = get_global_id(0); dst[i] = convert_char_sat(src[i]); }
kernel void kernel_movinv32_write(global char* ptr, unsigned long memsize, unsigned int pattern, unsigned int lb, unsigned int sval, unsigned int offset) { int i; global unsigned int* buf = (global unsigned int*)ptr; int idx = get_global_id(0); unsigned long n = memsize / sizeof(unsigned int); int total_num_t...
kernel void vector_argument(int4 vector, global int4* output) { *output = vector + 42; }
kernel void ratt3_kernel(global const float* T, global const float* RF, global float* RB, global const float* EG, const float TCONV) { float TEMP = T[get_global_id(0)] * TCONV; float ALOGT = log(TEMP); const float SMALL_INV = 1e+20f; const float RU = 8.31451e7f; const float PATM = 1.01325e6f; const float ...
kernel void helloPixel(float videoWidth, float videoHeight, float curFrame, global uchar4* out) { unsigned int gid = get_global_id(0); float row = gid / videoWidth; float col = fmod(gid, videoWidth); out[gid].x = 255; out[gid].y = 255 * (sinpi(((col + fmod(curFrame * 8, videoWidth)) / videoWidth) * 2.0) / 2....
kernel void Reduction_SequentialAddressing(global unsigned int* array, unsigned int stride) { int GID = get_global_id(0); array[GID] += array[GID + stride]; }
; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; kernel void builtin_convert_ushort_to_short_sat(global ushort* src, global short* dst) { int i = get_global_id(0); dst[i] = convert_short_sat(src[i]); }
kernel void postdec(global long* out, long in) { out[0] = in--; }
kernel void norm_l2_false_d(global double* x, global double* tmp, const unsigned int size) { unsigned int tid = get_global_id(0); unsigned int blocksize = get_local_size(0); const unsigned int iter = size / (get_global_size(0)); unsigned int pos = tid; double temp = 0; for (unsigned long i = 0; i < iter;...
kernel void addToVector(global float* vector, float value) { vector[get_global_id(0)] += value; }
kernel void FindMinDist(global int* dist, global int* mval, global int* mid, global ulong* result, const int GRAPH_SIZE) { int global_id = get_global_id(0); const int cur_size = get_global_size(0); if (cur_size == GRAPH_SIZE >> 1) { int left = dist[global_id]; int right = global_id + cur_size < GRAPH_SIZ...
kernel void init_vbo_kernel(global float4* vbo, int w, int h, int seq) { int gid = get_global_id(0); float4 linepts; float f = 1.0f; float a = 0.4f; float b = 0.0f; linepts.x = gid / (w / 2.0f) - 1.0f; linepts.y = b + a * sin(3.14 * 2.0 * ((float)gid / (float)w * f + (float)seq / (float)w)); linepts.z ...
float sceneDistFunction(float3 pos) { float dist = 1e+8; return dist; } float castRay(float3 rd, float3 ro, float tmax) { float t = 0.0f; for (int i = 0; i < 256; i++) { float dist = sceneDistFunction(ro + rd * t); if (dist < (0.0001 * t)) break; if (t > tmax) return 1e+8; t += dis...
kernel void test_fa1_7_2_kern(global float* a0, global float* a1, global float* a2, global float* a3, global float* a4, global float* a5, global float* a6, global float* b0, global float* b1) { 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 sum(global int* array, const int length) { int i = get_global_id(0); unsigned int dist = 1; unsigned int l = length / 2; while (l > 0) { if (i % (dist * 2) == 0) { array[i] = array[i] + array[i + dist]; } dist = dist * 2; l = l / 2; barrier(0x01); } }
kernel void mykernel(global char* cmem0, unsigned int offset) { global int* data0 = (global int*)(cmem0 + offset); int tid = get_global_id(0); data0[tid] = tid + 123; }
kernel void testULessThanEqual(uint2 a, uint2 b, global int2* res) { res[0] = a <= b; }
kernel void relational_less_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 test_arg_7_1_kern(global float4* a0, global float4* a1, global float4* a2, global float4* a3, global float4* a4, global float4* a5, global float4* a6, global float4* b0) { 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; float...
kernel void batch_concat_fw_kernel(const global float* px, const unsigned y_size, global float* py, const unsigned shift) { const unsigned i = get_global_id(0); if (i < y_size) py[i + shift] = px[i]; }
kernel void sort(global int* numbers, global int* sortedNumbers) { int actPos = get_global_id(0); int size = get_global_size(0); int newPos = actPos; for (int i = 0; i < size; i++) { if (i < actPos && numbers[i] > numbers[actPos]) { newPos--; } else if (i > actPos && numbers[i] < numbers[actPos]...
kernel void sqrt_sum(global float* vec1, global float* result, unsigned int size) { for (unsigned int stride = get_global_size(0) / 2; stride > 0; stride /= 2) { if (get_global_id(0) < stride) vec1[get_global_id(0)] += vec1[get_global_id(0) + stride]; barrier(0x02); } if (get_global_id(0) == 0) ...
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)); } kernel void write_point(global float* volume, int x, int y, int z, i...
kernel void downsample_full(global short* buffer, global unsigned char* image, unsigned int nsbw, unsigned int nbw, unsigned int nbh, unsigned int width, unsigned int height) { size_t gx = get_global_id(0); size_t super_block_id = gx >> 0x8; size_t super_block_x = super_block_id % nsbw; size_t super_block_y =...
kernel void builtin_bitselect(global float* src1, global float* src2, global float* src3, global float* dst) { int i = get_global_id(0); dst[i] = bitselect(src1[i], src2[i], src3[i]); }
kernel void native_cos_float(global float* src_0, global float* dst) { int gid = get_global_id(0); dst[gid] = native_cos(src_0[gid]); }
kernel void scan(global int* input, global int* output) { unsigned int gid = get_global_id(0); int i; if (gid == 0) { output[0] = input[0]; for (i = 1; i < 256; i++) { output[i] = output[i - 1] + input[i]; } } }
kernel void row_col(global float* restrict buff_A, global float* restrict buff_B, global float* restrict temp, int rows, int cols) { int row, col; for (row = 0; row < rows; row++) { for (col = 0; col < cols; col++) { if (col < cols) { buff_A[2 * cols + col] = buff_A[1 * cols + col]; buff_...
kernel void compiler_workgroup_reduce_add_ulong(global ulong* src, global ulong* dst) { ulong val = src[get_global_id(0)]; ulong sum = work_group_reduce_add(val); dst[get_global_id(0)] = sum; }
float metric(int x1, int y1, int x2, int y2) { float x = x1 - x2; float y = y1 - y2; return x * x + y * y; } kernel void JFA(global const unsigned int* M_g, global const unsigned int* P1_g, global const unsigned int* P2_g, global unsigned int* M_o, global unsigned int* P1_o, global unsigned int* P2_o, int X_size...
inline float atomic_add(volatile global float* address, const float value) { float old = value; while ((old = atomic_xchg(address, atomic_xchg(address, 0.0f) + old)) != 0.0f) ; return old; } kernel void dropout_forward(global float* outp, global float* inp, global float* dom, int inputWidth, float perc, int ...
kernel void test_arg_6_1_kern(global int* a0, global int* a1, global int* a2, global int* a3, global int* a4, global int* a5, global int* b0) { unsigned int gtid = get_global_id(0); int tmp0 = a0[gtid] + 0; int tmp1 = a1[gtid] + 1; int tmp2 = a2[gtid] + 2; int tmp3 = a3[gtid] + 3; int tmp4 = a4[gtid] + 4; ...
kernel void iota_2(global int* _buf0, const unsigned int count) { unsigned int index = get_local_id(0) + (32 * get_group_id(0)); for (unsigned int i = 0; i < 4; i++) { if (index < count) { _buf0[index] = (4 + index); index += 8; } } }
kernel void axpbyz_c2c(double2 a, global double2* x, double2 b, global double2* y, global double2* z, unsigned int arr_size) { unsigned int i_cell = (unsigned int)get_global_id(0); if (i_cell < arr_size) { z[i_cell].s0 = a.s0 * x[i_cell].s0 - a.s1 * x[i_cell].s1 + b.s0 * y[i_cell].s0 - b.s1 * y[i_cell].s1; ...
kernel void half_tan_float2(global float2* src_0, global float2* dst) { int gid = get_global_id(0); dst[gid] = half_tan(src_0[gid]); }
kernel void global_prefixSum(global unsigned int* buffer, const int offset, const int size) { int localSize = get_local_size(0); int groupIdx = get_group_id(0); int sortedLocalBlocks = offset / localSize; int gidToUnsortedBlocks = groupIdx + (groupIdx / ((offset << 1) - sortedLocalBlocks) + 1) * sortedLocalBl...
kernel void compiler_mad_hi(global int* src1, global int* src2, global int* src3, global int* dst) { int i = get_global_id(0); dst[i] = mad_hi(src1[i], src2[i], src3[i]); }
kernel void intergroup_race(global int* data) { int g = get_group_id(0); if (get_local_id(0) == 0) { data[g] = g; } barrier(0x02); if (get_global_id(0) == 0) { int x = 0; for (int i = 0; i < get_num_groups(0); i++) { x += data[i]; } data[0] = x; } barrier(0x02); }
kernel void ratt_kernel(global const float* T, global float* RF, float TCONV) { const float TEMP = T[get_global_id(0)] * TCONV; const float ALOGT = log(TEMP); const float TI = 1.0e0 / (TEMP); const float TI2 = TI * TI; float TMP; (RF[(((1) - 1) * (4)) + (get_global_id(0))]) = exp(3.20498617e1f - 7.2528618...
kernel void dft(global const float2* in, global float2* out, int length, int sign) { int i = get_global_id(0); if (i >= length) return; float2 tot = 0; float param = (-2 * sign * i) * 3.141593f / (float)length; for (int k = 0; k < length; k++) { float2 value = in[k]; float c; float s = sin...
kernel void add_uint8uint8(global uint8* src_0, global uint8* src_1, global uint8* dst) { int gid = get_global_id(0); dst[gid] = src_0[gid] + src_1[gid]; }
kernel void reduce_add_1(global const int* A, global int* B) { int id = get_global_id(0); int N = get_global_size(0); B[id] = A[id]; barrier(0x02); if (((id % 2) == 0) && ((id + 1) < N)) B[id] += B[id + 1]; barrier(0x02); if (((id % 4) == 0) && ((id + 2) < N)) B[id] += B[id + 2]; barrier(0...
kernel void fma_float8float8float8(global float8* src_0, global float8* src_1, global float8* src_2, global float8* dst) { int gid = get_global_id(0); dst[gid] = fma(src_0[gid], src_1[gid], src_2[gid]); }
kernel void divide_intint(global int* src_0, global int* src_1, global float* dst) { int gid = get_global_id(0); dst[gid] = (float)(src_0[gid] / src_1[gid]); }
kernel void kernel_hypot_withoutDD1(global float* result_hypot, 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 j = 0.0; float n = 0.3 * (float)(N); ...
kernel void reallySmallRSACrack(global int* num, global int* reasult, global int* communicateBuffer) { int targetNum = *num; int squareRoot = sqrt(convert_float(targetNum)); int size = get_global_size(0); int id = get_global_id(0); int calcNum = squareRoot - id; for (int i = id; i < squareRoot && calcNum >...
kernel void kCosh(global const float* inputMatrix, global float* resultMatrix) { int id = get_global_id(0); resultMatrix[id] = cosh(inputMatrix[id]); }
kernel void softmax_sub_exp_sum_kernel(int total_size, global const float* in_data, global float* out_data, global const float* max_data, global float* sum_data, int inner_num, int outer_num, int axis_size) { int idx = get_global_id(0); if (idx < total_size) { int idx_inner = idx % inner_num; int idx_outer...
kernel void VectorAddGM(global const int* a, global const int* b, global int* c, int iNumElements) { int iGID = get_global_id(0); if (iGID >= iNumElements) { return; } c[iGID] = a[iGID] + b[iGID]; }
kernel void mandelbrot_vector(global uchar4* mandelbrotImage, const float posx, const float posy, const float stepSizeX, const float stepSizeY, const unsigned int maxIterations, const int width, const int bench) { int tid = get_global_id(0); int i = tid % (width / 4); int j = tid / (width / 4); int4 veci = {4...
kernel void nbody_kern(int n, float dt, float eps, global float4* pp, global float4* vv, global float4* ppo, local float4* pblock) { const float4 zero4 = (float4){0.0f, 0.0f, 0.0f, 0.0f}; const float4 invtwo4 = (float4){0.5f, 0.5f, 0.5f, 0.5f}; const float4 dt4 = (float4){dt, dt, dt, 0.0f}; int gti = get_globa...
kernel void kernel_sinh_withDD1(global float* result_sinh, int N) { float t1 = 0.0; int i = 0; for (i = 0; i < N; i++) { t1 = sinh(t1); t1 = sinh(t1); t1 = sinh(t1); t1 = sinh(t1); t1 = sinh(t1); t1 = sinh(t1); t1 = sinh(t1); t1 = sinh(t1); t1 = sinh(t1); t1 = sinh(t1); ...
float4 mod289f4(float4 x) { float4 t = x; return t - floor(t * (1.0f / 289.0f)) * 289.0f; } float mod289(float x) { return x - floor(x * (1.0f / 289.0f)) * 289.0f; } float4 permutef4(float4 x) { return mod289f4(((x * 34.0f) + 1.0f) * x); } float permute(float x) { return mod289(((x * 34.0f) + 1.0f) * x); }...
kernel void preinc(global ulong* out, ulong in) { out[0] = ++in; }
kernel void harris_count(global float* in, volatile global unsigned int* strong, volatile global int* count, float harris_threshold) { int i = get_global_id(0); float value = in[i]; if (value > 0.0f) { atomic_inc(count); if (value > harris_threshold) { strong[i] += 1; } } }
kernel void vecsum_nondiverge(global const float* input_, global float* output_, local float* scratch_, const int length_) { int local_size = get_local_size(0); int local_index = get_local_id(0); int global_index = get_global_id(0); if (global_index < length_) { scratch_[local_index] = input_[global_index]...
kernel void sineWaveKernel(global float4* posOrnColors, global float* pBodyTimes, float timeStepPos, float mAmplitude, const int numNodes) { int nodeID = get_global_id(0); if (nodeID < numNodes) { pBodyTimes[nodeID] += timeStepPos; float4 position = posOrnColors[nodeID]; position.x = native_cos(pBodyTim...
inline float4 back_color(float4 position, float4 ray_dir) { position += ray_dir * 1.0f; if (((int)(position[1] * 40.f + position[0] * 20.f) % 2)) return (float4)(0.2f); else return (float4)(0.0f); } void get_closest_object(float4 ray_start, float4 dir, float* dist, int* closest, global float4* objects, i...
constant float GAMMA = 42.57748f; constant float TWOPI = 6.283185307179586476925286766559005768394338798750211641949889185f; kernel void zerorf(global float* rf) { rf[get_global_id(0)] = 0.; }
kernel void test_rotate(global uchar* out, uchar a, uchar b) { *out = rotate(a, b); }
kernel void equal_charchar(global char* src_0, global char* src_1, global int* dst) { int gid = get_global_id(0); dst[gid] = (int)(src_0[gid] == src_1[gid]); }
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 square(global int* in) { size_t i = get_global_id(0); in[i] *= in[i]; }
kernel void build_ray_dirs(global unsigned char* volume, int volume_w, int volume_h, int volume_n, global float4* ray_dirs, int bitmap_w, int bitmap_h, float4 camera_pos, float4 camera_lookat, global float* printings) { int n = get_global_id(0); if (n >= bitmap_w * bitmap_h) return; int ray_x = n % bitmap_w;...
kernel void test(global float8 x[10]) { (void)x; }
__attribute__((max_work_group_size(1000))) kernel void softmax(global float* pdata) { local float sum, prob[1000]; const int x = get_global_id(0); prob[x] = exp(pdata[x]); barrier(0x01); if (x == 0) { sum = 0; for (int i = 0; i < get_global_size(0); i++) { sum += prob[i]; } } barrier(0x...
kernel void multiply_kernel(global float2* projFFT, int4 fftDimension, global float2* kernelFFT) { const unsigned int idx = get_global_id(0); const unsigned int w = idx % (fftDimension.x * fftDimension.y); int j = w / fftDimension.x; int i = w % fftDimension.x; long int proj_idx = i + j * fftDimension.x; ...
kernel void test_double3(global double* pin, global double* pout) { int x = get_global_id(0); double3 value; value = vload3(x, pin); value += (double3){(double)1, (double)2, (double)3}; vstore3(value, x, pout); }
kernel void brahmaKernel(global int* buf) { buf[0] = 2; buf[1] = 3; }
unsigned int stepLCG(unsigned int* z, unsigned int A, unsigned int C) { return (*z) = (A * (*z) + C); } unsigned int stepLFG(unsigned int* z, global unsigned int* znmk, unsigned int A, unsigned int C) { return (*znmk) = (*z) = (A * (*z) + C) + (*znmk); } unsigned int stepCTG(unsigned int* z, unsigned int S1, unsi...
kernel void nbody_sim(global float4* pos, global float4* vel, int numBodies, float deltaTime, float epsSqr, local float4* localPos, global float4* newPosition, global float4* newVelocity) { unsigned int tid = get_local_id(0); unsigned int gid = get_global_id(0); unsigned int localSize = get_local_size(0); unsi...
kernel void remainder_uint16uint16(global uint16* src_0, global uint16* src_1, global uint16* dst) { int gid = get_global_id(0); dst[gid] = src_0[gid] % src_1[gid]; }
kernel void globalAtomicKernelCounters32Broken(global int* counter) { (*counter)++; }
kernel void processData(global const float* input, unsigned int dataSize, global float* output, unsigned int outputSize) { int id = get_global_id(0); int actualItemsCount = outputSize / sizeof(float); int itemsPerThread = actualItemsCount / get_global_size(0); float delta = input[1] - input[0]; for (int i ...
kernel void complex_add(global double2* a, global double2* b) { unsigned int n = get_global_id(0); a[n].x += b[n].x; a[n].y += b[n].y; }
kernel void scaled_sum_three_f(global float* output, global float* x, global float* y, const unsigned int size) { unsigned int tid = get_global_id(0); if (tid < size) output[tid] = output[tid] + x[tid] * y[tid]; }
kernel void Scan_Naive(const global unsigned int* inArray, global unsigned int* outArray, unsigned int N, unsigned int offset) { int GID = get_global_id(0); if (GID >= offset) outArray[GID] = inArray[GID] + inArray[GID - offset]; else outArray[GID] = inArray[GID]; }
kernel void steep_desc(int dim, int num_vals, local float* r, local float* x, local float* A_times_r, global int* rows, global int* cols, global float* A, global float* b, global float* result) { local float alpha, r_length, iteration; int id = get_local_id(0); int start_index = 0; int end_index = 0; float r_...
kernel void compute_sp_v16(global float* ptr, float _A) { float16 x = (float16)(_A, (_A + 1), (_A + 2), (_A + 3), (_A + 4), (_A + 5), (_A + 6), (_A + 7), (_A + 8), (_A + 9), (_A + 10), (_A + 11), (_A + 12), (_A + 13), (_A + 14), (_A + 15)); float16 y = (float16)get_local_id(0); x = mad(y, x, y); y = mad(x, y, ...
inline unsigned int nth_fibonacci(unsigned int n) { const float golden_ratio = (1.f + sqrt(5.f)) / 2.f; return floor(pown(golden_ratio, n) / sqrt(5.f) + 0.5f); } kernel void copy(global unsigned int* _buf0, const unsigned int count) { unsigned int index = get_local_id(0) + (32 * get_group_id(0)); for (unsigned...
kernel void vectorAdd(global const float* a, global const float* b, global float* c) { int i = get_global_id(0); c[i] = a[i] + b[i]; }