Skip to main content

Inferring Parametric Energy Consumption Functions at Different Software Levels: ISA vs. LLVM IR

  • Conference paper
  • First Online:

Part of the book series: Lecture Notes in Computer Science ((LNPSE,volume 9964))

Abstract

The static estimation of the energy consumed by program executions is an important challenge, which has applications in program optimization and verification, and is instrumental in energy-aware software development. Our objective is to estimate such energy consumption in the form of functions on the input data sizes of programs. We have developed a tool for experimentation with static analysis which infers such energy functions at two levels, the instruction set architecture (ISA) and the intermediate code (LLVM IR) levels, and reflects it upwards to the higher source code level. This required the development of a translation from LLVM IR to an intermediate representation and its integration with existing components, a translation from ISA to the same representation, a resource analyzer, an ISA-level energy model, and a mapping from this model to LLVM IR. The approach has been applied to programs written in the XC language running on XCore architectures, but is general enough to be applied to other languages. Experimental results show that our LLVM IR level analysis is reasonably accurate (less than \(6.4\,\%\) average error vs. hardware measurements) and more powerful than analysis at the ISA level. This paper provides insights into the trade-off of precision versus analyzability at these levels.

This is a preview of subscription content, log in via an institution.

Buying options

Chapter
USD   29.95
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
eBook
USD   39.99
Price excludes VAT (USA)
  • Available as EPUB and PDF
  • Read on any device
  • Instant download
  • Own it forever
Softcover Book
USD   54.99
Price excludes VAT (USA)
  • Compact, lightweight edition
  • Dispatched in 3 to 5 business days
  • Free shipping worldwide - see info

Tax calculation will be finalised at checkout

Purchases are for personal use only

Learn about institutional subscriptions

Notes

  1. 1.

    \([0 \times i32]\) specifies an arbitrary length array of i32 integer type elements.

  2. 2.

    nJ, \(10^{-9}\) joules.

