24 points · by camel-cdr · 3y ago · 25 comments
https://github.com/riscv/sail-riscv/commit/c90cf2e6eff5fa4ef...
I expect that this will help stabilise compiler support and facilitate other RISC-V extensions, like RISC-V Vector Crypto, also to progress.
That's a good question! I had to look it up myself ...
Obviously qemu TCG isn't a cycle-accurate emulation. Using RDCYCLE{,H} / reading the corresponding CSRs eventually calls https://gitlab.com/qemu-project/qemu/-/blob/69680740eafa1838... which calls cpu_get_host_ticks which is basically an arch-independent wrapper around RDTSC, assuming you are running qemu on x86 host. I think icount_enabled is false in normal qemu builds.
Therefore it would measure the time taken by qemu to emulate the vector instruction, in host instructions. Which I guess is what you would want (maybe?).
> This benchmark is more meant for developers to figure out how to vectorize algorithms effectively, as in which instructions to choose.
Absolutely, I'm not saying the qemu results would say anything very deep, but they're kind of interesting from the point of view of either optimizing qemu or if you have to use qemu because the hardware you want isn't available / isn't cheap enough.
I bought into the Milk-V Pioneer board, hope to get it around Christmas and build a home server around it. I'm curious to see how I can get my application (Rust-based, database & VM-ish) to perform on it and what power draw will be like.
That said my code as it is right now isn't doing a lot of array/vector type operations. There are likely places where some of my datastructures could be optimized to do so, but not right now.
I'm most interested in just taking advantage of high parallelism on the 64 cores. We shall see how that works out.
Hardware, yes. Note it will still run non-vector code fine.
Software, not at all. e.g. there's no public builds of Linux distributions targeting 0.7.1, not even unofficial.
It is not even easy to get working under Linux, although René Rebe managed to[0].
I don't know what Herculean effort was made to get the K230 SoC and dev board out already, and at a very low price.
It doesn't support autovectorization though.
Together with some assembly macros to allow writing in a subset of rvv 1.0 that also works on rvv 0.7.1 (source compatible, but not binary compatible. [0]
There is also the xuantie toolchain that does support intrinsic and some sort of autovectorization, I think. But I haven't used that one, and it won't be as good as upstream gcc/llvm. [1]
[0] https://github.com/camel-cdr/rvv-bench/blob/main/thirdparty/...
Other than the CanMV-K230 (Kendryte K230, single 1.6 GHz C908 core implementing RVV) which just started shipping in the last two weeks, every RISC-V board with RVV has either C906 or C910 cores which implement draft 0.7.1.
Those CPU cores were announced in mid 2019 (when RVV 0.7.1 was the current draft) and boards using them start arriving in mid to late 2021.
RVV 1.0 boards will start arriving in force next year, probably starting with the StarFive JH8110 SoC, and (apparently, though I'm not sure I believe it) an update of the SG2042 in the Pioneer, and also the 16 core (but faster cores) SG2380.
> Do you happen to have the name of the gcc branch
The branch has been deleted from the official repo. I have a snapshot on my github:
https://github.com/brucehoult/riscv-gnu-toolchain
Note that it is primarily binutils which understands RVV 0.7.1. GCC understands it only to the extent of accepting "v" in "-march" and passing the right flags to the assembler. This enables using the gcc driver to build .s files and inline RVV asm in C. There is no support for RVV intrinsic functions or auto-vectorisation.
It's also a somewhat old gcc. I use it to build .o files from assembly language, and then link them with C compiled by a newer gcc or llvm. Or not, most of the time gcc 9 is fine.
THead have RVV 0.7.1 support in newer gcc, but I haven't been tracking that closely.
Very interesting regardless, because it has already shipped and will enable developers to start working on optimized Vector 1.0 code on real hardware.
In 2024, hardware targeting very high performance arrives, and they implement RVA22+V, while some do a few newer extensions from RVA23.
It is going to be fun.