Energy-conscious compilation based on voltage scaling

Hendra Saputra, Mahmut T. Kandemir, Narayanan Vijaykrishnan, Mary Jane Irwin, Jie S. Hu, Chung-Hsing Hsu, Ulrich KremerLCTES-SCOPES 2002 · DOI

TL;DR

This paper introduces two compiler-driven strategies for reducing energy consumption in embedded systems by intelligently adjusting the CPU's supply voltage. The authors demonstrate that by leveraging compiler optimizations to create "performance slack," they can significantly cut energy usage without sacrificing execution time (static scaling) or even improving performance (dynamic scaling), achieving substantial energy savings.

What Problem Does This Paper Address?

As embedded and portable devices become ubiquitous, minimizing energy consumption has become a critical design constraint. While hardware-level optimizations have seen significant progress, software-based energy efficiency, particularly through compilers, remains an under-explored area. This paper tackles the challenge of how compilers can actively participate in energy reduction by exploiting voltage scaling, a hardware feature that allows the CPU's operating voltage (and thus power consumption) to be adjusted. The core questions are: can existing compiler optimizations be repurposed for energy savings, and can new compiler techniques be developed to leverage voltage scaling more effectively, especially when considering the trade-offs between energy and performance?

Methods

The paper proposes two main compiler-directed strategies:

  • Static Voltage Scaling: This approach first applies traditional loop-level compiler optimizations (like loop permutation, tiling, fusion, and distribution) to a given code. These optimizations typically aim to improve performance by reducing execution time. However, instead of solely focusing on speed, this strategy uses the "performance slack" (the difference between the original and optimized execution times) to reduce the CPU's supply voltage. The goal is to bring the execution time of the optimized code (with reduced voltage) back to that of the original, unoptimized code, thereby achieving significant energy savings due to the quadratic relationship between voltage and dynamic energy consumption. The key here is repurposing performance optimizations for energy gains.
  • Dynamic Voltage Scaling (DVS): This more advanced strategy allows different parts of the code (specifically, loop nests) to operate at different supply voltage levels. The compiler formulates this as an Integer Linear Programming (ILP) problem. It pre-computes energy and execution time for each loop nest across various pre-selected voltage levels. Then, using an ILP solver, it determines the optimal voltage for each nest, considering constraints on overall execution time and potential voltage switching overheads. This approach offers greater flexibility and can achieve better energy savings than static scaling by fine-tuning voltage levels based on the specific needs of different code segments.

Datasets

The authors evaluated their techniques using a benchmark suite consisting of eight programs:

  • Six array-dominated scientific applications (from Perfect Club and Spec benchmarks).
  • Two image processing applications (motion estimation and JPEG encoder/decoder).

The paper does not introduce new benchmarks but uses a representative set of existing ones to demonstrate the effectiveness of their compiler strategies.

Key Insights and Ideas

  • Performance Slack as an Energy Resource: The most significant insight is the realization that performance gains from compiler optimizations can be directly translated into energy savings by reducing the supply voltage. This reframes the purpose of traditional optimizations.
  • Compiler's Role in DVS: The paper highlights that compilers are well-positioned to manage dynamic voltage scaling, going beyond operating system or hardware-based approaches. By analyzing code structure and estimating performance/energy, compilers can make informed decisions about voltage assignments for different code segments.
  • ILP for Optimal DVS: The formulation of dynamic voltage scaling as an Integer Linear Programming problem is a powerful approach. It allows for the explicit consideration of multiple constraints (energy, performance, switching overhead) and the search for an optimal solution across different code segments.
  • Trade-offs are Crucial: The research underscores the inherent trade-off between energy and performance. While aggressive voltage scaling can save energy, it impacts execution time. The proposed methods aim to find the sweet spot based on user-defined constraints.

Key Results

  • Static Voltage Scaling: Achieved an average energy saving of 31.8% across the benchmark suite. This was accomplished by sacrificing an average of 20.8% of potential performance improvement (i.e., the optimized code would have run 20.8% faster if voltage scaling wasn't used to maintain original execution time).
  • Dynamic Voltage Scaling: Saved an additional 15.3% more energy compared to static voltage scaling when operating under the same performance constraints.
  • The ILP solver for dynamic voltage scaling was efficient, with solution times always less than 0.5 seconds for the tested problems.

Limitations and Future Work

  • Voltage Switching Overhead: While the dynamic voltage scaling approach accounts for switching overhead, the paper notes that the ILP solver tends to minimize voltage changes between consecutive nests to mitigate this. The exact impact of overhead on different applications and the optimal strategy for managing it remain areas for further exploration.
  • Granularity of Scaling: The current dynamic approach scales voltage at the loop-nest level. The authors suggest extending this to finer granularities like procedures or even basic blocks for potentially greater savings, especially for applications with irregular data access patterns.
  • Runtime Negotiation: The current strategies determine voltage levels at compile time. Future work could involve a fully dynamic approach where the compiler cooperates with a runtime system to negotiate voltage levels dynamically based on actual runtime conditions.
  • Impact of Different Optimizations: The paper used a specific set of loop-level optimizations. Investigating how different compiler optimizations (e.g., those affecting memory access patterns or instruction-level parallelism) interact with voltage scaling effectiveness is a promising direction.

Summary updated

BibTeX
@inproceedings{saputra2002energy,
  author = {Hendra Saputra and Mahmut T. Kandemir and Narayanan Vijaykrishnan and Mary Jane Irwin and Jie S. Hu and Chung-Hsing Hsu and Ulrich Kremer},
  title = {{Energy-conscious compilation based on voltage scaling}},
  booktitle = {LCTES-SCOPES},
  year = {2002},
  doi = {10.1145/513829.513832},
}
Figure