kernel_code
stringlengths
49
1.22M
kernel void shortToFloat(global short* inputBuffer, long inputStep, long inputOffset, global float* outputBuffer, long outputStep, long outputOffset, float conversionGain) { float scale = conversionGain / 32767; int gid = get_global_id(0); outputBuffer[(gid * outputStep) + outputOffset] = convert_float(inputBuff...
kernel void foo(global float* A, float x) { *A = atanpi(x); }
kernel void foo(global int* a, global int* b, int m, int n) { if (m > 0) { for (int i = 0; i < n; ++i) { a[i] += b[i]; } } }
kernel void trans_lu_forward(global const unsigned int* row_indices, global const unsigned int* column_indices, global const float* elements, global const float* diagonal_entries, global float* vector, unsigned int size) { local unsigned int row_index_lookahead[256]; local unsigned int row_index_buffer[256]; uns...
inline unsigned int get_random(unsigned int* m_z, unsigned int* m_w) { (*m_z) = 36969 * ((*m_z) & 65535) + ((*m_z) >> 16); (*m_w) = 18000 * ((*m_w) & 65535) + ((*m_w) >> 16); return ((*m_z) << 16) + (*m_w); } inline unsigned int circular_shift_right(unsigned int value, unsigned int offset, unsigned int total_bit...
uint2 rand(uint2 seed, unsigned int iterations) { unsigned int sum = 0; unsigned int delta = 0x9E3779B9; unsigned int k[4] = {0xA341316C, 0xC8013EA4, 0xAD90777D, 0x7E95761E}; for (int j = 0; j < iterations; j++) { sum += delta; seed.x += ((seed.y << 4) + k[0]) & (seed.y + sum) & ((seed.y >> 5) + k[1]);...
constant sampler_t nearest = 0 | 2 | 0x10; inline unsigned int makeCode(const float iso[8]) { return (iso[0] >= 0.0f ? 0x01U : 0U) | (iso[1] >= 0.0f ? 0x02U : 0U) | (iso[2] >= 0.0f ? 0x04U : 0U) | (iso[3] >= 0.0f ? 0x08U : 0U) | (iso[4] >= 0.0f ? 0x10U : 0U) | (iso[5] >= 0.0f ? 0x20U : 0U) | (iso[6] >= 0.0f ? 0x40U :...
kernel void reduce_kernel(long d_Ne, long d_no, int d_mul, global float* d_sums, global float* d_sums2, int gridDim) { int bx = get_group_id(0); int tx = get_local_id(0); int ei = (bx * 32) + tx; int nf = 32 - (gridDim * 32 - d_no); int df = 0; local float d_psum[32]; local float d_psum2[32]; int i;...
kernel void move(global double* xp, global const double* vx, double dt, int N) { int gid = get_global_id(0); const int stride = get_global_size(0); while (gid < N) { xp[gid] += dt * vx[gid]; gid += stride; } }
kernel void add(global float a[], global float b[]) { int id = get_global_id(0); float8 v1 = vload8(id, a); float8 v2 = vload8(id, b); v1 += v2; vstore8(v1, id, a); }
kernel void add(global const float* A, global const float* B, global float* C) { *C = *A + *B; }
kernel void test_copy_buffer(global float* src, global float* dst) { int id = (int)get_global_id(0); dst[id] = src[id]; }
typedef unsigned int u; constant unsigned int hi[8] = {0x6a09e667, 0xbb67ae85, 0x3c6ef372, 0xa54ff53a, 0x510e527f, 0x9b05688c, 0x1f83d9ab, 0x5be0cd19}; constant unsigned int k[64] = {0x428a2f98, 0x71374491, 0xb5c0fbcf, 0xe9b5dba5, 0x3956c25b, 0x59f111f1, 0x923f82a4, 0xab1c5ed5, 0xd807aa98, 0x12835b01, 0x243185be, 0x55...
kernel void foo(global int* out, int x, int y) { *out = x + y; }
kernel void add_const_kernel(global float* input, float value) { const unsigned int idx = get_global_id(0); const float out_val = input[idx] + value; input[idx] = out_val; }
kernel void mad_sat_uchar16uchar16uchar16(global uchar16* src_0, global uchar16* src_1, global uchar16* src_2, global uchar16* dst) { int gid = get_global_id(0); dst[gid] = mad_sat(src_0[gid], src_1[gid], src_2[gid]); }
kernel void hessian(global float* xx, global float* xy, global float* yy, global float* out, float sigmaD) { int i = get_global_id(0); out[i] = fabs(((xx[i] * yy[i] - pow(xy[i], 2)) * pow(sigmaD, 2))); }
kernel void test_vector_creation3(global char* src, global char* result) { vstore3((char3)(src[0], src[1], src[2]), 0, result); vstore3((char3)(src[0], vload2(0, src + 1)), 1, result); vstore3((char3)(vload2(0, src + 0), src[2]), 2, result); vstore3((char3)(vload3(0, src + 0)), 3, result); }
float sstep(float a, float x) { if (x >= a) { return 1; } return 0; } float pulse(float a, float b, float x) { return sstep(a, x) - sstep(b, x); } float3 windowTile(int ix) { ix = ix % 5; if (ix == 1) return (float3)(0.2, 0.2, 0.2); if (ix == 2) return (float3)(0, 0, 0.2); if (ix == 3) ...
kernel void compute(global unsigned char* g_num, global unsigned char* g_table, global unsigned char* g_answer, const unsigned int num_size) { unsigned int tid = get_global_id(0); if (tid < num_size) { unsigned char loc = g_num[tid]; for (int i = 0; i < num_size - tid; i++) { loc = g_table[loc]; }...
kernel void initializer_in_for_statement(global int* array) { for (int i = 0, k = 100; i < 1; i++) { int* ptr = (&k); ptr++; } }
kernel void kernel_asin_withoutDD1(global float* result_asin, int N) { float t1 = 1.0; float t2 = 1.1; float t3 = 1.2; float t4 = 1.3; float t5 = 1.4; float t6 = 1.5; float t7 = 1.6; float t8 = 1.6; float t9 = 1.7; float t10 = 1.8; float p1 = 0.0; for (p1 = 0.0; p1 < 1.0; p1 = p1 + 0.0001) { ...
kernel void foo(global float4* in, global float4* out) { *out = max(in[0], in[1]); }
kernel void BK_scaling(const int N, global const float* ll_d, global float* beta) { unsigned int idx = get_global_id(0); if (idx < N) { beta[idx] /= ll_d[0]; } }
kernel void THClStorageSet(global float* data, int index, float value) { if (get_global_id(0) == 0) { data[index] = value; } }
; ; ; ; ; ; ; ; kernel void builtin_convert_char_to_uchar_sat(global char* src, global uchar* dst) { int i = get_global_id(0); dst[i] = convert_uchar_sat(src[i]); }
kernel void vanillaPut(global float* buffer, float strike) { int i = get_global_id(0); buffer[i] = fmax(0.0f, strike - buffer[i]); }
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 test_fa1_2_2_kern(global float* a0, global float* a1, 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; b0[gtid] = (0.0f + 1.1f) * (+tmp0 + tmp1); b1[gtid] = (1.0f + 1.1f) * (+tmp0 + tmp1); }
kernel void test_arg_1_6_kern(global int* a0, global int* b0, global int* b1, global int* b2, global int* b3, global int* b4, global int* b5) { unsigned int gtid = get_global_id(0); int tmp0 = a0[gtid] + 0; b0[gtid] = (0 + 1) * (+tmp0); b1[gtid] = (1 + 1) * (+tmp0); b2[gtid] = (2 + 1) * (+tmp0); b3[gtid] = ...
kernel void unary_plus_ushort(global ushort* src_0, global ushort* dst) { int gid = get_global_id(0); dst[gid] = +src_0[gid]; }
kernel void frameDiffDoubleDouble(global double* v, global double* v2) { unsigned int i = get_global_id(0); if (abs((int)(v[i] - v2[i])) < 20) { v[i] = 0; } }
kernel void kernel_cospi_withDD1(global float* result_cospi, int N) { float t1 = 4.3; int i = 0; for (i = 0; i < N; i++) { t1 = cospi(t1); t1 = cospi(t1); t1 = cospi(t1); t1 = cospi(t1); t1 = cospi(t1); t1 = cospi(t1); t1 = cospi(t1); t1 = cospi(t1); t1 = cospi(t1); t1 = co...
kernel void mul_sub(global const float* vec1, global const float* fac, global const float* float2, global float* result, unsigned int size) { float factor = *fac; for (unsigned int i = get_global_id(0); i < size; i += get_global_size(0)) result[i] = vec1[i] * factor - float2[i]; }
void kernel_ecc(float timeinst, global float* d_initvalu, global float* d_finavalu, int valu_offset, global float* d_params) { float cycleLength; int offset_1; int offset_2; int offset_3; int offset_4; int offset_5; int offset_6; int offset_7; int offset_8; int offset_9; int offset_10; int offs...
kernel void relational_less_than_or_equal_to_uintuint(global unsigned int* src_0, global unsigned int* src_1, global int* dst) { int gid = get_global_id(0); dst[gid] = (int)(src_0[gid] <= src_1[gid]); }
kernel void sum(global const float* a, global const float* b, global float* c) { int gid = get_global_id(0); float a_temp; float b_temp; float c_temp; a_temp = a[gid]; b_temp = b[gid]; c_temp = a_temp + b_temp; c_temp = c_temp * c_temp; c_temp = c_temp * (a_temp / 2.0f); c[gid] = c_temp; }
kernel void test_unsigned_char(uchar u, uchar4 u2, global uchar* out) { *out = u; vstore4(u2, 4, out); }
kernel void compiler_abs_ushort(global ushort* src, global ushort* dst) { int i = get_global_id(0); dst[i] = abs(src[i]); }
kernel void vector_sum(global float* a, global float* b, global float* c) { int tx = get_global_id(0); c[tx] = a[tx] + b[tx]; }
__attribute__((always_inline)) float k_sincos(int i, float* cretp) { if (i > 512) i -= 1024; float x = i * -0x1.921fb6p-8F; *cretp = native_cos(x); return native_sin(x); } __attribute__((always_inline)) float4 k_sincos4(int4 i, float4* cretp) { i -= (i > 512) & 1024; float4 x = convert_float4(i) * -0x...
kernel void ripple(global float* vertices, global float* centers, global long* times, int num_centers, long now) { unsigned int id = get_global_id(0); unsigned int offset = id * 3; float x = vertices[offset]; float y = vertices[offset + 1]; float z = 0.0; for (int i = 0; i < num_centers; ++i) { if (tim...
kernel void EM_norm_alphabeta(global const float* alpha_d, global const float* beta_d, global float* alphabeta_d, global float* gamma_d, local float* sm, const int current, const int N) { 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)...
kernel void dijkstra(global int* visited, global int* adjacency, global int* distances, const int size, global int* indexes) { visited[*indexes] = 1; int j = get_local_id(0); if (!visited[j] && distances[*indexes] + adjacency[j + *indexes * size] < distances[j]) distances[j] = distances[*indexes] + adjacency[...
kernel void reduce3(global float* g_idata, global float* g_odata, unsigned int n, local 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] += g_ida...
kernel void myadd(unsigned int a, unsigned int b, global unsigned int* result) { *result = a + b; }
unsigned int TriIndex(unsigned int, unsigned int, unsigned int); float Length(float4); float2 Midpoint(float4); float2 Reduce(float4); float4 ProjectOnto(float4, float4); float AngleCompat(float4, float4); float ScaleCompat(float4, float4); float PosCompat(float4, float4); float VisCompat(float4, float4); float Connect...
kernel void mc_kernel_reset(int numVolIdx, global float4* mcgrid) { size_t gid = get_global_id(0); mcgrid[gid].w = 0.0; }
kernel void bench_workgroup_scan_inclusive_add_long(global long* src, global long* dst, int reduce_loop) { long val; long 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 test_short4(global short* pin, global short* pout) { int x = get_global_id(0); short4 value; value = vload4(x, pin); value += (short4){(short)1, (short)2, (short)3, (short)4}; vstore4(value, x, pout); }
kernel void foo(global char3* a, global char3* b, global char3* c) { *a = bitselect(*a, *b, *c); }
kernel void reverse2(global int* bitRev, int logSize) { int global_id = get_global_id(0); int powMaxLvl = 11; int powLevels, powRemain, powX, x; int i, j, andmask, sum = 0, k; for (i = logSize - 1, j = 0; i >= 0; i--, j++) { andmask = 1 << i; k = global_id & andmask; powLevels = j / powMaxLvl; ...
kernel void correlate(global const float* afft, global const float* bfft, global float* outfft, int n) { int i = get_global_id(0); if (i >= n / 2) return; if (i == 0) { outfft[0] = afft[0] * bfft[0]; outfft[1] = afft[1] * bfft[1]; } else { outfft[i] = afft[i] * bfft[i] + afft[i + 1] * bfft[i + ...
const sampler_t sampler = 0 | 0x10 | 2; int read_val(read_only image2d_t input, int x, int y) { int2 pos = (int2)(x, y); uint4 pixel = read_imageui(input, sampler, pos); return pixel.s0; } kernel void compute_activity_ratios(global int* activities, global int* sizes, global float* ratios) { int pos = get_globa...
kernel void Vec_Add(global const double* a, global const double* b, global double* answer) { unsigned int xid = get_global_id(0); answer[xid] = a[xid] + b[xid]; }
kernel void localScan(global unsigned int* elements, unsigned int numElements, global unsigned int* blockSums) { const unsigned int lid0 = get_local_id(0); const unsigned int gid0 = get_global_id(0); local unsigned int blockPrefixSum[128]; if (gid0 < numElements) blockPrefixSum[lid0] = elements[gid0]; e...
kernel void _check_normalization(double referenceDistance, global double* in, global int* flag) { int globalID = get_global_id(0); if ((in[globalID + 1] - in[globalID]) != referenceDistance) { flag[0] = 1; } }
kernel void doubleGrayScaleFloatDouble(global float* v, global double* v2) { unsigned int i = get_global_id(0); if (i % 3 == 0) { v[i] = v[i]; v[i + 1] = v[i]; v[i + 2] = v[i]; v2[i] = v2[i]; v2[i + 1] = v2[i]; v2[i + 2] = v2[i]; } }
kernel void test_arg_4_1_kern(global int4* a0, global int4* a1, global int4* a2, global int4* a3, 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 + za; int4 tmp2 = a2[gtid] + 2 + za; int4 tmp3 = a3[gtid] + 3 + za;...
kernel void fir_float(global float* in, global float* coeff, global float* out, int filter_len) { int index = get_global_id(0); int i = 0; float acc = 0; do { acc += in[index + i] * coeff[i]; i++; } while (i != filter_len); out[index] = acc; }
constant float grad3lut[16][3] = {{1.0f, 0.0f, 1.0f}, {0.0f, 1.0f, 1.0f}, {-1.0f, 0.0f, 1.0f}, {0.0f, -1.0f, 1.0f}, {1.0f, 0.0f, -1.0f}, {0.0f, 1.0f, -1.0f}, {-1.0f, 0.0f, -1.0f}, {0.0f, -1.0f, -1.0f}, {1.0f, -1.0f, 0.0f}, {1.0f, 1.0f, 0.0f}, {-1.0f, 1.0f, 0.0f}, {-1.0f, -1.0f, 0.0f}, {1.0f, 0.0f, 1.0f}, {-1.0f, 0.0f, ...
kernel void test_stream_read_ushort(global ushort* dst) { dst[0] = (unsigned short)((1 << 8) + 1); }
kernel void scopy(int n, global float* sxorig, global float* sydest) { int i, tid, totalThreads, ctaStart; tid = get_local_id(0); int locsiz = get_local_size(0); int gridDimx = get_num_groups(0); int gid = get_group_id(0); totalThreads = gridDimx * locsiz; ctaStart = locsiz * gid; for (i = ctaStart +...
kernel void min_int16int16(global int16* src_0, global int16* src_1, global int16* dst) { int gid = get_global_id(0); dst[gid] = min(src_0[gid], src_1[gid]); }
kernel void post_decrement_ulong8(global ulong8* src_0, global ulong8* dst) { int gid = get_global_id(0); dst[gid] = src_0[gid]--; }
constant uchar isqrt_table[] = {0, 16, 22, 27, 32, 35, 39, 42, 45, 48, 50, 53, 55, 57, 59, 61, 64, 65, 67, 69, 71, 73, 75, 76, 78, 80, 81, 83, 84, 86, 87, 89, 90, 91, 93, 94, 96, 97, 98, 99, 101, 102, 103, 104, 106, 107, 108, 109, 110, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 128, 128,...
kernel void naive_reduction(global float* data, global float* output) { float sum = 0.0; if (get_global_id(0) == 0) { for (int i = 0; i < 1048576; i++) { sum += data[i]; } } *output = sum; }
kernel void test_select_copy_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; out[gid] = in[gid]; }
constant float beta = 0.66666f; kernel void propagate_errors(global float* errors, global const float* weights, int errors_ofs, int ofs, int count, int errors_count, int weights_offset, int inputs_per_neuron, local float* partial_sum, global const float* outputs) { for (unsigned int y = get_group_id(0); y < count; y ...
kernel void testFUnordNotEqual(float2 a, float2 b, global int2* res) { res[0] = a != b; }
kernel void cl_color_to_alpha(global const float4* in, global float4* out, float4 float3) { int gid = get_global_id(0); float4 in_v = in[gid]; float4 out_v = in_v; float4 alpha; alpha.w = in_v.w; if (float3.x < 0.00001f) alpha.x = in_v.x; else if (in_v.x > float3.x + 0.00001f) alpha.x = (in_v.x ...
void sum_reduce(int n, int i, local float* x); void sum_reduce(int n, int i, local float* x) { barrier(0x01); if (n > 1024) { if (i < 1024 && i + 1024 < n) { x[i] += x[i + 1024]; } barrier(0x01); } if (n > 512) { if (i < 512 && i + 512 < n) { x[i] += x[i + 512]; } barrier(0x0...
kernel void mysql_old(global uint2* dst, uint4 input, unsigned int size, uint16 chbase, global unsigned int* found_ind, global unsigned int* bitmaps, global unsigned int* found, global unsigned int* table, uint4 singlehash) { unsigned int l; unsigned int i, ib, ic, id, b1, b2, b3; unsigned int mOne; unsigned in...
constant float QUAR = 0.25; constant float HALF = 0.5; constant float TWO = 2.; constant float SIX = 6.; constant bool isHiPrecision = sizeof(TWO) == 8; constant float2 zero2 = (float2)(0, 0); constant float PI2 = (float)6.283185307179586476925286766559; constant float E2W = 1.51926751475e15; constant float C = 2.99792...
kernel void radians_float4(global float4* src_0, global float4* dst) { int gid = get_global_id(0); dst[gid] = radians(src_0[gid]); }
kernel void kernel5_check(global char* ptr, unsigned long memsize, volatile global unsigned int* err_count, global unsigned long* err_addr, global unsigned long* err_expect, global unsigned long* err_current, global unsigned long* err_second_read) { int i; global unsigned int* buf = (global unsigned int*)ptr; int...
kernel void reset_cells(const unsigned int N, global int* cells) { const int globalid = get_global_id(0); if (globalid >= N) return; cells[globalid] = -1; }
kernel void minimum(global const float* grid, global float* result, int const num_elements, local float* cache) { const unsigned int local_id = get_local_id(0); const unsigned int global_id = get_global_id(0); const unsigned int group_id = get_group_id(0); const unsigned int local_size = get_local_size(0); c...
float2 square(float2 a) { float2 at; at.x = (a.x * a.x) - (a.y * a.y); at.y = 2 * a.x * a.y; return at; } kernel void squareKernel(global const float2* a, global float2* b) { int id = get_global_id(0); b[id] = square(a[id]); }
kernel void bigDot(global float4* a, global float4* b, global float* out) { int id = get_global_id(0); out[id] = dot(a[id], b[id]); }
kernel void reset_links(const unsigned int N, global int* links) { const int globalid = get_global_id(0); if (globalid >= N) return; links[globalid] = globalid; }
kernel void sub_sat_short16short16(global short16* src_0, global short16* src_1, global short16* dst) { int gid = get_global_id(0); dst[gid] = sub_sat(src_0[gid], src_1[gid]); }
kernel void reverse_inplace(global float* vec, unsigned int size) { for (unsigned int i = get_global_id(0); i < (size >> 1); i += get_global_size(0)) { float val1 = vec[i]; float val2 = vec[size - i - 1]; vec[i] = val2; vec[size - i - 1] = val1; } }
kernel void kern(global float* a, global float* b, global float* c, global float* result) { result[0] = atan2pi(a[0], b[0]); result[1] = cbrt(a[1]); result[2] = ceil(a[2]); result[3] = copysign(a[3], b[3]); result[4] = cos(a[4]); result[5] = cosh(a[5]); result[6] = cospi(a[6]); result[7] = half_divide(a...
kernel void subtract_long16long16(global long16* src_0, global long16* src_1, global long16* dst) { int gid = get_global_id(0); dst[gid] = src_0[gid] - src_1[gid]; }
int divRndUp(int n, int d) { return (n / d) + ((n % d) ? 1 : 0); } void storeComponents(global int* d_r, global int* d_g, global int* d_b, int r, int g, int b, int pos) { d_r[pos] = r - 128; d_g[pos] = g - 128; d_b[pos] = b - 128; } void storeComponent(global int* d_c, const int c, int pos) { d_c[pos] = c - 1...
kernel void pointerSizeCast(global int* G) { local int L[1]; private int P[1]; local long* Llong = (local long*)&L[0]; private long* Plong = (private long*)&P[0]; global long* Glong = (global long*)&G[0]; Llong[0] = 0xDEADBEEFCAFEBABE; Glong[0] = Llong[0]; Plong[0] = 0x0102030405060708; Glong[1] ...
kernel void test_arg_8_1_kern(global float* a0, global float* a1, global float* a2, global float* a3, global float* a4, global float* a5, global float* a6, global float* a7, 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...
kernel void sampleKernel(global const char* deadSensor, global int* stop) { int idx = get_global_id(0); if (deadSensor[idx] == 1) stop[0] = 0; }
kernel void compiler_getelementptr_bitcast(global float* src, global float* dst) { int i = get_global_id(0); local float ldata[256]; ldata[get_local_id(0)] = src[i]; local uchar* pldata = (local uchar*)&ldata[0]; uchar data; for (int k = 0; k < 3; k++) { data = *pldata; pldata++; } dst[i] = d...
unsigned int __udivsi3(unsigned int a, unsigned int b) { unsigned q = 0, r = 0; r <<= 1; r += (a >> 31) & 1; q += r < b ? 0 : 1 << 31; r -= r < b ? 0 : b; r <<= 1; r += (a >> 30) & 1; q += r < b ? 0 : 1 << 30; r -= r < b ? 0 : b; r <<= 1; r += (a >> 29) & 1; q += r < b ? 0 : 1 << 29; r -= r ...
; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; kernel void builtin_convert_long_to_ushort_sat(global long* src, global ushort* dst) { int i = get_global_id(0); dst[i] = convert_ushort_sat(src[i]); }
kernel void test_asinpi(const global float* in, global float* out) { size_t gid = get_global_id(0); out[gid] = asinpi(in[gid]); }
kernel void applyTransform(global float* outputBuffer, global float* matrix, int numElements) { int iGID = get_global_id(0); if (iGID >= numElements) { return; } float4 point = (float4){outputBuffer[(iGID * 3)], outputBuffer[(iGID * 3) + 1], outputBuffer[(iGID * 3) + 2], 1.0f}; float4 row1 = (float4){mat...
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 S = state[i], omega = param[i]; float I = coupling[i]; deriv[i] = omega + I; }
kernel void adjust_score(global int4* values, global int4* final_data) { int global_id = get_global_id(0); final_data[global_id] = convert_int4(sqrt(convert_float4(values[global_id])) * 10); }
float Iq(float q, float cor_length); float Iq(float q, float cor_length) { float denominator = 1 + (q * cor_length) * (q * cor_length); return 1 / denominator; } float Iqxy(float qx, float qy, float cor_length); float Iqxy(float qx, float qy, float cor_length) { return Iq(sqrt(qx * qx + qy * qy), cor_length); } ...
kernel void round_off_translate(global float* pixel_pos, float volume_spacing, int mask_size, float origo_x, float origo_y, float origo_z) { int n = get_global_id(0); if (n >= mask_size) return; (pixel_pos[(n)*3 + (0)]) = (int)((pixel_pos[(n)*3 + (0)]) / volume_spacing) - origo_x; (pixel_pos[(n)*3 + (1)]) ...
kernel void lorenzAttractor(int P_length, global float* P, int k_length, global int* k_index, global float* k) { int idx = get_global_id(0); if (idx >= P_length) return; float3 p = vload3(idx, P); float a = k[0]; float b = k[1]; float c = k[2]; float dt = 0.0005; float3 d; d.x = a * (p.y - p.x);...
kernel void testLongRead(global const long* input, global long* output) { int i = get_global_id(0); output[i] = input[i] + 1; }