Static analysis of energy consumption for LLVM IR programs

Energy models can be constructed by characterizing the energy consumed when executing each instruction in a processor's instruction set. This can be used to determine how much energy is required to execute a sequence of assembly instructions, without the need to instrument or measure hardware. However, statically analyzing low-level program structures is hard, and the gap between the high-level program structure and the low-level energy models needs to be bridged. We have developed techniques for performing a static analysis on the intermediate compiler representations of a program. Specifically, we target LLVM IR, a representation used by modern compilers, including Clang. Using these techniques we can automatically infer an estimate of the energy consumed when running a function under different platforms and compilers. One of the challenges in doing so is that of determining the energy cost of executing LLVM IR program segments, for which we have developed two different approaches. When this information is used in conjunction with our analysis, we are able to infer energy formulae that characterize the energy consumption for a particular program. This approach can be applied to any languages targeting the LLVM toolchain, including C and XC or architectures such as ARM Cortex-M or XMOS xCORE, with a focus towards embedded platforms. Our techniques are validated on these platforms by comparing the static analysis results to the physical measurements taken from the hardware. Static energy consumption estimation enables energy-aware software development by providing instant feedback to the developer, without requiring simulations or hardware knowledge.

[1]  David W. Binkley,et al.  Program slicing , 2008, 2008 Frontiers of Software Maintenance.

[2]  Simon J. Hollis,et al.  Identifying Compiler Options to Minimize Energy Consumption for Embedded Platforms , 2013, Comput. J..

[3]  Elvira Albert,et al.  Closed-Form Upper Bounds in Static Cost Analysis , 2011, Journal of Automated Reasoning.

[4]  Yu Chen,et al.  A New Algorithm for Identifying Loops in Decompilation , 2007, SAS.

[5]  P ? ? ? ? ? ? ? % ? ? ? ? , 1991 .

[6]  Miodrag Potkonjak,et al.  Function-level power estimation methodology for microprocessors , 2000, DAC.

[7]  Jan Maluszy¿ski Verification, Model Checking, and Abstract Interpretation , 2009, Lecture Notes in Computer Science.

[8]  Kerstin Eder,et al.  Energy Modeling of Software for a Hardware Multithreaded Embedded Microprocessor , 2015, ACM Trans. Embed. Comput. Syst..

[9]  Sharad Malik,et al.  Instruction level power analysis and optimization of software , 1996, Proceedings of 9th International Conference on VLSI Design.

[10]  Mads Rosendahl,et al.  Automatic complexity analysis , 1989, FPCA.

[11]  Samir Genaim,et al.  On the Limits of the Classical Approach to Cost Analysis , 2012, SAS.

[12]  Simon J. Hollis,et al.  BEEBS: Open Benchmarks for Energy Measurements on Embedded Platforms , 2013, ArXiv.

[13]  Peter Marwedel,et al.  An Accurate and Fine Grain Instruction-Level Energy Model Supporting Software Optimizations , 2007 .

[14]  Sharad Malik,et al.  Performance Analysis of Embedded Software Using Implicit Path Enumeration , 1995, 32nd Design Automation Conference.

[15]  Flemming Nielson,et al.  Principles of Program Analysis , 1999, Springer Berlin Heidelberg.

[16]  Jorge A. Navas,et al.  Safe upper-bounds inference of energy consumption for java bytecode applications , 2008, FM'08 2008.

[17]  Jorge A. Navas,et al.  User-Definable Resource Usage Bounds Analysis for Java Bytecode , 2009, BYTECODE@ETAPS.

[18]  Elvira Albert,et al.  Cost Relation Systems: A Language-Independent Target Language for Cost Analysis , 2009, PROLE.

[19]  Ben Wegbreit,et al.  Mechanical program analysis , 1975, CACM.

[20]  William Fornaciari,et al.  Software energy estimation based on statistical characterization of intermediate compilation code , 2011, IEEE/ACM International Symposium on Low Power Electronics and Design.

[21]  Saumya K. Debray,et al.  Lower Bound Cost Estimation for Logic Programs , 1997, ILPS.

[22]  Sharad Malik,et al.  Power analysis of embedded software: a first step towards software power minimization , 1994, IEEE Trans. Very Large Scale Integr. Syst..

[23]  Kevin Hammond,et al.  Inferring Cost Equations for Recursive, Polymorphic and Higher-Order Functional Programs , 2003, IFL.

[24]  Manuel V. Hermenegildo,et al.  Energy Consumption Analysis of Programs Based on XMOS ISA-Level Models , 2013, LOPSTR.

[25]  Jorge A. Navas,et al.  User-Definable Resource Bounds Analysis for Logic Programs , 2007, ICLP.

[26]  Luca Benini,et al.  Gate-level power and current simulation of CMOS integrated circuits , 1997, IEEE Trans. Very Large Scale Integr. Syst..

[27]  Martin Hofmann,et al.  Multivariate amortized resource analysis , 2012, TOPL.

[28]  Manuel V. Hermenegildo,et al.  Integrated program debugging, verification, and optimization using abstract interpretation (and the Ciao system preprocessor) , 2005, Sci. Comput. Program..

[29]  Susan L. Graham,et al.  OPTVIEW: a new approach for examining optimized code , 1998, PASTE '98.

[30]  Gerard J. M. Smit,et al.  A mathematical approach towards hardware design , 2010, Dynamically Reconfigurable Architectures.

[31]  Saumya K. Debray,et al.  Task granularity analysis in logic programs , 1990, PLDI '90.

[32]  Milo M. K. Martin,et al.  Formalizing the LLVM intermediate representation for verified program transformations , 2012, POPL '12.

[33]  Sumit Gulwani,et al.  Bound Analysis of Imperative Programs with the Size-Change Abstraction , 2011, SAS.