MARVEL: An End-to-End Framework for Generating Model-Class Aware Custom RISC-V Extensions for Lightweight AI

Ajay Kumar M, Cian O'Mahoney, Pedro Kreutz Werle, Shreejith Shanker, Dimitrios S. Nikolopoulos, Bo Ji, Hans Vandierendonck, Deepu John · DOI

Introduction

Deploying artificial intelligence on tiny, bare-metal IoT devices is a significant challenge due to extreme resource constraints and the absence of automated hardware-software co-design tools. While custom hardware accelerators offer a solution, they typically require low-level assembly expertise or rely on heavy software runtimes like TensorFlow Lite, which are often too large for minimal IoT endpoints.

This paper introduces MARVEL, an end-to-end framework designed to bridge the gap between high-level Python AI frameworks and custom-tailored, bare-metal RISC-V hardware. MARVEL automatically translates Python-based neural networks into optimized C code and generates custom instruction set architecture (ISA) extensions tailored to specific model classes, such as Convolutional Neural Networks (CNNs).

The MARVEL Framework

MARVEL automates the pipeline from a standard Deep Neural Network (DNN) to a custom RISC-V processor design through three primary pillars:

  1. Apache TVM: This machine learning compiler translates high-level Python models (e.g., Keras, TensorFlow, PyTorch) into generic, optimized C code, eliminating the need for an operating system.
  2. Synopsys ASIP Designer: The framework profiles the generated C code on a baseline RISC-V core to identify computational bottlenecks. This data-driven approach allows for the creation of custom ISA extensions like mac (multiply-accumulate) and zol (zero-overhead hardware loops).
  3. Xilinx Vivado: Finally, the framework synthesizes the extended RISC-V core for deployment on FPGA hardware.
The MARVEL end-to-end workflow, showing the integration of TVM, ASIP Designer, and Vivado.

Data-Driven ISA Extensions

Unlike traditional methods that rely on manual heuristics, MARVEL uses empirical profiling to identify recurring instruction patterns across entire model classes. For instance, profiling revealed that a specific four-instruction sequence (addi, addi, mul, add) accounted for nearly 10% of code execution in CNNs.

To address this, the authors developed the fusedmac instruction, which combines these operations into a single cycle. Additionally, the introduction of Zero-Overhead Loop (zol) instructions allows the hardware to manage loop counters natively, eliminating millions of branch instructions common in nested convolution loops.

Instruction decoding for the custom fusedmac instruction, illustrating how multiple operations are packed into a single I-type instruction.

Key Results and Impact

The framework was evaluated on an AMD Zynq UltraScale+ ZCU104 FPGA using popular CNN architectures, including MobileNet, ResNet, and VGG. Key findings include:

  • Performance: The custom RISC-V core achieved up to a 2x speedup in inference latency and a 2x reduction in energy consumption per inference.
  • Efficiency: The hardware overhead was minimal, with only a 28.23% increase in Look-Up Tables (LUTs) and a negligible 2.28% increase in power consumption.
  • Memory Savings: Fused instructions and hardware loops reduced program memory usage by up to 10.2%, a critical gain for bare-metal environments.

Conclusion

MARVEL demonstrates that data-driven, class-aware ISA extensions can significantly enhance the efficiency of AI on the edge without sacrificing flexibility. By targeting recurring patterns in model classes rather than specific topologies, MARVEL ensures that custom hardware remains useful even as specific model architectures evolve. Future work will focus on extending the framework to support Transformers, RNNs, and advanced quantization techniques.

Summary updated

BibTeX
@article{m2025marvel,
  author = {Ajay Kumar M and Cian O'Mahoney and Pedro Kreutz Werle and Shreejith Shanker and Dimitrios S. Nikolopoulos and Bo Ji and Hans Vandierendonck and Deepu John},
  title = {{MARVEL: An End-to-End Framework for Generating Model-Class Aware Custom RISC-V Extensions for Lightweight AI}},
  journal = {IEEE Open J. Circuits Syst.},
  year = {2025},
  doi = {10.1109/ojcas.2025.3589132},
}
Figure