Start on the matrix multiplication kernel

This commit is contained in:
Darren VanBuren 2017-08-16 06:21:46 -07:00
parent 42b2451d22
commit 7e58dc842b
3 changed files with 89 additions and 11 deletions

15
fresh_kernel.cl Normal file
View file

@ -0,0 +1,15 @@
#pragma OPENCL EXTENSION cl_khr_byte_addressable_store : enable
__kernel void matrix_mult(__global float* C, __global float* A, __global float* B, int widthA, int widthB) {
int x = get_global_id(0);
int y = get_global_id(1);
float value = 0;
for(int k = 0; k < widthA; k++) {
float elemA = A[y * widthA + k];
float elemB = B[k * widthB + x];
value += (elemA * elemB);
}
C[y * widthA + x] = value;
}