Interplane page as plain text, for reading tools and agents. English is the reference text: translate it with your own tool. Text in backticks and in ``` blocks (commands, fingerprints, file names) and link targets in <...> are exact: copy them, never translate them. Page: /drakestapleton/openaccel-lab/blob/main/workloads/rope/kernel.cl # openaccel-lab aien-dev/openaccel-lab Brought by drakestapleton Sign in to star 0 stars 0 watching About Files History Releases Proposed changes Issues For developers 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 }