[GpuParam] private readonly int Thread;
[GpuParam] private readonly int Block;
public void KernelMatrix(int[,] a,int[,] b,int[,] c)
{
var thrX = blockIdx.x * Thread + threadIdx.x;
var thrY = blockIdx.y * Thread + threadIdx.y;
int val = 0;
for(int i = 0;i<Thread;i++)
{
val = 0;
for (int k=0;k<Thread;k++)
{
val += b[thrX,k] * a[k, thrY];
}
//Problem maybe originate from here but I dont know how to fix it.
c[thrY,thrX] = val;
}
}
它工作但不正确,由于某种原因,在将2X1和1X2之类的东西相乘时,它只给出2 16而不是4 16。