kernel_code
stringlengths
49
1.22M
inline float squash(float x) { return (1.0 / (1.0 + exp(-x))); } kernel void bpnn_output_error(global float* restrict delta, global float* restrict target, global float* restrict output, int nj, global float* restrict err) { int j; float o, t, errsum; errsum = 0.0; for (j = 1; j <= nj; j++) { o = output[...
float boundRange(float x, float lowerLimit, float upperLimit) { return (x < lowerLimit ? lowerLimit : (x > upperLimit ? upperLimit : x)); } float Logistic_fn(float x) { if (x < 88.722839f) { if (x > -88.722839f) return (float)1.0 / ((float)1.0 + exp(-x)); else return 0; } return 1; } floa...
kernel void abs_int(global int* src_0, global unsigned int* dst) { int gid = get_global_id(0); dst[gid] = (unsigned int)(abs(src_0[gid])); }
global int g_arr[] = {7, 42}; constant int c_arr[] = {-3, 56}; global int* p_g_int = &g_arr[1]; constant int* p_c_int = &c_arr[1]; kernel void global_variables(global int* output) { output[0] = g_arr[0]; output[1] = g_arr[1]; output[2] = c_arr[0]; output[3] = c_arr[1]; output[4] = *p_g_int; output[5] = *p_...
kernel void test_block_6_2_kern(global int* a0, global int* a1, global int* a2, global int* a3, global int* a4, global int* a5, global int* b0, global int* b1, local int* c0, local int* c1, local int* c2, local int* c3, local int* c4, local int* c5) { int i; unsigned int gtid = get_global_id(0); unsigned int ltid...
kernel void FWD_sum_ll(const int T, global float* ll_d) { unsigned int lid = get_local_id(0); unsigned int gid = get_global_id(0); local float sm[64]; if (gid < T) { sm[lid] = log10(ll_d[gid]); } barrier(0x01); if (lid < 32) { local float* smem = sm; smem[lid] += smem[lid + 32]; smem[l...
float d_u(float x, float y, float t) { return (-2.0f * native_cos(3.141592653589793 * (t) / 8.0f) * native_sin(3.141592653589793 * (x)) * native_sin(3.141592653589793 * (x)) * native_cos(3.141592653589793 * (y)) * native_sin(3.141592653589793 * (y))); } float d_v(float x, float y, float t) { return (2.0f * native_...
kernel void partitionData(global float* input, unsigned int dataSize, unsigned int partsCount, 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 start = input[0]; fl...
kernel void clean_mod11a1_qa(global const int* lst, global const int* lstqa, global int* lst_clean, global const int* N) { int i = get_global_id(0); if (i < N) lst_clean[i] = lst[i]; if ((lstqa[i] & 0x03) > 1) lst_clean[i] = -28768; }
float distsqr(global float* a, global float* b) { float result = 0.0f; for (int i = 0; i < 3; ++i) { result += (a[i] - b[i]) * (a[i] - b[i]); } return result; } float distsqr__(float* a, global float* b) { float result = 0.0f; for (int i = 0; i < 3; ++i) { result += (a[i] - b[i]) * (a[i] - b[i])...
kernel void vecinit(global int* out, int n) { const int i = get_global_id(0); if (i < n) out[i] = (i + 1); }
kernel void mataccKernel7(global float8* mA, global float* mC, const unsigned int mWidth) { const int nthreads = 16; unsigned int nunits = get_num_groups(0); unsigned int mSize = mWidth * mWidth / 8 / nthreads / nunits; unsigned int g_id = get_group_id(0); unsigned int l_id = get_local_id(0); local float mC...
__attribute__((reqd_work_group_size(512, 1, 1))) kernel void Relu(const global float* restrict in, global float* restrict out, int in_n, int in_c, int in_h, int in_w, int in_n_stride, int in_c_stride, int in_h_stride, int in_w_stride, int out_n_stride, int out_c_stride, int out_h_stride, int out_w_stride, float neg_slo...
kernel void mataccKernel1(global float* mA, global float* mC, const unsigned int mWidth) { unsigned int g_id = get_group_id(0); unsigned int nunits = get_num_groups(0); float elt = 0.0; for (unsigned int i = 0; i < mWidth / nunits; i++) { for (unsigned int j = 0; j < mWidth; j++) { elt += mA[i * mWidt...
int linear_interpolation_GPU(double ratio, int nL, int nR, int vL, int vR, double nI) { double dnL = nL, dnR = nR, dvL = vL, dvR = vR; if (ratio > 1.0) return 0; double dvI = dvL * (dnR - nI) + dvR * (nI - dnL); int vI = (int)dvI; return vI; } double windows_GPU(double t, double nT) { if (t <= nT && t...
kernel void foo(global float3* in, global float3* out) { *out = fmax(in[0], in[1]); }
kernel void bsort_postprocess_kv(global uint4* g_data, global uint4* g_data_v, unsigned int valMax) { unsigned int id, global_start; uint4 input1, input2, input1_v, input2_v; id = get_local_id(0) * 2; global_start = get_group_id(0) * get_local_size(0) * 2 + id; input1 = g_data[global_start]; input2 = g_da...
kernel void compiler_mul24(global int* src1, global int* src2, global int* dst) { int i = get_global_id(0); dst[i] = mul24(src1[i], src2[i]); }
kernel void kernel_floor_withDD1(global float* result_floor, int N) { float p1 = 0.002; int i = 0; for (i = 0; i < N; i++) { p1 += floor(p1); p1 += floor(p1); p1 += floor(p1); p1 += floor(p1); p1 += floor(p1); p1 += floor(p1); p1 += floor(p1); p1 += floor(p1); p1 += floor(p1);...
kernel void row_info_extractor(global const uint2* coords, global const float* elements, global const unsigned int* group_boundaries, global float* result, unsigned int option, local unsigned int* shared_rows, local float* inter_results) { uint2 tmp; float val; unsigned int last_index = get_local_size(0) - 1; u...
kernel void determine_action(global const char* last_boolean_output, global int* actions, unsigned int size, unsigned int index) { for (unsigned int i = get_global_id(0); i < size; i += get_global_size(0)) { if (last_boolean_output[i]) actions[index] = i; } }
kernel void multiply_char4char4(global char4* src_0, global char4* src_1, global char4* dst) { int gid = get_global_id(0); dst[gid] = src_0[gid] * src_1[gid]; }
float boundRange(float x, float lowerLimit, float upperLimit) { return (x < lowerLimit ? lowerLimit : (x > upperLimit ? upperLimit : x)); } float Logistic_fn(float x) { if (x < 88.722839f) { if (x > -88.722839f) return (float)1.0 / ((float)1.0 + exp(-x)); else return 0; } return 1; } floa...
kernel void tick(int width, int height, global unsigned char* from, global unsigned char* to) { int gid = get_global_id(0); if (gid <= width * height) { int x = gid % width; int y = gid / width; int x0 = (x == 0 ? width - 1 : x - 1) * 4 + 3; int x1 = x * 4 + 3; int x2 = ((x + 1) == width ? 0 : ...
kernel void vec_add_double(global const double* a, global const double* b, global double* c, int N) { int nIndex = get_global_id(0); if (nIndex < N) { c[nIndex] = a[nIndex] + b[nIndex]; } }
kernel void native_exp10_float8(global float8* src_0, global float8* dst) { int gid = get_global_id(0); dst[gid] = native_exp10(src_0[gid]); }
kernel void async_copy_divergent(global int* data, local int* scratch) { int i = get_local_id(0); size_t size = get_local_size(0); if (i == size - 1) { size = 1; } event_t event = async_work_group_copy(scratch, data, size, 0); wait_group_events(1, &event); data[get_local_size(0) - i - 1] = scratch[i...
kernel void clearOverlappingPairsKernel(global int4* pairs, int numPairs) { int pairId = get_global_id(0); if (pairId < numPairs) { pairs[pairId].z = 0xffffffff; } }
kernel void clkernel_clamp(const int num, float low, float high, global const float* in, global float* out) { const int i = get_global_id(0); if (i >= num) return; out[i] = clamp(in[i], low, high); }
kernel void Scale_multiBias(global float* out_data, global float* in_data, global float* scale_data, global float* bias_data, const int count, const int scale_dim, const int inner_dim, const int bias_flag) { int tid = get_global_id(0); if (tid < count) { int scale_id = (tid / inner_dim) % scale_dim; float ...
int Calculate2DIndex(int x, int y, int DATA_W) { return x + y * DATA_W; } int Calculate3DIndex(int x, int y, int z, int DATA_W, int DATA_H) { return x + y * DATA_W + z * DATA_W * DATA_H; } int Calculate4DIndex(int x, int y, int z, int t, int DATA_W, int DATA_H, int DATA_D) { return x + y * DATA_W + z * DATA_W *...
kernel void abs_ushort(global ushort* src_0, global ushort* dst) { int gid = get_global_id(0); dst[gid] = abs(src_0[gid]); }
kernel void Reduce_SQUARE_ADD(global float* buffer, local float* scratch, const int length, global float* result, const int offset, const int step) { int global_index = get_global_id(0); float accumulator = 0; while (global_index < length) { float a = buffer[offset + step * global_index]; float b = accumu...
kernel void test_arg_1_5_kern(global float4* a0, 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] + 0.1f + za; b0[gtid] = (0.0f + 1.1f) * (+tmp0); b1[gt...
kernel void histogram(global unsigned char* bytes, global unsigned int* pixelCount, global unsigned int* result) { unsigned int lid = get_local_id(0); unsigned int gid = get_group_id(0); unsigned int gsize = get_local_size(0); unsigned int globalId = get_global_id(0); unsigned int i, bValue; unsigned int b...
kernel void min_shortshort(global short* src_0, global short* src_1, global short* dst) { int gid = get_global_id(0); dst[gid] = min(src_0[gid], src_1[gid]); }
kernel void test_block_2_3_kern(global float* a0, global float* a1, global float* b0, global float* b1, global float* b2, local float* c0, local float* c1) { int i; unsigned int gtid = get_global_id(0); unsigned int ltid = get_local_id(0); size_t lsz = get_local_size(0); c0[ltid] = a0[gtid] + 0.1f; c1[ltid]...
kernel void TestSimple(global float* input, global float* output, const unsigned int count) { int i = get_global_id(0); if (i < count) output[i] = input[i] * input[i]; }
kernel void comma(global int* out) { out[0] = (0, 0, 1); out[1] = 1, 0, 0; out[3] = (out[2] = 1, 1); out[5] = out[4] = 1, 0; }
kernel void kernel_ceil_withDD1(global float* result_ceil, int N) { float p1 = -0.25; int i = 0; for (i = 0; i < N; i = i + 1) { p1 += ceil(p1); p1 += ceil(p1); p1 += ceil(p1); p1 += ceil(p1); p1 += ceil(p1); p1 += ceil(p1); p1 += ceil(p1); p1 += ceil(p1); p1 += ceil(p1); p...
kernel void reduce(global float4* accel, const unsigned int len, local float4* sdata) { unsigned int tid = get_local_id(0); unsigned int gid = get_global_id(0); sdata[tid] = (gid < len) ? accel[gid] : 0; barrier(0x01); for (unsigned int s = get_local_size(0) / 2; s > 0; s >>= 1) { if (tid < s) { ...
kernel void test_block_1_4_kern(global float* a0, global float* b0, global float* b1, global float* b2, global float* b3, local float* c0) { int i; unsigned int gtid = get_global_id(0); unsigned int ltid = get_local_id(0); size_t lsz = get_local_size(0); c0[ltid] = a0[gtid] + 0.1f; barrier(0x01); float tm...
kernel void identity(global const uchar* A, global uchar* B) { int id = get_global_id(0); B[id] = A[id]; }
kernel void downsample_2v2(global short* cb, global short* cr, 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 >> 0x6; size_t super_block_x = super_block_id % nsbw; size_t su...
kernel void fill_double(global double* output, const double proto, const unsigned int size) { unsigned int tid = get_global_id(0); if (tid < size) output[tid] = proto; }
kernel void test_fa1_6_1_kern(global float* a0, global float* a1, global float* a2, global float* a3, global float* a4, global float* a5, 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] + ...
kernel void uninitialized_private_array(global unsigned int* indices, global float* input, global float* output) { float scratch[4]; for (int i = 0; i < 4; i++) { scratch[indices[i]] = i; } for (int i = 0; i < 4; i++) { output[i] = scratch[i]; } }
kernel void updatePositions(global float4* positions, const global float4* predicted, global float4* velocities, const global float4* deltaVelocities, const unsigned int N) { const unsigned int i = get_global_id(0); if (i >= N) return; positions[i].xyz = predicted[i].xyz; velocities[i].xyz += deltaVelociti...
kernel void test_arg_5_2_kern(global float4* a0, global float4* a1, global float4* a2, global float4* a3, global float4* a4, global float4* b0, global float4* b1) { 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; float4 tmp1 = a1[gtid] +...
int get_value(int value); constant struct { struct { struct { int f; } b; } a; } c1 = {{{1}}}, c2 = {{{2}}}; constant struct { struct { struct { int f; } b; } a; } c3 = {{{3}}}, c4 = {{{4}}}; int get_value(int value) { struct { struct { struct { int f; }...
kernel void test_arg_4_4_kern(global int4* a0, global int4* a1, global int4* a2, global int4* a3, global int4* b0, global int4* b1, global int4* b2, global int4* b3) { 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; int4 tmp2 = ...
kernel void postdec(global char* out, char in) { out[0] = in--; }
void F(private unsigned int* state, int src_idx, int dst_idx); void FL(private unsigned int* state); void InvFL(private unsigned int* state); kernel void bitslice_kernel(global uint4* state, local uint4* cache) { const uint4 c1 = (uint4)(1); size_t id = get_local_id(0); uint4 t = (uint4)(0), cs; cache += id & 0...
kernel void sub(global ulong* out, ulong a, ulong b) { out[0] = a - b; }
kernel void bitonicSort(global float* keys, global float* vals, int count, int stage, int passOfStage) { const int threadId = get_global_id(0); if (threadId >= count / 2) { return; } const int pairDistance = 1 << (stage - passOfStage); const int blockWidth = 2 * pairDistance; int leftId = min((threadId...
inline float2 rotateValue2(float2 value, float c, float s) { return (float2)(dot(value, (float2)(c, -s)), dot(value, (float2)(s, c))); } kernel void cooleyTukeyFFTTwiddleFactors(int N, global float2* twiddleFactors) { int k = get_global_id(0); float param = -3.14159265359f * 2 * k / (float)N; float c, s = sinc...
kernel void kernelVectorTwo(char2 inputChar, uchar2 inputUChar, short2 inputShort, ushort2 inputUShort, int2 inputInt, uint2 inputUInt, long2 inputLong, ulong2 inputULong, float2 inputFloat, double2 inputDouble, global float2* output) { output[0] = convert_float2(inputChar); output[1] = convert_float2(inputUChar); ...
kernel void test_char3(global char* pin, global char* pout) { int x = get_global_id(0); char3 value; value = vload3(x, pin); value += (char3){(char)1, (char)2, (char)3}; vstore3(value, x, pout); }
kernel void averageArr(global float* ioim, int size, global float* avrg) { float sum = 0; int tot = 0; for (size_t idx = 0; idx < size; idx++) { const float dt = *ioim++; if (!isnan(dt)) { tot++; sum += dt; } } *avrg = tot ? sum / tot : __builtin_astype((2147483647), float); }
; ; ; ; kernel void compiler_half_math_tan(global float* src, global float* dst) { int i = get_global_id(0); dst[i] = tan(src[i]); }
kernel void NL_SIGM_FWD(global float* X, global float* Y) { unsigned int element = get_global_id(0); Y[element] = 1.0f / (1.0f + exp(-X[element])); }
kernel void test_arg_3_2_kern(global int4* a0, global int4* a1, global int4* a2, 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; int4 tmp2 = a2[gtid] + 2 + za; b0[gtid] = (0 + 1) * (+tmp0 + ...
kernel void kernel_rsqrt_withDD1(global float* result_rsqrt, int N) { float t1 = 23456.234; int i = 0; for (i = 0; i < N; i++) { t1 = rsqrt(t1); t1 = rsqrt(t1); t1 = rsqrt(t1); t1 = rsqrt(t1); t1 = rsqrt(t1); t1 = rsqrt(t1); t1 = rsqrt(t1); t1 = rsqrt(t1); t1 = rsqrt(t1); t...
kernel void test_fa1_2_4_kern(global float* a0, global float* a1, global float* b0, global float* b1, global float* b2, global float* b3) { unsigned int gtid = get_global_id(0); float tmp0 = a0[gtid] + 0.1f; float tmp1 = a1[gtid] + 1.1f; b0[gtid] = (0.0f + 1.1f) * (+tmp0 + tmp1); b1[gtid] = (1.0f + 1.1f) * (+...
kernel void add_array(global const float* src1, global const float* src2, global float* dst) { int gid = get_global_id(0); dst[gid] = src1[gid] + src2[gid]; }
float LaplacianXY(global float* pop, int row, int column) { float retval; int current, left, right, top, bottom; float dx = 0.5; float dy = 0.5; current = row * (32 * 16) + column; left = row * (32 * 16) + column - 1; right = row * (32 * 16) + column + 1; top = (row - 1) * (32 * 16) + column; bottom ...
constant float TWOPI = 3.14159265358979323846264338327950288f * 2.0f; constant float phStepL = (439.0f * 3.14159265358979323846264338327950288f) / 44100.0f; constant float phStepR = (441.0f * 3.14159265358979323846264338327950288f) / 44100.0f; kernel void cl_synth(int bufOffset, global float* buf) { const int gid = g...
float GL_to_CL(unsigned int val); float3 RGBtoXYZ(float3 rgb); const sampler_t sampler = 0 | 0 | 0x10; kernel void coarsest_level_attenfunc(global float* gradient, global float* atten_func, global float* k_alpha, const int width, const int height, const int offset) { for (int gid = get_global_id(0); gid < width * hei...
int bar(int x) { return 0; } kernel void foo(global int* x) { *x = bar(1); }
kernel void compiler_abs_diff_long(global long* x, global long* y, global ulong* diff) { int i = get_global_id(0); diff[i] = abs_diff(x[i], y[i]); }
kernel void mad_hi_uintuintuint(global unsigned int* src_0, global unsigned int* src_1, global unsigned int* src_2, global unsigned int* dst) { int gid = get_global_id(0); dst[gid] = mad_hi(src_0[gid], src_1[gid], src_2[gid]); }
kernel void bitset_megaop(global unsigned int* in, global unsigned int* out, global unsigned int* use, global unsigned int* def, const unsigned int subset_count) { unsigned int i = get_global_id(0); if (i < subset_count) { in[i] = out[i]; in[i] = in[i] & (~(in[i] & def[i])); in[i] |= use[i]; } }
kernel void per_element_mult_inplace(const int N, global float* target, global const float* source) { const int globalId = get_global_id(0); if (globalId >= N) { return; } target[globalId] *= source[globalId]; }
kernel void kern(global float* a, global float* result) { result[0] = sin(a[0]); }
kernel void ker_elt_max(global float* out_data, const int with_relu, global const float* in_data_a, global const float* in_data_b, int count) { int idx = get_global_id(0); if (idx < count) { float tmp; float var_a = in_data_a[idx]; float var_b = in_data_b[idx]; int a_gt_b = var_a > var_b; tmp =...
kernel void addOffset(const global unsigned int* blockOffsets, global unsigned int* elements, unsigned int numElements) { const unsigned int gid0 = get_global_id(0); if (gid0 < numElements) elements[gid0] += blockOffsets[(get_global_offset(0) / 128) + get_group_id(0)]; }
int cellId(int4 cellFactors_, unsigned int gridCellsX, unsigned int gridCellsY, unsigned int gridCellsZ) { int cellId_ = cellFactors_.x + cellFactors_.y * gridCellsX + cellFactors_.z * gridCellsX * gridCellsY; return cellId_; } int4 cellFactors(float4 position, float xmin, float ymin, float zmin, float hashGridCel...
kernel void xcorr_improved(global int* in1, global int* in2, global int* out) { int offset = get_global_id(0) << 2; int len = get_global_size(0) << 2; int i = 0; int res1 = 0, res2 = 0, res3 = 0, res4 = 0; do { res1 += in1[i] * in2[i + offset]; res2 += in1[i] * in2[i + offset + 1]; res3 += in1[i] ...
kernel void mainKernel(const long num, global const float* a, global const float* b, global float* c) { int iGID = get_global_id(0); if (iGID < num) c[iGID] = a[iGID] * b[iGID]; }
kernel void square(global float* input, const unsigned int input_size, global float* output, const unsigned int output_size) { int range_start = get_global_id(0) * 64; int range_end = range_start + 64; private float private_buffer[128]; for (int i = range_start; i < range_end; i++) { private float ori...
kernel void foo(global float* A, global float* B, global int* C, global float* D, float f, float g) { *A = f + g; *B = 0.0f; *C = 12; *D = f; }
kernel void half_sin_float8(global float8* src_0, global float8* dst) { int gid = get_global_id(0); dst[gid] = half_sin(src_0[gid]); }
kernel void p_se_kernel1(int nLoc, int nTpt, global int* I, global int* N, global double* eta, local int* I_loc, local int* N_loc, local double* eta_loc) { size_t globalId = get_global_id(0); size_t localId = get_local_id(0); size_t localSize = get_local_size(0); size_t totalSize = nLoc * nTpt; if (globalId ...
kernel void zoom(global float* vertices) { unsigned int id = get_global_id(0); vertices[id] *= 1.01; }
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 make_step_kernel(global float* pars, global float* dpars, float stepSize, int batchSize) { int tid = get...
kernel void foo(global int* a, global char2* b) { *a = any(*b); }
float3 stickForce(float3 p1, float3 p2, float k, float l0) { float3 d = p2 - p1; float l = sqrt(dot(d, d)); d *= k * (l - l0) / (l + 1e-8f); return d; } float3 harmonicForce(float3 p1, float3 p2, float k) { float3 d = p2 - p1; return d * k; } kernel void move_leapfrog(global float4* pos, global float4* ve...
void GPUResample(global float* spectra, global const float* resamplingTable, global const float* interpolationMatrix, unsigned int inputSpectraLength, global float* resampledSpectra); void preProcess(global const short* spectrum, global const float* resamplingTable, global const float* interpolationMatrix, global const...
kernel void loaduv(global uchar8 const* const in, global float8* out, int out_offset) { const int gid = get_global_id(0); const uchar8 inv = in[gid]; const float8 outv = convert_float8(inv); out[gid + out_offset / 8] = outv; }
kernel void test_arg_4_4_kern(global int* a0, global int* a1, global int* a2, global int* a3, global int* b0, global int* b1, global int* b2, global int* b3) { 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; b0[gtid] =...
kernel void kernel_sinh_withDD2(global float* result_sinh, int N) { float t1 = 0.0; float2 t2 = t1 + (float2)(0); int i = 0; for (i = 0; i < N; i++) { t2 = sinh(t2); t2 = sinh(t2); t2 = sinh(t2); t2 = sinh(t2); t2 = sinh(t2); t2 = sinh(t2); t2 = sinh(t2); t2 = sinh(t2); t2 = ...
kernel void huergb_pln(global unsigned char* input, global unsigned char* output, const double hue, const double sat, const unsigned int height, const unsigned int width) { int id = get_global_id(0); double r, g, b, min, max, delta; double temp1, temp2, temp3; if (id < 3 * height * width) { r = input[id] /...
kernel void take_topk(global unsigned int* tally, global unsigned int* tallyCount, unsigned int segmentSizePow2, unsigned int topk) { unsigned int grpId = get_group_id(0); unsigned int localId = get_local_id(0); unsigned int myCopyLoc = (1 & (unsigned int)grpId) ? ((unsigned)(grpId * segmentSizePow2) + localId) ...
kernel void unary_minus_uint4(global uint4* src_0, global uint4* dst) { int gid = get_global_id(0); dst[gid] = -src_0[gid]; }
kernel void movement(global float4* inNodes, global float4* inForces, global float4* outNodes, const float temperature) { unsigned int i = get_global_id(0); if (length(inNodes[i]) < 100000) { float magnitude = length(inForces[i]); if (magnitude > 0.0) outNodes[i] = inNodes[i] + temperature * inForces[...
kernel void compact_predicate(global int* data, global int* pred) { int id = get_global_id(0); int predVal = data[id] < 50 ? 1 : 0; pred[id] = predVal; }
kernel void D_electric_field_border(global double* d_E_X, global double* d_E_Y, double hx, int J_X, int J_Y) { int k = get_global_id(0); if (k < J_Y) { d_E_X[k] = 0.0; d_E_Y[k] = 0.0; d_E_X[(J_X - 1) * J_Y + k] = 0.0; d_E_Y[(J_X - 1) * J_Y + k] = 0.0; } }
kernel void test_arg_1_2_kern(global int* a0, global int* b0, global int* b1) { unsigned int gtid = get_global_id(0); int tmp0 = a0[gtid] + 0; b0[gtid] = (0 + 1) * (+tmp0); b1[gtid] = (1 + 1) * (+tmp0); }
void write_local(global int* in, local int* tmp, unsigned int id) { tmp[id] = in[id]; } void read_local(global int* out, local int* tmp, unsigned int id) { out[id] = tmp[id]; } kernel void local_memory(global int* in, global int* out, local int* temp) { unsigned int gid = get_global_id(0); write_local(in, tem...
kernel void insert(int src, global int* idx, global int* queue, global int* path_counts, global int* depths) { int id = get_global_id(0); if (id == 0) { depths[src] = 0; path_counts[src] = 1; queue[*idx] = src; (*idx)++; } }