[RFC] Add RISC-V Vector Extension (RVV) Dialect

@zhanghb97 I am new to this field(MLIR, RVV). I’ve got some questions.Please enlighten me.

Is RVV Dialect still under development? I noticed you said you were using VP intrinsics for research and projects.

And do VP intrinsics have any trouble in expressing RVV?

I read the document of Buddy Compiler. Developer could use Polygeist to convert C/C++ code into MLIR. But it currently doesn’t supporting conversion of RVV intrinsic calls.

For example, here is my C++ code:

void axpy_vector(double a, double *dx, double *dy, int n) {
  int i;
  long gvl = __riscv_vsetvl_e64m1(n); // intrinsic
  for (i = 0; i < n;) {
    // intrinsic
    gvl = __riscv_vsetvl_e64m1(n - i);
    vfloat64m1_t v_dx = __riscv_vle64_v_f64m1(&dx[i], gvl);
    vfloat64m1_t v_dy = __riscv_vle64_v_f64m1(&dy[i], gvl);
    vfloat64m1_t v_res = __riscv_vfmacc_vf_f64m1(v_dy, a, v_dx, gvl);
    __riscv_vse64_v_f64m1(&dy[i], v_res, gvl);
    i += gvl;
  }
}

If I want to extend Polygeist, how to convert intrinsic(__riscv_vsetvl_e64m1, ..) into MLIR?

What dialect of operation are they supposed to be mapped to in MLIR?