References

  1. Albert, E., Arenas, P., Genaim, S., Puebla, G.: Closed-form upper bounds in static cost analysis. J. Autom. Reasoning 46(2), 161–203 (2011)

    Article  MathSciNet  MATH  Google Scholar 

  2. Albert, E., Arenas, P., Genaim, S., Puebla, G., Zanardini, D.: Cost analysis of Java bytecode. In: Nicola, R. (ed.) ESOP 2007. LNCS, vol. 4421, pp. 157–172. Springer, Heidelberg (2007). doi:10.1007/978-3-540-71316-6_12

    Chapter  Google Scholar 

  3. Bjørner, N., Fioravanti, F., Rybalchenko, A., Senni, V. (eds.) Proceedings of First Workshop on Horn Clauses for Verification and Synthesis, vol. 169. EPTCS, July 2014

    Google Scholar 

  4. Moura, L., Bjørner, N.: Z3: an efficient SMT solver. In: Ramakrishnan, C.R., Rehof, J. (eds.) TACAS 2008. LNCS, vol. 4963, pp. 337–340. Springer, Heidelberg (2008). doi:10.1007/978-3-540-78800-3_24

    Chapter  Google Scholar 

  5. Debray, S.K., Lin, N.-W., Hermenegildo, M.: Task granularity analysis in logic programs. In: Proceeding of the 1990 ACM Conference on Programming Language Design and Implementation, pp. 174–188. ACM Press, June 1990

    Google Scholar 

  6. Debray, S.K., López-García, P., Hermenegildo, M., Lin, N.-W.: Lower bound cost estimation for logic programs. In: 1997 International Logic Programming Symposium, pp. 291–305. MIT Press, Cambridge, October 1997

    Google Scholar 

  7. Georgiou, K., Kerrison, S., Eder, K.: On the Value, Limits of Multi-level Energy Consumption Static Analysis for Deeply Embedded Single, Multi-threaded Programs. ArXiv e-prints: arXiv:1510.07095, October 2015

  8. Grebenshchikov, S., Gupta, A., Lopes, N.P., Popeea, C., Rybalchenko, A.: HSF(C): a software verifier based on horn clauses. In: Flanagan, C., König, B. (eds.) TACAS 2012. LNCS, vol. 7214, pp. 549–551. Springer, Heidelberg (2012). doi:10.1007/978-3-642-28756-5_46

    Chapter  Google Scholar 

  9. Grech, N., Georgiou, K., Pallister, J., Kerrison, S., Morse, J., Eder, K.: Static analysis of energy consumption for LLVM IR programs. In: Proceedings of the 18th International Workshop on Software and Compilers for Embedded Systems, SCOPES 2015. ACM, New York (2015)

    Google Scholar 

  10. Gurfinkel, A., Kahsai, T., Navas, J.A.: SeaHorn: a framework for verifying C programs (Competition Contribution). In: Baier, C., Tinelli, C. (eds.) TACAS 2015. LNCS, vol. 9035, pp. 447–450. Springer, Heidelberg (2015). doi:10.1007/978-3-662-46681-0_41

    Google Scholar 

  11. Henriksen, K.S., Gallagher, J.P.: Abstract interpretation of PIC programs through logic programming. In: Sixth IEEE International Workshop on Source Code Analysis and Manipulation (SCAM 2006), pp. 184–196. IEEE Computer Society (2006)

    Google Scholar 

  12. Hermenegildo, M., Puebla, G., Bueno, F., Lopez-Garcia, P.: Integrated program debugging, verification, and optimization using abstract interpretation (and the Ciao system preprocessor). Sci. Comput. Program. 58(1–2), 115–140 (2005)

    Article  MathSciNet  MATH  Google Scholar 

  13. Hermenegildo, M.V., Bueno, F., Carro, M., López, P., Mera, E., Morales, J., Puebla, G.: An overview of Ciao and its design philosophy. Theory Pract. Logic Program. 12(1–2), 219–252 (2012)

    Article  MathSciNet  MATH  Google Scholar 

  14. Herrmann, C., Bonenfant, A., Hammond, K., Jost, S., Loidl, H.-W., Pointon, R.: Automatic amortised worst-case execution time analysis. In: 7th International Workshop on Worst-Case Execution Time Analysis (WCET 2007), vol. 6. OASIcs. Schloss Dagstuhl-Leibniz-Zentrum fuer Informatik (2007)

    Google Scholar 

  15. Hojjat, H., Konečný, F., Garnier, F., Iosif, R., Kuncak, V., Rümmer, P.: A verification toolkit for numerical transition systems. In: Giannakopoulou, D., Méry, D. (eds.) FM 2012. LNCS, vol. 7436, pp. 247–251. Springer, Heidelberg (2012). doi:10.1007/978-3-642-32759-9_21

    Chapter  Google Scholar 

  16. Jayaseelan, R., Mitra, T., Li, X.: Estimating the worst-case energy consumption of embedded software. In: IEEE Real Time Technology and Applications Symposium, pp. 81–90. IEEE Computer Society (2006)

    Google Scholar 

  17. Kerrison, S., Eder, K.: Energy modeling of software for a hardware multithreaded embedded microprocessor. ACM Trans. Embed. Comput. Syst. 14(3), 1–25 (2015)

    Article  Google Scholar 

  18. Lafond, S., Lilius, J.: Energy consumption analysis for two embedded Java virtual machines. J. Syst. Archit. 53(5–6), 328–337 (2007)

    Article  Google Scholar 

  19. Lattner, C., Adve, V.: LLVM: a compilation framework for lifelong program analysis and transformation. In: Proceeding of the 2004 International Symposium on Code Generation and Optimization (CGO), pp. 75–88. IEEE Computer Society, March 2004

    Google Scholar 

  20. Liqat, U., Georgiou, K., Kerrison, S., Lopez-Garcia, P., Hermenegildo, M.V., Gallagher, J.P., Eder, K., Consumption, I.E.: At Different Software Levels: ISA vs. LLVM IR. Technical report, FET 318337 ENTRA Project, Appendix D3.2.4 of Deliverable D3.2. http://entraproject.eu

  21. Liqat, U., Kerrison, S., Serrano, A., Georgiou, K., Lopez-Garcia, P., Grech, N., Hermenegildo, M., Eder, K.: Energy Consumption analysis of programs based on XMOS ISA-level models. In: Gupta, G., Peña, R. (eds.) LOPSTR 2013. LNCS, vol. 8901, pp. 72–90. Springer, Switzerland (2014). doi:10.1007/978-3-319-14125-1_5

    Google Scholar 

  22. Méndez-Lojo, M., Navas, J., Hermenegildo, M.V.: A flexible, (C)LP-based approach to the analysis of object-oriented programs. In: King, A. (ed.) LOPSTR 2007. LNCS, vol. 4915, pp. 154–168. Springer, Heidelberg (2008). doi:10.1007/978-3-540-78769-3_11

    Chapter  Google Scholar 

  23. Mera, E., López-García, P., Carro, M., Hermenegildo, M.: Towards execution time estimation in abstract machine-based languages. In: 10th International ACM SIGPLAN Symposium on Principles and Practice of Declarative Programming (PPDP 2008), pp. 174–184. ACM Press, July 2008

    Google Scholar 

  24. Navas, J., Méndez-Lojo, M., Hermenegildo, M.: Safe upper-bounds inference of energy consumption for Java bytecode applications. In: The Sixth NASA Langley Formal Methods Workshop (LFM 2008), Extended Abstract, April 2008

    Google Scholar 

  25. Navas, J., Mera, E., Lopez-Garcia, P., Hermenegildo, M.V.: User-definable resource bounds analysis for logic programs. In: Dahl, V., Niemelä, I. (eds.) ICLP 2007. LNCS, vol. 4670, pp. 348–363. Springer, Heidelberg (2007). doi:10.1007/978-3-540-74610-2_24

    Chapter  Google Scholar 

  26. Pallister, J., Kerrison, S., Morse, J., Eder, K.: Data dependent energy modeling for worst case energy consumption analysis. arXiv preprint arXiv:1505.03374 (2015)

  27. Rosendahl, M.: Automatic complexity analysis. In: 4th ACM Conference on Functional Programming Languages and Computer Architecture (FPCA 1989). ACM Press (1989)

    Google Scholar 

  28. Serrano, A., Lopez-Garcia, P., Hermenegildo, M.: Resource usage analysis of logic programs via abstract interpretation using sized types. In: Theory and Practice of Logic Programming, 30th International Conference on Logic Programming (ICLP 2014) Special Issue, vol. 14, no. 4–5, pp. 739–754 (2014)

    Google Scholar 

  29. Seshia, S.A., Kotker, J.: Gametime: a toolkit for timing analysis of software. In: Abdulla, P.A., Leino, K.R.M. (eds.) TACAS 2011. LNCS, vol. 6605, pp. 388–392. Springer, Heidelberg (2011). doi:10.1007/978-3-642-19835-9_34

    Chapter  Google Scholar 

  30. Vasconcelos, P.B., Hammond, K.: Inferring Cost Equations for Recursive, Polymorphic and Higher-Order Functional Programs. In: Trinder, P., Michaelson, G.J., Peña, R. (eds.) IFL 2003. LNCS, vol. 3145, pp. 86–101. Springer, Heidelberg (2004). doi:10.1007/978-3-540-27861-0_6

    Chapter  Google Scholar 

  31. Watt, D.: Programming XC on XMOS Devices. XMOS Limited (2009)

    Google Scholar 

  32. Wegbreit, B.: Mechanical program analysis. Commun. ACM 18(9), 528–539 (1975)

    Article  MathSciNet  MATH  Google Scholar 

  33. Wilhelm, R., Engblom, J., Ermedahl, A., Holsti, N., Thesing, S., Whalley, D., Bernat, G., Ferdinand, C., Heckmann, R., Mitra, T., Mueller, F., Puaut, I., Puschner, P., Staschulat, J., Stenström, P.: The worst-case execution-time problem - overview of methods and survey of tools. ACM Trans. Embedded Comput. Syst. 7(3), 36 (2008)

    Article  Google Scholar 

Download references

Acknowledgements

This research has received funding from the European Union 7th Framework Program agreement no 318337, ENTRA, Spanish MINECO TIN’12-39391 StrongSoft project, and the Madrid M141047003 N-GREENS program.

Author information

Authors and Affiliations

Authors

Corresponding author

Correspondence to P. Lopez-Garcia .

Editor information

Editors and Affiliations

Rights and permissions

Reprints and permissions

Copyright information

© 2016 Springer International Publishing Switzerland

About this paper

Cite this paper

Liqat, U. et al. (2016). Inferring Parametric Energy Consumption Functions at Different Software Levels: ISA vs. LLVM IR. In: van Eekelen, M., Dal Lago, U. (eds) Foundational and Practical Aspects of Resource Analysis. FOPARA 2015. Lecture Notes in Computer Science(), vol 9964. Springer, Cham. https://doi.org/10.1007/978-3-319-46559-3_5

Download citation

  • DOI: https://doi.org/10.1007/978-3-319-46559-3_5

  • Published:

  • Publisher Name: Springer, Cham

  • Print ISBN: 978-3-319-46558-6

  • Online ISBN: 978-3-319-46559-3

  • eBook Packages: Computer ScienceComputer Science (R0)

Publish with us

Policies and ethics