Skip to content

Failed to compile matrix product like code using llvm 19.x for riscv vector extension. #121086

Closed
@fanghuaqi

Description

@fanghuaqi

Hi there,

I tried to compile source code as below, using clang with options: -march=rv32imafc_zve32f_zvl128b -mabi=ilp32f -Ofast

float *matA, *matB, *matC;
int nthreads = 1;

typedef struct{
   int id;
   int rowsA;
   int colsA;
   int colsB;
} tArgs;

void CalculaProdutoMatriz(void *arg) {
   int i, j, k;
   tArgs *args = (tArgs*) arg;
   int rowsA = args->rowsA;
   int colsA = args->colsA;
   int colsB = args->colsB;

   for(i = args->id; i < rowsA; i += nthreads) {
      for(j = 0; j < colsB; j++) {
         matC[i * colsB + j] = 0;
         for(k = 0; k < colsA; k++) {
               matC[i * colsB + j] += matA[i * colsA + k] * matB[k * colsB + j];
         }
      }
   }
}

It works in llvm 18.x and llvm truck(20.x), but failed in llvm 19.x error message like this

3.      Running pass 'Function Pass Manager' on module 'main.c'.
4.      Running pass 'RISC-V DAG->DAG Pattern Instruction Selection' on function '@main'

Thanks

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    Status

    Done

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions