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/transpose/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 / transpose / kernel.cl` 17 lines ยท 705 bytes Raw Blame History 1 // SPDX-License-Identifier: Apache-2.0 2 // 16x16 tile through __local memory (one padding column against bank conflicts); global is the 3 // tile-rounded (C, R) grid, local (16, 16). 4 #define TS 16 5 __kernel void transpose(__global const float *a, __global float *b, const int R, const int C) 6 { 7 __local float tile[TS][TS + 1]; 8 int tx = get_local_id(0), ty = get_local_id(1); 9 int c0 = get_group_id(0) * TS, r0 = get_group_id(1) * TS; 10 int r = r0 + ty, c = c0 + tx; 11 if (r < R && c < C) 12 tile[ty][tx] = a[r * C + c]; 13 barrier(CLK_LOCAL_MEM_FENCE); 14 int orow = c0 + ty, ocol = r0 + tx; // output b is C x R 15 if (orow < C && ocol < R) 16 b[orow * R + ocol] = tile[tx][ty]; 17 }