This is my dockerized cross-compilation environment for RISC-V Vector Extension (RVV 1.0) for SIMD optimization, compiler analysis, and low-level performance evaluation.
In this environment, I include the languages I normally use, primarily C++ and Fortran. You can also build the image using Rust; simply uncomment the corresponding section in the Dockerfile.
The Cross-compilation toolchain for riscv64 includes:
- GCC 13.3 (gcc, g++ and gfortran).
- LLVM 18 (clang, clang++, flang).
- Rust 1.95 (59807616e 2026-04-14).
- QEMU 8.2 with configurable vector length support (VLEN).
- Support for auto-vectorization and RVV intrinsics.
This environment is designed as a practical laboratory, enabling development of vectorized C, C++, Fortran and Rust kernels, enabling the Comparison of scalar execution, compiler auto-vectorization and manual RVV intrinsics with alidation of results on QEMU emulation.
To build the image, use the repository or simply download the Dockerfile from the docker folder. The image is built using the following command (assuming that the Dockerfile is in the docker folder):
docker build -f docker/Dockerfile -t rvv .
Once built, it can be integrated into VSCode or launched directly with
docker run -it --rm -v $(pwd):/app rvv
You can inspect the environment by running bash ./env.sh
====================================================
RISC-V DEVELOPMENT ENVIRONMENT CHECK
====================================================
# GCC C Compiler (Linux):
riscv64-linux-gnu-gcc (Ubuntu 13.3.0-6ubuntu2~24.04.1) 13.3.0
# GCC C++ Compiler (Linux):
riscv64-linux-gnu-g++ (Ubuntu 13.3.0-6ubuntu2~24.04.1) 13.3.0
# GCC Fortran Compiler (Linux):
GNU Fortran (Ubuntu 13.3.0-6ubuntu2~24.04.1) 13.3.0
# Clang (C/C++ Compiler):
Ubuntu clang version 18.1.3 (1ubuntu1)
# Flang (Fortran Compiler):
Ubuntu flang-new version 18.1.3 (1ubuntu1)
# QEMU User Mode:
qemu-riscv64 version 8.2.2 (Debian 1:8.2.2+ds-0ubuntu1.17)
# QEMU System Mode:
QEMU emulator version 8.2.2 (Debian 1:8.2.2+ds-0ubuntu1.17)
# Rust: Not installed
=====================================================
Alias for compiling with vector support RVV 1.0:
- GCC / G++: rv-g++ <src> -o <dest>
- Clang++: rv-clang++ <src> -o <dest>
- Flang: rv-flang <src> -o <des>
- QEMU (RVV): rv-qemu ./<binary>
=====================================================
You can verify vectorization output using commands like this:
riscv64-linux-gnu-objdump -d ./binary | grep -E "vset|vle|vse|vadd|vfadd"