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/tmatmul16/kernel.cu # 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 / tmatmul16 / kernel.cu` 24 lines ยท 785 bytes Raw Blame History 1 // SPDX-License-Identifier: Apache-2.0 2 #include 3 4 // One 16x16 block per tile; A and B are staged in shared memory, C[i][j] = sum_k A[i][k] B[k][j]. 5 __global__ void tmatmul16(const float *a, const float *b, float *c) 6 { 7 __shared__ float la[256]; 8 __shared__ float lb[256]; 9 long long t = blockIdx.x; 10 int i = threadIdx.y, j = threadIdx.x, l = i * 16 + j; 11 la[l] = a[t * 256 + l]; 12 lb[l] = b[t * 256 + l]; 13 __syncthreads(); 14 float s = 0.0f; 15 for (int k = 0; k < 16; k++) 16 s += la[i * 16 + k] * lb[k * 16 + j]; 17 c[t * 256 + l] = s; 18 } 19 20 void oal_launch(const long long *p, void *const *buf) 21 { 22 long long tiles = p[0]; 23 tmatmul16<<<(unsigned)tiles, dim3(16, 16)>>>((const float *)buf[0], (const float *)buf[1], (float *)buf[2]); 24 }