kernel_code
stringlengths
49
1.22M
kernel void kernel_asinpi_withoutDD1(global float* result_asinpi, int N) { float t1 = -2.3; float t2 = -2.3; float t3 = -2.3; float t4 = -2.3; float t5 = -2.3; float t6 = -2.3; float t7 = -2.3; float t8 = -2.3; float t9 = -2.3; float t10 = -2.3; float i = 0.0; for (i = 0.0; i <= 1.0; i = i + 0...
kernel void asinpi_float2(global float2* src_0, global float2* dst) { int gid = get_global_id(0); dst[gid] = asinpi(src_0[gid]); }
kernel void gt(global int* out, char a, char b) { out[0] = a > b; }
kernel void abs_char2(global char2* src_0, global uchar2* dst) { int gid = get_global_id(0); dst[gid] = (uchar2)(abs(src_0[gid])); }
kernel void ExclusiveLocalScan(global int* block_sums, local int* scratch, const unsigned int block_size, const unsigned int count, global int* data, global int* scan_data) { const unsigned int gid = get_global_id(0); const unsigned int lid = get_local_id(0); if (gid < count) { if (lid == 0) { scratch[...
kernel void kernel_atan2pi_withDD1(global float* result_atan2pi, int N) { float t1 = 2.2; float t2 = 0.01; int i = 0; for (i = 0; i < N; i++) { t1 = atan2pi(t1, t2); t1 = atan2pi(t1, t2); t1 = atan2pi(t1, t2); t1 = atan2pi(t1, t2); t1 = atan2pi(t1, t2); t1 = atan2pi(t1, t2); t1 = ata...
kernel void foo(global float4* A, float4 x) { *A = atanpi(x); }
kernel void kernel_asinpi_withDD1(global float* result_asinpi, int N) { float t1 = 0.43; int i = 0; for (i = 0; i < N; i++) { t1 = asinpi(t1); t1 = asinpi(t1); t1 = asinpi(t1); t1 = asinpi(t1); t1 = asinpi(t1); t1 = asinpi(t1); t1 = asinpi(t1); t1 = asinpi(t1); t1 = asinpi(t1);...
int g(private int m) { return (m + 1); } int f(private int y) { int y0 = y; int y1 = y0; return g(y1); } kernel void brahmaKernel(global int* buf) { buf[0] = f(7); }
kernel void set_boolean_output_rand(global char* last_boolean_output, unsigned int size, unsigned int rand) { for (unsigned int i = get_global_id(0); i < size; i += get_global_size(0)) last_boolean_output[i] = (i == rand); }
typedef float2 float2; kernel void clacpy_kernel(int m, int n, global float2* A, int offset_A, int lda, global float2* B, int offset_B, int ldb) { int row = get_group_id(0) * 64 + get_local_id(0); if (row < m) { A += (offset_A + row); B += (offset_B + row); global float2* Aend = A + lda * n; while (...
kernel void ObjectIDMaskFilterPlugin_Apply(const unsigned int filmWidth, const unsigned int filmHeight, global float* channel_IMAGEPIPELINE, global unsigned int* channel_OBJECT_ID, const unsigned int objectID) { const size_t gid = get_global_id(0); if (gid >= filmWidth * filmHeight) return; const unsigned in...
kernel void abs_ulong16(global ulong16* src_0, global ulong16* dst) { int gid = get_global_id(0); dst[gid] = abs(src_0[gid]); }
kernel void compute(global float4* pParticles, global float4* accel, const unsigned int len, global float8* tParticle) { unsigned int idx = get_global_id(0); if (idx < len) { float4 d = pParticles[idx] - (*tParticle).lo; float invr = rsqrt(d.x * d.x + d.y * d.y + d.z * d.z + 0.000000001); float invr3 ...
kernel void copyKernel4(global const double4* restrict A, global double4* restrict C) { size_t tid = get_global_id(0); C[tid] = A[tid]; }
kernel void readTest(global char* inBuffer, char tag) { int tid = get_global_id(0); inBuffer[tid] |= tag; }
kernel void Integer_addition_20_no(global int* dataArray, long iter, int interval) { global int* curArray = dataArray + get_global_id(0) * interval; int a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19; int addend; a0 = curArray[0]; a1 = curArray[1]; a2 = curArray[2];...
kernel void write_slm(global unsigned int* init_val) { const size_t N = (64 * 1024) / sizeof(unsigned int); local unsigned int slm[N]; unsigned int sublice_header = (get_group_id(0) + 1) << (6 * 4); unsigned int tmp = *init_val; for (int i = 0; i < N; i++) { slm[i] = sublice_header | tmp; tmp = (tmp >...
kernel void compiler_bitcast_long_to_char8(global ulong* src, global uchar8* dst) { int tid = get_global_id(0); ulong v = src[tid]; uchar8 dl = __builtin_astype((v), uchar8); dst[tid] = dl; }
kernel void Invert(global const char* b, global char* c) { int id = get_global_id(0); c[id] = 255 - b[id]; }
; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; kernel void builtin_convert_uint_to_int_sat(global unsigned int* src, global int* dst) { int i = get_global_id(0); dst[i] = convert_int_sat(src[i]); }
kernel void rs(global int* out, int a, int b) { out[0] = a >> b; }
kernel void pastehistograms(global int* restrict histo, const global int* restrict globsum) { int ig = get_global_id(0); int gr = get_group_id(0); int s = globsum[gr]; histo[(ig << 1)] += s; histo[(ig << 1) + 1] += s; }
kernel void compute(global unsigned char* g_num, global unsigned char* g_tables, const unsigned int numTables, global unsigned char* g_answer, const unsigned int num_size) { unsigned int tid = get_global_id(0); if (tid < num_size) { int val = num_size - tid; int i = 0; unsigned char temp = g_num[tid]; ...
kernel void Integer_addition_2_full(global int* dataArray, long iter, int interval) { global int* curArray = dataArray + get_global_id(0) * interval; int a0, a1; int addend; a0 = curArray[0]; a1 = curArray[1]; addend = a0; while (iter-- > 1) { a1 = a0 + addend; a0 = a1 + addend; addend = adden...
kernel void degrees_float16(global float16* src_0, global float16* dst) { int gid = get_global_id(0); dst[gid] = degrees(src_0[gid]); }
int test_function() { return 5; } kernel void test_kernel(global int* out) { out[0] = test_function(); }
constant float kFirst[3] = {1.0f, 2.0f, 3.0f}; constant float kSecond[3] = {10.0f, 11.0f, 12.0f}; kernel void foo(global float* A, int c, int i) { *A = c == 0 ? kFirst[i] : kSecond[i]; }
kernel void compiler_remove_negative_add(global float* src, global float* dst) { int i = get_global_id(0); dst[i] = exp2(-src[i]); }
kernel void mad_hi_long4long4long4(global long4* src_0, global long4* src_1, global long4* src_2, global long4* dst) { int gid = get_global_id(0); dst[gid] = mad_hi(src_0[gid], src_1[gid], src_2[gid]); }
kernel void bsort_init(global float4* g_data, local float4* l_data) { int dir; unsigned int id, global_start, size, stride; float4 input1, input2, temp; int4 comp; uint4 mask1 = (uint4)(1, 0, 3, 2); uint4 mask2 = (uint4)(2, 3, 0, 1); uint4 mask3 = (uint4)(3, 2, 1, 0); int4 add1 = (int4)(1, 1, 3, 3); ...
kernel void CopyBufferBytes(const global uchar* pSrc, global uchar* pDst, unsigned int srcOffsetInBytes, unsigned int dstOffsetInBytes, unsigned int bytesToRead) { unsigned int index = get_global_id(0); pSrc += (srcOffsetInBytes + index); pDst += (dstOffsetInBytes + index); unsigned int lastIndex = bytesToRea...
kernel void normL1(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); ca...
kernel void sum8192Kernel(global const int* x, global int* result) { local int buffer[512]; int gid = get_local_id(0); buffer[gid] = x[gid] + x[gid + 512] + x[gid + 1024] + x[gid + 1536] + x[gid + 2048] + x[gid + 2560] + x[gid + 3072] + x[gid + 3584] + x[gid + 4096] + x[gid + 4608] + x[gid + 5120] + x[gid + 5632]...
kernel void mad_sat_intintint(global int* src_0, global int* src_1, global int* src_2, global int* dst) { int gid = get_global_id(0); dst[gid] = mad_sat(src_0[gid], src_1[gid], src_2[gid]); }
kernel void __cl_copy_region_unalign_same_offset(global int* src, unsigned int src_offset, global int* dst, unsigned int dst_offset, unsigned int size, unsigned int first_mask, unsigned int last_mask) { int i = get_global_id(0); if (i > size - 1) return; if (i == 0) { dst[dst_offset] = (dst[dst_offset] &...
kernel void pointless(global unsigned int* dev_values) { const unsigned int i = get_global_id(0); dev_values[i] += 1; }
kernel void min_char8char8(global char8* src_0, global char8* src_1, global char8* dst) { int gid = get_global_id(0); dst[gid] = min(src_0[gid], src_1[gid]); }
kernel void reduce_std(int total_size, int inner_size, const float eps, global const float* src, global const float* mean, global float* std) { local float sdata[256]; int tid = get_local_id(0); sdata[tid] = (float)0.0f; int blockSize = get_local_size(0); int blockIdx_x = get_group_id(0); for (int j = tid...
kernel void getBufferAddress(global ulong* dataArray) { dataArray[get_global_id(0)] = (ulong)(dataArray); dataArray[get_global_id(0) + 1] = (ulong)(dataArray + 1); }
kernel void vanillaCall(global float* buffer, float strike) { int i = get_global_id(0); buffer[i] = fmax(0.0f, buffer[i] - strike); }
inline float4 polyeval4d(float p0, float p1, float p2, float p3, float p4, float4 x) { return mad(x, mad(x, mad(x, mad(x, p4, p3), p2), p1), p0); } kernel void gpuStress(unsigned int n, const global float4* input, global float4* output, float p0, float p1, float p2, float p3, float p4) { size_t gid = get_global_id...
kernel void ffill(global float* a, float b) { unsigned int i = get_global_id(0); a[i] = b; }
kernel void init_particles_sphere(global unsigned int* particles_pos) { size_t x; x = get_global_id(0); particles_pos[x] = 10.f; }
kernel void reduce_min_buffer(global float* buffer, long length, global float* result) { int index = get_global_id(0); int stride = get_global_size(0); float min = (__builtin_inff()); float max = -(__builtin_inff()); while (index < length) { float value = buffer[index]; min = fmin(min, value); m...
kernel void scalarMultiplication(const float a, global float* b) { int gid = get_global_id(0); for (int i = 0; i < 10000; i++) { for (int j = 0; j < 10000; j++) { b[gid] = a * b[gid]; b[gid] = b[gid] / a; } } b[gid] = a * b[gid]; }
kernel void test_float16(global float* pin, global float* pout) { int x = get_global_id(0); float16 value; value = vload16(x, pin); value += (float16){(float)1, (float)2, (float)3, (float)4, (float)5, (float)6, (float)7, (float)8, (float)9, (float)10, (float)11, (float)12, (float)13, (float)14, (float)15, (floa...
kernel void sqrt_float16(global float16* src_0, global float16* dst) { int gid = get_global_id(0); dst[gid] = sqrt(src_0[gid]); }
float4 sortElem(float4 r) { float4 nr; nr.x = (r.x > r.y) ? r.y : r.x; nr.y = (r.y > r.x) ? r.y : r.x; nr.z = (r.z > r.w) ? r.w : r.z; nr.w = (r.w > r.z) ? r.w : r.z; r.x = (nr.x > nr.z) ? nr.z : nr.x; r.y = (nr.y > nr.w) ? nr.w : nr.y; r.z = (nr.z > nr.x) ? nr.z : nr.x; r.w = (nr.w > nr.y) ? nr.w :...
kernel void test_arg_3_2_kern(global float* a0, global float* a1, global float* a2, 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] + 2.1f; b0[gtid] = (0.0f + 1.1f) * (+tmp0 + tmp1 + tmp2); b1[gtid]...
kernel void helloworld(global char* in, global char* out) { int num = get_global_id(0); out[num] = in[num] + 1; }
kernel void memset_float(global float* mem, float val) { mem[get_global_id(0)] = val; }
kernel void add_redundancy(global float* a) { float b = *a + 0.0; *a = b; }
kernel void incC(global unsigned* input) { const int i = get_global_id(0); if (i == 2) input[i]++; }
kernel void gvn_arbitrary_integers(global int* source, global int* dest) { size_t i = get_global_id(0); int3 tmp = 0; tmp.S2 = source[i]; vstore3(tmp, 0, dest); }
double cmp_abs_sq(double re, double im) { return re * re + im * im; } kernel void mandelbrot(global const double* g_re, global const double* g_im, global double* g_res) { double z_re = 0.0; double z_im = 0.0; int i; double log_zn, nu; global const double *re, *im; global double* res; int gid = get_g...
kernel void variable(global float* input) { const int i = get_global_id(0); if (i == 0) input[i] = input[i] + 1.0f; }
kernel void GEStep3(global float* AI, int i, int n2, int lda2) { int k = get_global_id(0); if (k > i && k < n2) { float multiplyer = -AI[i * lda2 + k]; for (int j = 0; j < i; j++) { AI[j * lda2 + k] += multiplyer * AI[j * lda2 + i]; } } }
kernel void relational_greater_than_shortshort(global short* src_0, global short* src_1, global int* dst) { int gid = get_global_id(0); dst[gid] = (int)(src_0[gid] > src_1[gid]); }
kernel void brahmaKernel(global int* buf) { if ((2 == 0)) { int x = 1; buf[0] = x; } else { int i = 2; buf[0] = i; }; }
void fill(int* out) { *out = 42; } kernel void test(global int* gout, local int* lout) { fill(gout); fill(lout); }
; ; ; ; ; ; ; ; ; ; ; kernel void builtin_convert_int_to_uchar_sat(global int* src, global uchar* dst) { int i = get_global_id(0); dst[i] = convert_uchar_sat(src[i]); }
kernel void abs_short2(global short2* src_0, global ushort2* dst) { int gid = get_global_id(0); dst[gid] = (ushort2)(abs(src_0[gid])); }
kernel void kernel_copysign_withDD1(global float* result_copysign, int N) { float p1 = 1.2; float p2 = -3.4; float p3 = 0.0; int i = 0; for (i = 0; i < N; i++) { p3 += copysign(p1, p2); p2 += copysign(p2, p1); p1 += copysign(p2, p3); p3 += copysign(p1, p2); p2 += copysign(p2, p1); p1 +...
kernel void cpu_mul_add(global const float* vec1, float factor, global const float* float2, global float* result, unsigned int size) { for (unsigned int i = get_global_id(0); i < size; i += get_global_size(0)) result[i] = vec1[i] * factor + float2[i]; }
kernel void multiplyBySave(global float* gridA, global const float* gridB, int const num_elements) { int global_id = get_global_id(0); if (global_id >= num_elements) return; if (isnan(gridA[global_id]) || isinf(gridA[global_id]) || isnan(gridB[global_id]) || isinf(gridB[global_id])) gridA[global_id] = 0;...
kernel void isgreater_floatfloat(global float* src_0, global float* src_1, global int* dst) { int gid = get_global_id(0); dst[gid] = (int)(isgreater(src_0[gid], src_1[gid])); }
kernel void plus(global uchar* out, uchar in) { out[0] = +in; }
kernel void bitonic(global float* xs, int level, int k) { int i = get_global_id(0); int a = i; int b = i + (1 << k); int a1 = a % (1 << (level + 2)); int b1 = b % (1 << (level + 2)); int cut1 = (1 << (level + 1)); int a2 = a % (1 << (k + 2)); int b2 = b % (1 << (k + 2)); int cut2 = (1 << (k + 1)); ...
kernel void copy_kernel(global uchar* destination, const global uchar* source, const uchar element_size) { const int tid = get_global_id(0); for (int i = 0; i < element_size; ++i) { destination[tid * element_size + i] = source[tid * element_size + i]; } }
kernel void IntersectionRP(const global float* vertex, const global float* dir, const global float* o, const global float* bounds, global unsigned char* tHit, int count, int size) { int iGID = get_global_id(0); if (iGID >= size) return; float4 e1, e2, s1, s2, d; float divisor, invDivisor, b1, b2, t; flo...
float d2_dxy2(global float* pop, int row, int column) { float retval; int current = row * ((16) * (1024 / 16)) + column; int left = row * ((16) * (1024 / 16)) + column - 1; int right = row * ((16) * (1024 / 16)) + column + 1; int top = (row - 1) * ((16) * (1024 / 16)) + column; int bottom = (row + 1) * ((1...
kernel void kernel_memory_alignment_private(global unsigned int* results) { private char mem0[3]; private char2 mem2[3]; private char3 mem3[3]; private char4 mem4[3]; private char8 mem8[3]; private char16 mem16[3]; results[0] = (unsigned int)&mem0[0]; results[1] = (unsigned int)&mem2[0]; results...
kernel void run2dBuf(global short* input, global short* output, const int Nx, const int Ny, const int FSIZE, const int BSIZE, const float SIGMA) { const sampler_t sampler = 0 | 2 | 0x10; unsigned int i0 = get_global_id(0); unsigned int i = i0 % Nx; unsigned int j = i0 / Nx; unsigned int pix0 = input[i + j ...
kernel void foo(global float3* A, global float3* B, float3 x) { float3 z; *A = fract(x, &z); *B = z; }
kernel void sample(global float* A, global float* B, global float* C) { int base = 4 * get_global_id(0); C[base + 0] = A[base + 0] + B[base + 0]; C[base + 1] = A[base + 1] - B[base + 1]; C[base + 2] = A[base + 2] * B[base + 2]; C[base + 3] = A[base + 3] / B[base + 3]; }
kernel void FillBufferInt(global int* buffer, const int value) { const int index = get_global_id(0); if (index < get_global_size(0)) { buffer[index] = value; } }
kernel void test(float global* a, const int n) { for (int i = 0; i < 10; i++) a[i] += 1; }
kernel void unit_upper_solve(global const float* A, unsigned int A_rows, unsigned int A_cols, unsigned int A_internal_rows, unsigned int A_internal_cols, global float* B, unsigned int B_rows, unsigned int B_cols, unsigned int B_internal_rows, unsigned int B_internal_cols) { float temp; for (int row = A_rows - 1; ro...
kernel void test_arg_1_1_kern(global int4* a0, global int4* b0) { int4 za = (int4)(0, 1, 2, 3); unsigned int gtid = get_global_id(0); int4 tmp0 = a0[gtid] + 0 + za; b0[gtid] = (0 + 1) * (+tmp0); }
kernel void kernel_sub_withDD1(global float* result_sub, int N) { float t1 = 99999.9; float t2 = 0.1; int i = 0; for (i = 0; i < N; i++) { t1 -= t2; t1 -= t2; t1 -= t2; t1 -= t2; t1 -= t2; t1 -= t2; t1 -= t2; t1 -= t2; t1 -= t2; t1 -= t2; t1 -= t2; t1 -= t2; ...
kernel void sub_sat_long8long8(global long8* src_0, global long8* src_1, global long8* dst) { int gid = get_global_id(0); dst[gid] = sub_sat(src_0[gid], src_1[gid]); }
kernel void test6(global int* A, global int* B) { unsigned sum = 0; for (int i = 0; i < 1024; ++i) if (A[i] > B[i]) sum += A[i] + 5; *B = sum; }
kernel void gaussianFilter(global const float* fft, global float* out, int n, float gwidthFactor, float dt, global float* gaussVals) { int i = get_global_id(0); if (2 * i >= n) return; float df = 1 / (n * dt); float omega; float gauss; if (i == 0) { gauss = 1; } else { omega = i * 2 * 3.14159...
kernel void cl_contrast_curve(global const float2* in, global float2* out, global float* curve, int num_sampling_points) { int gid = get_global_id(0); float2 in_v = in[gid]; int idx = (int)fmin(num_sampling_points - 1.0f, fmax(0.0f, in_v.x * num_sampling_points)); out[gid] = (float2)(curve[idx], in_v.y); }
kernel void set_buffer_to_zero(global float* w) { w[get_global_id(0)] = 0.0; }
kernel void test_arg_2_3_kern(global float4* a0, global float4* a1, global float4* b0, global float4* b1, global float4* b2) { float4 za = (float4)(0.75f, 0.5f, 0.25f, 0.33f); unsigned int gtid = get_global_id(0); float4 tmp0 = a0[gtid] + 0.1f + za; float4 tmp1 = a1[gtid] + 1.1f + za; b0[gtid] = (0.0f + 1.1f)...
kernel void csquares(global float* out, global float* in) { int i = get_global_id(0); out[i] = in[i] * in[i]; }
kernel void power(global float* grid, const float exponent, int const num_elements) { int global_id = get_global_id(0); if (global_id >= num_elements) return; grid[global_id] = pow(grid[global_id], exponent); }
kernel void compiler_rem_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 GenerateNoise(float base, float fine, global float* rands, int length) { int gid = get_global_id(0); if (gid >= length) { return; } rands[gid] = base * gid + fine / (base + gid) + 1 / gid; }
kernel void SimpleFunction(global float* input1, global float* input2, global float* output, int count) { int i = get_global_id(0); if (i >= count) return; output[i] = input1[i] + input2[i]; }
kernel void compiler_array2(global int* src, global int* dst) { int final[16]; int array[16]; for (int j = 0; j < 16; ++j) array[j] = j; for (int j = 0; j < 16; ++j) final[j] = j + 1; if (get_global_id(0) == 15) dst[get_global_id(0)] = final[get_global_id(0)]; else dst[get_global_id(0)] = ar...
kernel void rand(global double* a, global double* b, global long* c, global long* d, unsigned char com) { unsigned long i = get_global_id(0); a[i] = fabs((c[i] >> 11) * 0x1.0p-52); if (com) { b[i] = fabs((d[i] >> 11) * 0x1.0p-52); } }
kernel void test_clamp(global ulong3* out, global ulong3* in) { *out = clamp(*in, (ulong3)7, (ulong3)42); }
kernel void bar(global float* R, global float* S, global float* T, float x, float y) { *R = x * y; *S = x / y; *T = x; }
kernel void bitonicSort(global unsigned int* data, const unsigned int stage, const unsigned int subStage, const unsigned int direction) { unsigned int threadId = get_global_id(0); unsigned int sortIncreasing = direction; unsigned int distanceBetweenPairs = 1 << (stage - subStage); unsigned int blockWidth = dis...
kernel void cl_stretch_contrast(global const float4* in, global float4* out, float4 min, float4 diff) { int gid = get_global_id(0); float4 in_v = in[gid]; in_v = (in_v - min) / diff; out[gid] = in_v; }
float length3(float4 vec) { return sqrt(vec.x * vec.x + vec.y * vec.y + vec.z * vec.z); } float4 normalize3(float4 vec) { float4 retv; float magi = length3(vec); magi = magi < 1.e-8 ? 1. : 1. / magi; retv.xyz = vec.xyz * magi; retv.w = vec.w; return retv; } kernel void rules1(global float4* pos, global f...
kernel void post_decrement_ushort8(global ushort8* src_0, global ushort8* dst) { int gid = get_global_id(0); dst[gid] = src_0[gid]--; }