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/gemv/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 / gemv / kernel.cl` 22 lines ยท 830 bytes Raw Blame History 1 // SPDX-License-Identifier: Apache-2.0 2 // One work-item per row; x is staged through __local memory in chunks of 64 shared by the work-group. 3 // global is M rounded up to 64, local 64; every work-item reaches every barrier. 4 #define TS 64 5 __kernel void gemv(__global const float *A, __global const float *x, __global float *y, const int M, const int N) 6 { 7 __local float xs[TS]; 8 int i = get_global_id(0), lid = get_local_id(0); 9 float acc = 0.0f; 10 for (int j0 = 0; j0 < N; j0 += TS) { 11 xs[lid] = (j0 + lid < N) ? x[j0 + lid] : 0.0f; 12 barrier(CLK_LOCAL_MEM_FENCE); 13 if (i < M) { 14 int jn = min(TS, N - j0); 15 for (int j = 0; j < jn; ++j) 16 acc += A[i * N + j0 + j] * xs[j]; 17 } 18 barrier(CLK_LOCAL_MEM_FENCE); 19 } 20 if (i < M) 21 y[i] = acc; 22 }