TL;DR
This paper introduces a dynamic recompilation and linking framework that optimizes application energy consumption at runtime in response to changing energy constraints. By adapting code on-the-fly, it achieves significant energy savings with only a modest increase in execution time, addressing the growing challenge of energy efficiency in dynamic computing environments.
What Problem Does This Paper Address?
Modern computing devices, especially mobile and embedded systems, face a critical challenge: balancing performance with energy consumption. While compilers can optimize code for energy efficiency, the optimal strategy often depends on runtime conditions (like battery level or thermal load) that are unknown at compile time. These conditions can also change dynamically during an application's execution. Traditional static compilation cannot adapt to these evolving constraints, leading to suboptimal energy usage. This paper tackles this problem by proposing a system that can dynamically recompile and link parts of an application while it's running, allowing it to adapt its energy behavior to current system demands.
Methods
The core of the proposed solution is a dynamic recompilation/linking framework built upon the DyninstAPI. This framework operates as follows:
- Sensitivity Lists: The application code is augmented with "sensitivity lists" at critical points (loops or functions). These lists specify which energy constraints (e.g., off-chip memory energy, processor core energy) the following code segment is sensitive to.
- E-Optimizer: When a change in energy constraints is detected (signaled by a sensitivity list), an "E-Optimizer" module is invoked. This module acts as a supervisor.
- E-Script: The E-Optimizer consults an "E-Script" file. This file maps specific energy constraint ranges to pre-compiled code versions or instructions to recompile code.
- E-Compiler & Compiled Code Repository: If a suitable pre-compiled version for the current energy constraint exists in a "Compiled Code Repository," the E-Optimizer links it into the running application. If not, the E-Compiler generates a new, optimized version based on the E-Script instructions and then links it.
- Version Generation: For creating these optimized versions, the authors leverage the SUIF compiler infrastructure. They employ techniques like loop tiling, loop unrolling, and linear loop transformations for array-dominated applications, and standard optimization levels for integer codes. Crucially, after generating code versions, they estimate their energy consumption and modify the code to turn off unused memory banks to further reduce power.
Datasets
The paper evaluates its approach using seven benchmark programs: btrix, g721encode, epic, full_search, hier, tomcatv, and vpenta. These benchmarks are sourced from domains like SPEC, MediaBench, and Motion Estimation. The authors do not introduce new benchmarks but use these existing ones to demonstrate the effectiveness of their dynamic optimization strategy.
Key Insights and Ideas
- Runtime Adaptability is Key: The most significant insight is that static optimization is insufficient for dynamic energy constraints. A system that can adapt its code during execution is essential for maximizing energy efficiency in real-world scenarios.
- Trade-off Management: The framework explicitly addresses the trade-off between the overhead of dynamic recompilation/linking and the potential energy savings. The "sensitivity list" and "E-Script" mechanism ensure that recompilation only occurs when a significant energy constraint change is detected and is likely to yield benefits.
- Memory Bank Management: A clever aspect is the integration of memory bank power-down mechanisms with code optimization. By identifying unused memory banks in energy-optimized code versions, further energy savings are achieved.
- Robustness of the Approach: The experiments suggest that the dynamic recompilation/linking strategy is robust across different benchmarks, though the degree of benefit varies.
Key Results
- Significant Energy Savings: On average, the "Linking only" scenario (dynamic linking of pre-compiled versions) achieved a 24.9% energy saving compared to the static execution baseline. The "Recompilation and Linking" scenario achieved an average of 15.5% energy savings.
- Modest Performance Overhead: The increase in execution cycles was relatively small. The average increase was 1.9% for dynamic linking alone and 3.6% for dynamic recompilation and linking. When considering the performance impact of running a less performance-optimized version, the overall increase in execution cycles averaged 7.7%, which is deemed "affordable."
- Varied Impact: The effectiveness of the approach varied across benchmarks. Some, like
g721encode,epic,tomcatv, andvpenta, showed substantial energy gains. Others, likehier, showed little to no benefit or even an increase in energy consumption due to the overhead outweighing the savings. Forfull_searchandbtrix, dynamic linking alone was beneficial, but combining it with recompilation led to higher energy consumption than the baseline.
Limitations and Future Work
- Reaction Time: The current implementation checks for energy constraint changes only when a sensitivity list is encountered, leading to a longer reaction time.
- Generalizability of Version Generation: The current version generation strategy is tailored for a banked memory architecture. Future work could explore more general strategies applicable to diverse embedded architectures.
- Overhead Reduction: For benchmarks where the overhead of dynamic recompilation/linking is high, future work could focus on reducing this overhead or employing more aggressive energy optimization in the generated code.
- Scope of Optimizations: The paper acknowledges that identifying energy-critical regions and selecting suitable specifiers is a complex problem that is beyond the scope of this particular study. Future research could delve deeper into automated methods for this.
- Complete Treatment: The authors state that this work is a first step and postpones complete treatment of individual problems to future studies.
Summary updated