English | 简体中文
Give your NVIDIA GPU its own RISC-V execution core. RISCuda runs real RV32IM machine code inside CUDA, bringing C and Python programs onto the GPU.
- A whole program in one kernel: parsing, branches, loops and evaluation stay on the GPU.
- Real MicroPython: functions, containers, exceptions and arbitrary-size integers.
- GPU-side tools: embed execution in a GPU-controlled Qwen inference loop.
This example comes from a recorded Qwen3.8-27B run with our lightweight Python interpreter.
1. Ask Qwen a question:
Use a Python while loop to calculate a total, starting at zero. For each integer i from 1 through 137, add i² if i is divisible by 3; otherwise subtract 2i. Output the final total.
2. Qwen generates Python for its tool call:
i = 1
total = 0
while i <= 137:
if i % 3 == 0:
total = total + i * i
else:
total = total - 2 * i
i = i + 1
print(total)3. RISCuda's GPU RISC-V core executes the Python interpreter and feeds the result, 269859, back to Qwen.
4. Qwen uses the tool result to answer the user: the total is 269859.
The recorded loop runs under one host CUDA Graph launch, with generation, Python execution and feedback controlled on the GPU. This Python integration is a companion prototype; the controller shipped here uses a fixed C calculator. See the recorded prompt, generated code and result and validation scope. To run standalone Python programs, start with the quick start.
flowchart LR
U[User question] --> Q[Qwen]
Q -->|Generated Python| R[RISC-V + Python on GPU]
R -->|Tool result| Q
Q -->|Final answer| A[User]
The CPU prepares and submits the request, then collects the final answer. A CUDA Graph contains multiple kernels; a standalone Python invocation executes in one CUDA kernel. The standalone MicroPython port supports integer computation. See execution architecture and the Qwen/C integration.
On 200 paired arithmetic problems, both arms scored 195/200. Across the 194 requests both completed correctly, RISCuda reduced total end-to-end latency by 15.9%. Both arms used CPU decoding loops; this comparison measures the execution-engine substitution. See results, method and limitations.
| I want to… | Read |
|---|---|
| Install and run an example | Quick start |
| Run Python | MicroPython |
| Run C | C guide |
| Execute assembly or machine code | RV32 reference |
| Use the lightweight interpreter | Python subset |
| Embed CUDA or extend services | Device API |
| Integrate Qwen | Autonomous inference |
| Reproduce the comparison | Benchmark guide |
| Inspect evidence | Validation index |
| Develop and test | Development guide |
If you use RISCuda in your work, please cite:
@software{zhao2026riscuda,
author = {Zhao, Lei and Lee, Chul-Ho},
title = {{RISCuda}: a {RISC-V} core and {Python} interpreter on {CUDA}},
year = {2026},
version = {0.1.0},
url = {https://github.com/dttutty/RISCuda}
}The citation is also available as BibTeX and Citation File Format for GitHub's Cite this repository feature.
