[llvm-dev] Matrix Multiplication not Vectorized using double pointers

hameeza ahmed via llvm-dev llvm-dev at lists.llvm.org
Sun Oct 20 00:31:49 PDT 2019


Hello,
My matrix multiplication code has variables allocated via double pointers
on heap. The code is not getting vectorized. Following is the code.

 int **buffer_A = (int **)malloc(vecsize * sizeof(int *));
 int **buffer_B = (int **)malloc(vecsize * sizeof(int *));
for(p = 0; p < vecsize; p++)
    {
         buffer_A[p] = (int *)malloc(vecsize * sizeof(int));
     }
for(p = 0; p < vecsize; p++)
    {
         buffer_B[p] = (int *)malloc(vecsize * sizeof(int));
     }
    long i, j, k;
 int **result = (int **)malloc(vecsize * sizeof(int *));
    for(p = 0; p < vecsize; p++)
    {
         result[p] = (int *)malloc(vecsize * sizeof(int));
     }
    for(i = 0; i < vecsize; i++)
    {
        for(j = 0; j < vecsize; j++)
        {
         result[i][j]=0;
            for(k = 0; k < vecsize; k++)
            {
                result[i][j] += buffer_A[i][k] * buffer_B[k][j];
            }
        }
    }
what is the issue? how to resolve it?

Thank You

Regards
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20191020/c200cca4/attachment.html>


More information about the llvm-dev mailing list