This project is a software simulator for a RISC-V GPU model, intended to be used a substrate to test and develop GPU kernels.
We need to install LLVM 22 with RISCV as one of the targets and install it to PATH. On Ubuntu, we can do:
wget https://apt.llvm.org/llvm.sh
chmod +x llvm.sh
sudo ./llvm.sh 22
You can find alternative ways to install the latest stable releases at the LLVM website.
Statically included dependencies: cxxopts, ELFIO
Recursively clone the repo:
git clone --recursive https://github.com/kenL4/RISC-V-gpu-sim.git
Ensure that the LLVM_DIR environment variable points to the correct version:
export LLVM_DIR=/usr/lib/llvm-22/lib/cmake/llvm
Then, the simplest way to run and observe the stats for all included SIMTight example test kernels is just to run:
./run-samples.sh
If you want to run the simulator directly on a particular kernel, follow these instructions:
- Build the simulator:
makeThis will automatically create the build/ directory, configure with CMake, and build the project.
- Run the built simulator binary on a NoCL kernel:
# e.g.
./build/RISCVGpuSim ./Samples/VecAdd/app.elfNote: You can just run the binary with no arguments to see what arguments and options are supported
To build and run the unit test suite:
make testThis simulator also now supports framebuffer dumping, i.e. rendering of shader kernels. If you run the sim with the command-line options:
--framebuffer-output <file> --framebuffer-width <width> --framebuffer-height <height> --framebuffer-addr <buffer_mem_addr>Then, it will dump an output image.
An example kernel I made for that is in /InHouse/Framebuffer (poorly named as it should be called Gradient really). It generates a 64x64 image which you can see in output.bmp