summaryrefslogtreecommitdiff
path: root/mat_mul.cl
blob: 565a36ff752953a2d045454fb0320adb34a61620 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
__kernel void mat_mul(
   __global int* out,
   int widthA,
   int heightA,
   int widthB,
   int heightB,
   __global int * inputA,
   __global int * inputB)
{
   int row = get_global_id(1);
   int col = get_global_id(0);

   int sum = 0;

   for (int i = 0; i < widthA; i++) {
      sum += inputA[row * widthA + i] * inputB[i * widthB + col];
   }
   out[row * widthB + col] = sum;
}