interplane.Get Omega
Read in your language

openaccel-lab

aien-dev/openaccel-lab

Brought by drakestapleton

branch main Branches Tags History

openaccel-lab / workloads / tmatmul16 / kernel.cl

17 lines · 620 bytes Raw Blame History
1// SPDX-License-Identifier: Apache-2.0
2// One work-group of 256 per 16x16 tile; A and B are staged in local memory, C[i][j] = sum_k A[i][k] B[k][j].
3__kernel void tmatmul16(__global const float *a, __global const float *b, __global float *c, const int tiles)
4{
5 __local float la[256];
6 __local float lb[256];
7 int t = get_group_id(0);
8 int l = get_local_id(0);
9 int i = l / 16, j = l % 16;
10 la[l] = a[t * 256 + l];
11 lb[l] = b[t * 256 + l];
12 barrier(CLK_LOCAL_MEM_FENCE);
13 float s = 0.0f;
14 for (int k = 0; k < 16; k++)
15 s += la[i * 16 + k] * lb[k * 16 + j];
16 c[t * 256 + l] = s;
17}