Introduction
Researchers from ETH Zurich have introduced a novel hardware-software co-design for RISC-V processors that enhances the performance of simple, energy-efficient cores without the overhead of complex hardware logic. By repurposing internal pipeline registers as temporary storage, the proposed "scalar chaining" extension allows in-order processors to achieve high utilization and energy efficiency, effectively bridging the gap between simple execution and high-performance throughput.
The Challenge: Pipeline Stalls and Register Pressure
In high-performance computing, small in-order processing elements are favored for their power efficiency. However, these cores are highly susceptible to pipeline stalls. For example, if a floating-point multiply (fmul) instruction requires the result of a preceding floating-point add (fadd) that is still traversing the pipeline, the processor must stall until the data is ready.
To mitigate this, programmers typically employ loop unrolling—launching multiple independent operations to keep the pipeline full. While effective, this technique significantly increases "register pressure." In cores with limited architectural registers, the processor eventually runs out of space to store intermediate results, forcing it to "spill" data to slow memory. This memory bottleneck often negates the performance gains of unrolling.
Methodology: Scalar Chaining
The researchers propose Scalar Chaining, a technique that treats the hardware pipeline itself as a storage resource.
1. Pipeline as Storage
A Floating Point Unit (FPU) with a 3-stage pipeline inherently holds three intermediate values at any given time. Instead of immediately forcing these values back into the main register file, scalar chaining treats the pipeline as a First-In-First-Out (FIFO) queue.
2. ISA Extension and FIFO Semantics
The authors introduced a custom Control and Status Register (CSR) to the RISC-V architecture. By setting a bitmask in this register, a programmer can designate specific registers (such as ft3) to operate with chaining semantics. When chaining is enabled:
- Writing to the register "pushes" a value into the pipeline-backed FIFO.
- Reading from the register "pops" the value from the FIFO.
This mechanism breaks traditional Write-After-Write (WAW) dependencies, allowing the processor to stream data through the FPU continuously without waiting for architectural register write-backs.
3. Hardware Implementation
The design was implemented on the Snitch processor, a RISC-V core optimized for bit-manipulation. To manage data flow, the researchers added a "valid bit" per register to handle backpressure. This ensures that if the pipeline stalls, data is not overwritten before it is consumed by the software.
Evaluation and Results
The implementation was evaluated using a 12nm FinFET process simulation at 1 GHz. The researchers focused on stencil codes (specifically box3d1r and j3d27pt), which are fundamental to scientific computing and image processing. These kernels are notoriously register-limited, making them ideal for testing techniques designed to alleviate register pressure.
Key Findings:
- High FPU Utilization: The system achieved over 93% FPU utilization, meaning the mathematical hardware remained active nearly every cycle.
- Performance and Efficiency: Compared to highly optimized baselines, scalar chaining delivered a 4% geomean speedup and a 10% improvement in energy efficiency.
- Minimal Overhead: The hardware modifications were lightweight, requiring less than a 2% increase in silicon area and maintaining the original maximum clock frequency.
- Synergy with SSRs: By reducing the need for architectural registers for intermediate storage, the technique freed up Stream Semantic Registers (SSRs) to handle memory movement more efficiently, further boosting performance.
Conclusion and Future Work
Scalar chaining demonstrates that significant performance gains can be achieved by making "invisible" hardware states addressable by software. By turning a hardware necessity (pipelining) into a software feature (storage), the authors have provided a path for simple cores to handle complex, register-heavy workloads.
While currently optimized for in-order cores, future research may explore integrating this approach into other area-efficient architectures or expanding the patterns of instruction chaining beyond simple arithmetic pairs. The technique offers a compelling alternative to the power-hungry register renaming logic found in complex out-of-order processors.
Summary updated