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:
- 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.
- 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) andzol(zero-overhead hardware loops). - Xilinx Vivado: Finally, the framework synthesizes the extended RISC-V core for deployment on FPGA hardware.
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.
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