kernel_code
stringlengths
49
1.22M
kernel void multiply_int4int4(global int4* src_0, global int4* src_1, global int4* dst) { int gid = get_global_id(0); dst[gid] = src_0[gid] * src_1[gid]; }
kernel void test_select_write_address_simple(const global int* in, global int* out0, global int* out1) { unsigned int gid = (unsigned int)get_global_id(0); global int* ptr = (gid & 1) ? out1 : out0; int tmp = in[gid]; ptr[gid] = tmp + 17; }
kernel void test_float(float f, float4 f2, global float* out) { *out = f; vstore4(f2, 4, out); }
kernel void kernel_erf_withoutDD1(global float* result_erf, int N) { float t1 = 1.23; float t2 = 1.23; float t3 = 1.23; float t4 = 1.23; float t5 = 1.23; float t6 = 1.23; float t7 = 1.23; float i = 1.0; for (i = 1.0; i < N; i = i + 1.0) { t1 = erf(i + 0.1); t2 = erf(i + 0.2); t3 = erf(i +...
kernel void loop_gt(global int* out, int iterations) { int i; int ai = 0; for (i = iterations - 1; i > -1; i--) { out[ai] = i; ai = ai + 1; } }
kernel void vecinit(global int* restrict v1, global int* restrict v2, int nels) { const int i = get_global_id(0); if (i >= nels) return; v1[i] = i; v2[i] = nels - i; }
double2 when_eq(double2 x, double2 y) { return 1.0f - fabs(sign(x - y)); } double when_neq(double x, double y) { return fabs(sign(x - y)); } double2 when_gt(double2 x, double2 y) { return max(sign(x - y), 0.0); } double2 when_lt(double2 x, double2 y) { return min(1.0f - sign(x - y), 1.0f); } double2 when_ge(...
void complex_mul(double* a, double* b, double c, double d) { double e, f, g, h; g = a[0]; h = b[0]; e = g * c - h * d; f = g * d + h * c; a[0] = e; b[0] = f; } void calc_poly(double r, double i, double* a, double* b, global double* rpoly, global double* ipoly, unsigned long col) { a[0] = 0.0; b[0] = ...
kernel void gpuvfi(global float* V0, global float* V, global const float* grid, const int grid_size) { int gid = get_global_id(0); float alpha = 0.5f; float beta = 0.7f; float grid_p = grid[gid]; float V_tmp = -(__builtin_inff()); float u_arg; float V_new; for (int i = 0; i <= grid_size; i++) { ...
kernel void BFS_kernel_warp(global unsigned int* levels, global unsigned int* edgeArray, global unsigned int* edgeArrayAux, int W_SZ, int CHUNK_SZ, unsigned int numVertices, int curr, global int* flag) { int tid = get_global_id(0); int W_OFF = tid % W_SZ; int W_ID = tid / W_SZ; int v1 = W_ID * CHUNK_SZ; int c...
kernel void postinc(global long* out, long in) { out[0] = in++; }
kernel void compact_compact(global int* data, global int* pred, global int* prefSum) { int id = get_global_id(0); int val = data[id]; barrier(0x02); if (pred[id] == 1) { data[prefSum[id]] = val; } }
constant int cArray1[3] = {1, 2, 3}; kernel void brahmaKernel(global int* buf) { buf[0] = cArray1[1]; }
kernel void frameDiffFloatFloat(global float* v, global float* v2) { unsigned int i = get_global_id(0); if (abs((int)(v[i] - v2[i])) < 20) { v[i] = 0; } }
kernel void rgb2hsv_pkd(global unsigned char* input, global double* output, const unsigned int height, const unsigned int width) { int id = get_global_id(0); double r, g, b, min, max, delta; id = id * 3; if (id < 3 * height * width) { r = input[id] / 255.0; g = input[id + 1] / 255.0; b = input[id +...
kernel void test1(global float a[], global float b[]) { for (int i = 0; i < 1000; i++) { a[i] = -i; b[i] = -i; } }
kernel void expm1_float4(global float4* src_0, global float4* dst) { int gid = get_global_id(0); dst[gid] = expm1(src_0[gid]); }
kernel void part1(global int* a, global int* c) { unsigned int i = get_global_id(0); c[i] = a[i]; }
kernel void SkipForward(global float* output, global float* input, const int nUnits, const int miniBatchSize) { const int iActivation = get_global_id(0); if (iActivation < miniBatchSize * nUnits) { output[iActivation] += input[iActivation]; } }
kernel void test_block_1_7_kern(global float* a0, global float* b0, global float* b1, global float* b2, global float* b3, global float* b4, global float* b5, global float* b6, 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); c...
kernel void compiler_array4(global int4* src4, global int4* dst4, int offset) { int i; int final[16]; global int* dst = (global int*)(dst4 + offset + get_global_id(0)); global int* src = (global int*)(src4 + offset + get_global_id(0)); dst[-4] = src[-4]; }
kernel void calculateMatrix(global float* matInit, global float* matFinale, const float nombreLignes, const float nombreColonnes, const float nombrePasTemps, const float tempsDiscretise, const float tailleSubdivision) { int globalID = get_global_id(0); int nombreLines = (int)nombreLignes; int nombreCol = (int)nom...
kernel void Pad(global const float* restrict in_data, global float* restrict out_data, 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, int in_n, int in_c, int in_h, int in_w, int img_offset) { out_data += img_offset; const i...
kernel void min_short16short16(global short16* src_0, global short16* src_1, global short16* dst) { int gid = get_global_id(0); dst[gid] = min(src_0[gid], src_1[gid]); }
struct tree_global { volatile int nextNode; volatile int activeNodes; int depth; int pad; }; void insertPoint(global int* entries, const unsigned int pointIdx); int childIndex(float4 delta); float4 childDirection(int idx); float roundPow2(float val); void insertPoint(global int* entries, const unsigned int po...
kernel void vglClCumSum(global int* cumsum, int size) { int index = get_global_id(0); int global_size = get_global_size(0) * 2; int offset = 1; for (int d = global_size >> 1; d > 0; d >>= 1) { if (index < d) { int ai = offset * (2 * index + 1) - 1; int bi = offset * (2 * index + 2) - 1; c...
kernel void col2im(const int n, global const float* data_col, const int data_col_off, const int channels, const int height, const int width, const int kernel_h, const int kernel_w, const int pad_h, const int pad_w, const int stride_h, const int stride_w, const int dilation_h, const int dilation_w, const int height_col,...
kernel void s_vector_sum_sqrt(global float* g_idata, global float* g_odata, unsigned int n) { int i = get_local_id(0); if (i == 0) { for (int j = 0; j < n; j++) g_odata[0] += g_idata[j]; } if (i == 0) g_odata[0] = sqrt(g_odata[0]); }
kernel void set_array(global float* src, float val) { int gid = get_global_id(0); src[gid] = val; }
kernel void test_udiv(const int num, global const unsigned int* in, global unsigned int* out) { int offset = num * get_global_id(0); for (int i = 0; i < num; ++i) { for (int j = 0; j < num; ++j) { out[offset + i * num + j] = in[i] / in[j]; } } }
kernel void compiler_double_div_uniform(double src1, double src2, double tmp, global double* dst) { tmp = src1 / src2; dst[0] = tmp; }
kernel void butterfly_hard_float(global float2* in, int iter, global float2* twiddle) { unsigned indx = get_global_id(0); unsigned size = get_global_size(0); int pairDistance = 1 << iter; int blockWidth = 2 * pairDistance; int nGroups = size >> iter; int butterflyGrpOffset = indx & (pairDistance - 1); i...
kernel void test_char16(global char* pin, global char* pout) { int x = get_global_id(0); char16 value; value = vload16(x, pin); value += (char16){(char)1, (char)2, (char)3, (char)4, (char)5, (char)6, (char)7, (char)8, (char)9, (char)10, (char)11, (char)12, (char)13, (char)14, (char)15, (char)16}; vstore16(val...
kernel void kernel_modf_withoutDD1(global float* result_modf, int N) { float t1; float t2; float t3; float t4; float t5; float t6; float t7; float t8; float t9; float t10; float i = 0.0; float j; float n = 0.3 * (float)(N); for (i = 0.0; i < n; i = i + 0.01) { t1 = modf(i, &j); t2 ...
kernel void dot_product(global const float4* a, global const float4* b, global float* c) { int gid = get_global_id(0); float ax = a[gid].x; float ay = a[gid].y; float az = a[gid].z; float aw = a[gid].w; float bx = b[gid].x, by = b[gid].y, bz = b[gid].z, bw = b[gid].w; barrier(0x01); c[gid] = ax * bx...
kernel void compute_next_record_index(global int* nextRecordIndex, unsigned int buffer_size) { if (get_global_id(0) == 0) { *nextRecordIndex++; *nextRecordIndex %= buffer_size; } }
kernel void clkernel_divide_scalar_xmat(const int num, const float x, global const float* in1, global float* out) { const int i = get_global_id(0); if (i >= num) return; out[i] = x / in1[i]; }
int Index(int Y, int X, int H, int W) { return (Y * W) + X; } int IndexTranspose(int Y, int X, int H, int W) { return (X * H) + Y; } bool IsInside(int Y, int X, int H, int W) { if ((Y >= 0) && (Y < H)) { if ((X >= 0) && (X < W)) { return true; } else { return false; } } return false;...
kernel void add(global float* a, global float* b, global float* c) { *c = *a + *b; }
kernel void smoothstep_floatfloatfloat(global float* src_0, global float* src_1, global float* src_2, global float* dst) { int gid = get_global_id(0); dst[gid] = smoothstep(src_0[gid], src_1[gid], src_2[gid]); }
kernel void test_arg_1_6_kern(global float* a0, global float* b0, global float* b1, global float* b2, global float* b3, global float* b4, global float* b5) { unsigned int gtid = get_global_id(0); float tmp0 = a0[gtid] + 0.1f; b0[gtid] = (0.0f + 1.1f) * (+tmp0); b1[gtid] = (1.0f + 1.1f) * (+tmp0); b2[gtid] = (...
kernel void BitonicSort(global unsigned int* data, unsigned int inc, unsigned int boxwidth) { unsigned int id = get_global_id(0); unsigned int low = id & (inc - 1); unsigned int i = (id << 1) - low; bool asc = (i & boxwidth) == 0; data += i; unsigned int x0 = data[0]; unsigned int x1 = data[inc]; if...
kernel void nbody_kern(float dt1, float eps, global float4* pos_old, global float4* pos_new, global float4* vel, local float4* pblock) { const float4 dt = (float4)(dt1, dt1, dt1, 0.0f); int gti = get_global_id(0); int ti = get_local_id(0); int n = get_global_size(0); int nt = get_local_size(0); int nb = n...
kernel void rdft(global float* x) { int N = (get_global_size(0) - 1) * 2; int num_vectors = N / 4; float X_real = 0.0f; float X_imag = 0.0f; float4 input, arg, w_real, w_imag; float two_pi_k_over_N = 2 * 3.14159265358979323846264338327950288f * get_global_id(0) / N; for (int i = 0; i < num_vectors; i++) ...
kernel void foobar(global int* x) { const int gid = get_global_id(0); x[gid] = gid; }
kernel void time_step(global float4* params, global float4* force, global float4* oldpos, global float4* oldvel, global float4* newpos, global float4* newvel, float time) { int i = get_global_id(0); bool fixed = 0 < params[i].x; if (fixed) { return; } float mass = params[i].y; float4 acc = force[i] / ...
unsigned int scanwarp(unsigned int val, volatile local unsigned int* sData, int maxlevel) { int localId = get_local_id(0); int idx = 2 * localId - (localId & (32 - 1)); sData[idx] = 0; idx += 32; sData[idx] = val; if (0 <= maxlevel) { sData[idx] += sData[idx - 1]; } if (1 <= maxlevel) { sData[i...
kernel void test_mad24(const global int* in0, const global int* in1, const global int* in2, global int* out) { unsigned int gid = get_global_id(0); out[gid] = (int)mad24((short)in0[gid], (short)in1[gid], (short)in2[gid]); }
kernel void treat_axis_c(global double2* arr, unsigned int Nx) { unsigned int i_cell = (unsigned int)get_global_id(0); if (i_cell < Nx) { arr[i_cell + Nx].s0 -= arr[i_cell].s0; arr[i_cell + Nx].s1 -= arr[i_cell].s1; } }
kernel void ref(global int* out) { int a = 5; int* b = &a; out[0] = *(&a); out[1] = *b; out[2] = *out; }
kernel void amdInterleaveFFTBlock(global const float* in, global float* out) { int glbl_id = get_global_id(0); out[glbl_id * 2] = in[glbl_id]; out[glbl_id * 2 + 1] = 0; }
kernel void init_beta_dev(int nstates, global float* beta_d, int offset, float scale) { unsigned int idx = get_group_id(0) * get_local_size(0) + get_local_id(0); if (idx < nstates) { beta_d[offset + idx] = 1.0f / scale; } }
kernel void initInputBuffer(global float* buff) { int idx = get_global_id(0); buff[idx] = 0; }
kernel void Initialise(global float4* A, const float x) { int pos = get_global_id(0); A[pos] = x; }
kernel void isnan_float2(global float2* src_0, global int2* dst) { int gid = get_global_id(0); dst[gid] = (int2)(isnan(src_0[gid])); }
kernel void compiler_half_to_ushort_sat(global float* src, global ushort* dst) { int i = get_global_id(0); dst[i] = convert_ushort(src[i]); }
kernel void brahmaKernel(global int* buf) { while (((buf[0] < 5) && ((buf[1] < 6) || (buf[2] > 2)))) { buf[0] = 1; }; }
kernel void processNineCellWindow(global float* scanLine1, global float* scanLine2, global float* scanLine3, global uchar4* resultLine, global float* rasterParams) { const int i = get_global_id(0); float x11 = scanLine1[i]; float x12 = scanLine1[i + 1]; float x13 = scanLine1[i + 2]; float x21 = scanLine2[i];...
kernel void division_assignment_scalar(global double* a, const double b, const int n) { int i = get_global_id(0); if (i > n) return; a[i] /= b; }
kernel void linspace_f32(unsigned int length, global float* out, float start, float step) { const unsigned int id = get_global_id(0); if (id < length) { out[id] = start + step * ((float)id); } }
kernel void test(global char* buf, char val) { int tid = get_global_id(0); buf[tid] += val; }
union BufferType { float f; unsigned int u; }; kernel void updatePosition(global float4* pointPosition, global float4* pointAcceleration, global float4* pointVelocity, const int numPoints, const float t, const float damping, const float maxSpeed) { int p = get_global_id(0); if (p >= numPoints) return; f...
kernel void isgreaterequal_float4float4(global float4* src_0, global float4* src_1, global int4* dst) { int gid = get_global_id(0); dst[gid] = (int4)(isgreaterequal(src_0[gid], src_1[gid])); }
kernel void relational_less_than_uint8uint8(global uint8* src_0, global uint8* src_1, global int8* dst) { int gid = get_global_id(0); dst[gid] = (int8)(src_0[gid] < src_1[gid]); }
kernel void square(global float* input_output) { size_t id = get_global_id(0); float value = input_output[id]; input_output[id] = value * value; }
kernel void relational_greater_than_uint8uint8(global uint8* src_0, global uint8* src_1, global int8* dst) { int gid = get_global_id(0); dst[gid] = (int8)(src_0[gid] > src_1[gid]); }
kernel void kernel_sub_withoutDD1(global float* result_sub, int N) { float t1 = 9999.0; float t2 = 9999.0; float t3 = t1; float t4 = t3; float t5 = t4; float t6 = t5; float t7 = t6; float t8 = t7; float t9 = t8; float t10 = t9; float t11 = t3; float t12 = t3; float t13 = t1; float t14 = t3; ...
kernel void d_vector_add(global const double* a, global const double* b, global double* c, int iNumElements) { int i = get_global_id(0); if (i < iNumElements) { c[i] = a[i] + b[i]; } }
kernel void assignGlobalMany(global int* A, global int* B, global int* C) { int tid = get_global_id(0); for (int i = 0; i < 1024; i++) C[tid] += A[tid]; }
__attribute__((num_compute_units(4))) kernel void calc_hsv(global char* restrict bgr32f, const int widthStep, int height, int width) { int groups = get_num_groups(0); int tamGroup = get_local_size(0); int base = get_group_id(0); int lid = get_local_id(0); float h, b, g, r, min, max, delta; int despH, despS,...
kernel void kernel_fract_withoutDD1(global float* result_fract, int N) { float t1 = 1.0; float t2 = 1.0; float t3 = 1.0; float t4 = 1.0; float t5 = 1.0; float t6 = 1.0; float t7 = 1.0; float t8 = 1.0; float t9 = 1.0; float t10 = 1.0; float i = 0.0; float j; float n = 10 * N; for (i = 0.0; ...
kernel void test_branches(const global int* in, global int* out) { int tmp = *in; int result; bool test = tmp > 100; out[2] = tmp; if (tmp > 1000) { result = 1000; out[3] = result; } else if (test) { result = 100; out[3] = result; } else { result = 10; out[3] = result; } out[4...
kernel void foo(global float4* A, float4 x, float4 y) { *A = fmod(x, y); }
kernel void test_block_1_1_kern(global float* a0, global float* b0, 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 tmp0 = 0; for (i = 0; i < lsz; i++) tmp0 += c0[i];...
kernel void vec_add_half(global short* in1, global short* in2, global short* out) { int index = get_global_id(0); out[index] = in1[index] + in2[index]; }
kernel void naive_reduction(global float* data, global float* output) { float sum = 0.0; int lid = get_local_id(0); if (get_global_id(0) == 0) { for (int i = 0; i < 1048576; i++) { sum += data[i]; } } *output = sum; }
kernel void isnormal_float16(global float16* src_0, global int16* dst) { int gid = get_global_id(0); dst[gid] = (int16)(isnormal(src_0[gid])); }
kernel void reduce(global uint4* input, global uint4* output, local uint4* sdata) { unsigned int tid = get_local_id(0); unsigned int bid = get_group_id(0); unsigned int gid = get_global_id(0); unsigned int localSize = get_local_size(0); sdata[tid] = input[gid]; barrier(0x01); for (unsigned int s = local...
kernel void add3(global float* a, global float* b, global float* out) { int id = get_global_id(0); out[id] = a[id] + b[id]; }
kernel void simple_kernel_2(const unsigned int arg0, global unsigned int* dst) { unsigned int idx = get_global_id(0); dst[idx] = arg0; }
kernel void atomic_minmax_signed(global int* data) { atomic_min(data + 0, -8); atomic_min(data + 1, -6); atomic_min(data + 2, 3); atomic_min(data + 3, -3); atomic_min(data + 4, 6); atomic_min(data + 5, 8); atomic_max(data + 6, -8); atomic_max(data + 7, -6); atomic_max(data + 8, 3); atomic_max(data ...
kernel void brahmaKernel(global int* buf) { int f1 = 5; int f0 = f1; int f = f0; buf[0] = f; }
kernel void reduce_min(global const int* A, global int* B, local int* scratch) { int id = get_global_id(0); int lid = get_local_id(0); int N = get_local_size(0); scratch[lid] = A[id]; barrier(0x01); for (int i = 1; i < N; i *= 2) { if (!(lid % (i * 2)) && ((lid + i) < N)) { if (scratch[lid] > s...
kernel void bitselect_ulong16ulong16ulong16(global ulong16* src_0, global ulong16* src_1, global ulong16* src_2, global ulong16* dst) { int gid = get_global_id(0); dst[gid] = bitselect(src_0[gid], src_1[gid], src_2[gid]); }
kernel void assignLocalMany(global int* A, global int* B, global int* C) { int tid = get_global_id(0); int total = 0; for (int i = 0; i < 1024; i++) total += i; C[tid] = total; }
kernel void simple_kernel(global float* d_y, global const float* d_x, const int num) { const int id = get_global_id(0); if (id < num) { float x = d_x[id]; float sin_x = sin(x); float cos_x = cos(x); d_y[id] = (sin_x * sin_x) + (cos_x * cos_x); } }
kernel void compute_trap_acceleration(const global float* xGlob, const global float* yGlob, const global float* zGlob, const global float* charge, const global float* mass, float kx, float ky, float kz, float cosTheta, float sinTheta, int nPtcls, global float* axGlob, global float* ayGlob, global float* azGlob) { priv...
kernel void histo_final_kernel(unsigned int sm_range_min, unsigned int sm_range_max, unsigned int histo_height, unsigned int histo_width, global unsigned int* global_subhisto, global unsigned int* global_histo, global unsigned int* global_overflow, global unsigned int* final_histo) { unsigned int blockDimx = get_loca...
kernel void prescan(global unsigned int* const a, global unsigned int* const sums, local unsigned int* const tmp, const unsigned int n) { const size_t gid = get_global_id(0), lid = get_local_id(0), wgs = get_local_size(0); tmp[2 * lid] = 2 * gid < n ? a[2 * gid] : 0; tmp[2 * lid + 1] = 2 * gid + 1 < n ? a[2 * gi...
kernel void Sasum_slm_reduction(int n, global float* x, int incx, global float* result) { const int lid = get_local_id(0); const int gid = get_group_id(0); const int gnum = get_num_groups(0); const int ind = get_global_id(0); const int lsz = get_local_size(0); local float local_sum[256]; local_sum[lid] ...
kernel void nbody_kernel(global float* curPos, global float* curVel, int numBodies, float deltaTime, int epsSqr, local float* localPos, global float* nxtPos, global float* nxtVel) { unsigned int tid = get_local_id(0); unsigned int gid = get_global_id(0); unsigned int localSize = get_local_size(0); unsigned int...
kernel void reduction_scalar(global float* data, local float* partial_sums, global float* output) { int lid = get_local_id(0); int gsize = get_local_size(0); partial_sums[lid] = data[get_global_id(0)]; barrier(0x01); for (int i = gsize / 2; i > 0; i >>= 1) { if (lid < i) { partial_sums[lid] += par...
bool doTrianglesIntersect_EdgeShared(const float4 p00, const float4 p01, const float4 p02, const float4 p10, const float4 p11, const float4 p12) { float4 e1 = p01 - p00; float4 e2 = p02 - p00; float4 e3 = p12 - p00; float4 t1 = cross(e1, e2); float d = dot(e3, t1); if (d != 0) return false; float4 ...
kernel void rsqrt_float4(global float4* src_0, global float4* dst) { int gid = get_global_id(0); dst[gid] = rsqrt(src_0[gid]); }
kernel void MulIndex(global float* input, global float* output) { unsigned int index = get_global_id(0); output[index] = input[index] * (float)index; }
kernel void gpu_memcpy_2(global float2* dest, global float2* source) { int x = get_global_id(0); int size = get_global_size(0); dest[x] = source[x]; dest[x + size] = source[x + size]; dest[x + size * 2] = source[x + size * 2]; dest[x + size * 3] = source[x + size * 3]; dest[x + size * 4] = source[x + size...
kernel void relational_less_than_or_equal_to_int2int2(global int2* src_0, global int2* src_1, global int2* dst) { int gid = get_global_id(0); dst[gid] = src_0[gid] <= src_1[gid]; }
kernel void kernel_fabs_withoutDD1(global float* result_fabs, int n) { float p1 = -2.3; float p2 = -2.3; float p3 = -2.3; float p4 = -2.3; float p5 = -2.3; float p6 = -2.3; float p7 = -2.3; float p8 = -2.3; float p9 = -2.3; float p10 = -2.3; float p11 = -2.3; float p12 = -2.3; float p13 = -2.3...
kernel void jacobi_2d(global float* restrict A, int n) { int i, j, t; for (t = 0; t < n; t++) { for (i = 1; i < n - 1; i++) { for (j = 1; j < n - 1; j++) { A[i * n + j] = 0.2 * (A[i * n + j] + A[i * n + j - 1] + A[i * n + 1 + j] + A[(1 + i) * n + j] + A[(i - 1) * n + j]); } } } ret...
kernel void kernel_exp_withoutDD1(global float* result_exp, int N) { float t1 = 1.1; float t2 = 1.1; float t3 = t1; float t4 = t3; float t5 = t4; float t6 = t5; float t7 = t6; float t8 = t7; float t9 = t8; float t10 = t9; float t11 = 1.1; float t12 = 1.1; float p = 0.0; for (p = 0.0; p < 0....