interplane.Get Omega
Read in your language

openaccel-lab

aien-dev/openaccel-lab

Brought by drakestapleton

branch main Branches Tags History

openaccel-lab / workloads / rope / kernel.cl

17 lines · 606 bytes Raw Blame History
1// SPDX-License-Identifier: Apache-2.0
2// one work-item per rotated pair; n = T*H*h pairs
3__kernel void rope(__global const float *x, __global const float *cs, __global const float *sn,
4 __global float *y, const int n, const int h, const int H)
5{
6 int g = get_global_id(0);
7 if (g < n) {
8 int i = g % h;
9 int th = g / h; // t*H + j
10 int t = th / H;
11 int o = th * 2 * h + i;
12 float c = cs[t * h + i], s = sn[t * h + i];
13 float x1 = x[o], x2 = x[o + h];
14 y[o] = x1 * c - x2 * s;
15 y[o + h] = x1 * s + x2 * c;
16 }
17}