top of page

Porting Math Primitives on a Custom RISC-V

  • Writer: Anup Halarnkar
    Anup Halarnkar
  • Dec 22, 2025
  • 1 min read

Updated: Jan 2

Introduction


As RISC-V expands into accelerator domains, software readiness becomes as critical

as hardware innovation. This work focused on implementing a set of mathematical and

BLAS primitives for a custom RISC-V architecture, forming foundational building blocks

for numerical computing.

The implementation included vector and matrix operations with careful attention to numerical

correctness and floating-point behavior.


Challenges and Constraints


A key challenge was the absence of physical hardware. Development was carried out using a remote x86-based system with RISC-V cross-compilation toolchains, while functional validation relied on an emulation-based execution framework that provided pass/fail results against reference outputs. Despite these constraints, the work enabled early software validation, ABI compliance checks, and confidence in algorithmic correctness—demonstrating a software-first approach to accelerator enablement. Early investment in core math primitives significantly accelerates ecosystem readiness for emerging architectures like RISC-V



Categorizing the Math Core: BLAS Level 1 vs. Level 2


To ensure the custom RISC-V can handle diverse workloads, the implementation was

divided into two fundamental tiers of the BLAS (Basic Linear Algebra Subprograms) hierarchy.


Level 1: Vector-Vector Primitives


Level 1 operations are the simplest building blocks. They perform O(n) operations on O(n) data. In a RISCV architecture, these are often "bandwidth-bound," meaning the speed of the operation is limited by how fast the hardware can pull data from memory rather than the raw speed of the floating-point units.



Level 2: Matrix-Vector & Rank Updates


Level 2 operations are significantly more complex, performing O(n2) operations on O(n2) data. These routines are the backbone of most "Band Matrix" solvers and are critical for engineering simulations where matrices have a specific structure (like symmetric or triangular). 




Comments


bottom of page