Abstract
While RISC-V enables the creation of custom hardware accelerators, integrating these into high-level software ecosystems like Python remains a significant challenge. This paper presents a work-in-progress solution that bridges this gap by modifying the OpenBLAS library to offload computations to a manycore RISC-V accelerator. By targeting a heterogeneous SoC, we achieve a 2.71x speedup for standard Numpy matrix multiplications, making hardware acceleration transparent to the end-user through simple environment variables.
Introduction
The "usability gap" in the RISC-V ecosystem often forces developers to choose between high-level productivity in Python and low-level performance on custom hardware. Currently, utilizing a Programmable Manycore Accelerator (PMCA) typically requires writing complex C code or specialized drivers. This research aims to provide a standard, open-source pathway to link specialized RISC-V accelerators directly into the Basic Linear Algebra Subprograms (BLAS) libraries that underpin the Python data science stack.
System Architecture
The experimental platform is based on the Cheshire SoC, emulated on a Xilinx FPGA. The architecture is heterogeneous, featuring a 64-bit CVA6 host core running Linux and a Snitch cluster acting as the accelerator. The Snitch cluster contains eight small 32-bit RISC-V cores, each equipped with double-precision floating-point units (FPUs) and local scratchpad memory (SPM).
Communication between the host and the accelerator is managed via the Hero software development kit (SDK), which facilitates task offloading and data movement across the AXI interconnect.
Software Integration and Transparency
The core contribution is the modification of OpenBLAS (v0.3.29) to include a heterogeneous implementation of General Matrix Multiply (GEMM). When a Python script calls a matrix operation, OpenBLAS uses OpenMP #pragma omp target directives to ship the heavy lifting over to the Snitch cores. This integration is designed to be transparent: by linking Numpy against this modified OpenBLAS, users can trigger acceleration by setting the BLAS_HERO=1 environment variable, requiring no changes to existing Python scripts.
Performance Evaluation
The system was evaluated using synthetic benchmarks for float64 matrix multiplications of varying sizes. Results indicate that the benefits of offloading scale with problem size. For 128x128 matrices, the system achieved a 2.71x execution speedup compared to the host core alone.
A key insight from the performance data is the "data copy tax." For the 128x128 workload, approximately 47% of the total runtime was spent moving data between Linux-managed memory and device memory. This underscores that data movement is a primary bottleneck in heterogeneous RISC-V systems.
Conclusion and Future Work
This work demonstrates a viable path for transparent hardware acceleration in the RISC-V ecosystem. Future efforts will focus on mitigating memory bottlenecks through IOMMU-enabled "zero-copy" offloading, which is projected to increase speedups to 4.7x. Additionally, we plan to optimize kernels using SIMD instructions and extend support to lower-precision data types (float16, int8) and a broader range of BLAS functions.
Summary updated