simd-everywhere / simde

Implementations of SIMD instruction sets for systems which don't natively support them.
https://simd-everywhere.github.io/blog/
MIT License
2.28k stars 237 forks source link

Compiling for RISC-V? #1181

Closed 727yubin closed 2 months ago

727yubin commented 2 months ago

Version 0.8.2 introduced support for RISC-V vector extensions, and I'm excited to try them out!

I'm pretty sure it's a stupid question, but what header file should I include to compile programs for RISC-V?

Looking at the commit history, I've tried including arm/neon.h but it seems like that's not the right way... I've successfully built tests for RISC-V with the GCC toolchain though, by referring to the actions CI tab.

mr-c commented 2 months ago

Hello @727yubin , did you https://github.com/simd-everywhere/simde?tab=readme-ov-file#usage ?

Or https://wiki.debian.org/SIMDEverywhere for how we adapt existing codebases in Debian to use SIMDe?

We do have an open issue to improve our RISC-V documentation: https://github.com/simd-everywhere/simde/issues/1145

For hints on compile options, see our CI configuration (but remove the qemu parts if you have real hardware) https://github.com/simd-everywhere/simde/blob/f046ab773733f09edaadec30345b592dfe85368e/.github/workflows/ci.yml#L458 Which uses files like https://github.com/simd-everywhere/simde/blob/f046ab773733f09edaadec30345b592dfe85368e/docker/cross-files/riscv64%2Brvv_vlen128_elen64_zvfh-clang-17-ccache.cross

Another way to test out SIMDe could be to compile an existing program that already uses it: https://github.com/simd-everywhere/simde/wiki/Projects-Using-SIMDe (though some of them may not have updated to the latest SIMDe version yet)