3

I am looking for a C/C++ toolchain that supports the RISC-V vector extension v1.0 as defined per official spec.

Spike appears to support vector rvv1.0, but I am having trouble finding a toolchain to use it with.

Neither GCC (I only see a branch for rvv0.9) nor LLVM (I am using LLVM/clang 13.0.0, which only goes up to rvv0.10) appear to support the latest spec.

Can somebody point me to a working toolchain or do I just have to wait some more for the tools to catch up?

Fabian
  • 312
  • 3
  • 13
  • Hello friend, how about to look into sifive repo, as they said, they have 1.0 rvv from past year. https://github.com/sifive/freedom-tools/releases – Alexy Khilaev Oct 07 '21 at 09:38
  • Yes, you are right. They do have vector support in GCC up to RVV-1.0 draft. But apparently, there is no further RVV development on GCC happening. So this appears to be a dead end in the longrun? – Fabian Oct 30 '21 at 23:58
  • Who knows? maybe you should ask Kito Cheng? – Alexy Khilaev Nov 01 '21 at 03:52

2 Answers2

4

GCC support RVV1.0 feature now. You can use this:https://github.com/riscv-collab/riscv-gnu-toolchain. checkout riscv-gcc to riscv-gcc-rvv-next and riscv-binutils-gdb to riscv-binutils-2.38. Then you can have latest RVV1.0 features in GNU toolchain

To support auto-vectorization: use -mrvv compile options.

malat
  • 12,152
  • 13
  • 89
  • 158
tonyzhong
  • 71
  • 4
3

now, at 8 dec 2021 you can use llvm + clang 14.0.0 3eda87732fbac6f316e9e83984ef9a90f962c381 with enabled vector support rvv 0.1.

  1. Compile RISCV GCC TOOLCHAIN

  2. Compile LLVM + CLANG + LLD

  3. Add GCC Toolchain to llvm install folder, here described how you can do it Using Clang to compile for RISC-V

  4. And finally vectorize with next keys:

    clang -O2 -c -march=rv64gv0p10 test.ll -o test1.o -menable-experimental-extensions -mllvm --riscv-v-vector-bits-min=256 -mno-relax

Here is an output - objdump file: enter image description here Objdump won't recognize instructions but you can see it if you emit assembler code with -S key: enter image description here

Dharman
  • 30,962
  • 25
  • 85
  • 135
Alexy Khilaev
  • 415
  • 3
  • 13
  • In case anyone gets a `error: invalid arch name 'rv64gv0p10', unsupported version number 0.10 for extension 'v'` error with the architecture string above, newer clang versions accept `-march=rv64gv`. – CAFxX Nov 10 '22 at 02:26