Hostname: page-component-cd9895bd7-dk4vv Total loading time: 0 Render date: 2024-12-23T11:25:20.596Z Has data issue: false hasContentIssue false

Interval-based resource usage verification by translation into Horn clauses and an application to energy consumption

Published online by Cambridge University Press:  11 May 2018

P. LOPEZ-GARCIA
Affiliation:
IMDEA Software Institute, Madrid, Spain Spanish Council for Scientific Research (CSIC), Madrid, Spain (e-mail: [email protected])
L. DARMAWAN
Affiliation:
IMDEA Software Institute, Madrid, Spain (e-mail: [email protected])
M. KLEMEN
Affiliation:
IMDEA Software Institute, Madrid, Spain Universidad Politécnica de Madrid (UPM), Madrid, Spain (e-mails: [email protected], [email protected])
U. LIQAT
Affiliation:
IMDEA Software Institute, Madrid, Spain Universidad Politécnica de Madrid (UPM), Madrid, Spain (e-mails: [email protected], [email protected])
F. BUENO
Affiliation:
Universidad Politécnica de Madrid (UPM), Madrid, Spain (e-mail: [email protected])
M. V. HERMENEGILDO
Affiliation:
IMDEA Software Institute, Madrid, Spain Universidad Politécnica de Madrid (UPM), Madrid, Spain (e-mail: [email protected])

Abstract

Many applications require conformance with specifications that constrain the use of resources, such as execution time, energy, bandwidth, etc. We present a configurable framework for static resource usage verification where specifications can include data size-dependent resource usage functions, expressing both lower and upper bounds. Ensuring conformance with respect to such specifications is an undecidable problem. Therefore, to statically check such specifications, our framework infers the same type of resource usage functions, which safely approximate the actual resource usage of the program, and compares them against the specification. We review how this framework supports several languages and compilation output formats by translating them to an intermediate representation based on Horn clauses and using the configurability of the framework to describe the resource semantics of the input language. We provide a detailed formalization and extend the framework so that both resource usage specification and analysis/verification output can include preconditions expressing intervals for the input data sizes for which assertions are intended to hold, proved, or disproved. Most importantly, we also extend the classes of functions that can be checked. We also report on and provide results from an implementation within the Ciao/CiaoPP framework, as well as on a practical tool built by instantiating this framework for the verification of energy consumption specifications for imperative/embedded programs. Finally, we show as an example how embedded software developers can use this tool, in particular, for determining values for program parameters that ensure meeting a given energy budget while minimizing the loss in quality of service.

Type
Original Article
Copyright
Copyright © Cambridge University Press 2018 

Access options

Get access to the full version of this content by using one of the access options below. (Log in options will check for institutional or personal access. Content may require purchase if you do not have access.)

References

Albert, E., Arenas, P., Genaim, S., Herraiz, I. and Puebla, G. 2010. Comparing cost functions in resource analysis. In Proc. of 1st International Workshop on Foundational and Practical Aspects of Resource Analysis (FOPARA'09). Lecture Notes in Computer Science, vol. 6234. Springer, 1–17.Google Scholar
Albert, E., Arenas, P., Genaim, S. and Puebla, G. 2015. A Practical Comparator of Cost Functions and its Applications. Science of Computer Programming 111, 483504. Special Issue on Foundational and Practical Aspects of Resource Analysis (FOPARA 2009).Google Scholar
Bjørner, N., Fioravanti, F., Rybalchenko, A. and Senni, V., Eds. 2014. In Proc. of Workshop on Horn Clauses for Verification and Synthesis. Electronic Proceedings in Theoretical Computer Science.Google Scholar
Bourdoncle, F. 1993. Abstract debugging of higher-order imperative languages. In Programming Languages Design and Implementation. Cartwright, R., Ed. ACM, 4655.Google Scholar
Bueno, F., Deransart, P., Drabent, W., Ferrand, G., Hermenegildo, M. V., Maluszynski, J. and Puebla, G. 1997. On the role of semantic approximations in validation and diagnosis of constraint logic programs. In Proc. of the 3rd International Workshop on Automated Debugging (AADEBUG'97). University of Linköping Press, Linköping, Sweden, 155–170.Google Scholar
Comini, M., Levi, G., Meo, M. C. and Vitiello, G. 1999. Abstract diagnosis. Journal of Logic Programming 39, 1–3, 4393.Google Scholar
Comini, M., Levi, G. and Vitiello, G. 1995. Declarative diagnosis revisited. In 1995 International Logic Programming Symposium. MIT Press, Cambridge, MA, Portland, Oregon, 275287.Google Scholar
Cousot, P. 2003. Automatic verification by abstract interpretation, invited tutorial. In Proc of 4th International Conference on Verification, Model Checking and Abstract Interpretation (VMCAI'03). Number 2575 in Lecture Notes in Computer Science. Springer, 20–24.Google Scholar
Cousot, P. and Cousot, R. 1977. Abstract interpretation: A unified lattice model for static analysis of programs by construction or approximation of fixpoints. In Proc. of ACM Symposium on Principles of Programming Languages (POPL'77). ACM Press, 238–252.Google Scholar
Dart, P. and Zobel, J. 1992. A regular type language for logic programs. In Types in Logic Programming. MIT Press, 157187.Google Scholar
de Moura, L. M. and Bjørner, N. 2008. Z3: An efficient SMT solver. In Proc of 14th International Conference on Tools and Algorithms for the Construction and Analysis of Systems (TACAS'08), Ramakrishnan, C. R. and Rehof, J., Eds. Lecture Notes in Computer Science, vol. 4963. Springer, 337–340.Google Scholar
Debray, S. K. and Lin, N. W. 1993. Cost analysis of logic programs. ACM Transactions on Programming Languages and Systems 15, 5 (November), 826875.Google Scholar
Debray, S. K., Lin, N.-W. and Hermenegildo, M. V. 1990. Task granularity analysis in logic programs. In Proc. of ACM Conference on Programming Language Design and Implementation (PLDI'90). ACM Press, 174–188.Google Scholar
Debray, S. K., López-García, P., Hermenegildo, M. V. and Lin, N.-W. 1997. Lower bound cost estimation for logic programs. In Proc. of International Logic Programming Symposium. MIT Press, Cambridge, MA, 291–305.Google Scholar
Fähndrich, M. and Logozzo, F. 2011. Static contract checking with abstract interpretation. In Proc. of International Conference on Formal Verification of Object-oriented Software (FoVeOOS'10). Lecture Notes in Computer Science, vol. 6528. Springer, 10–30.Google Scholar
Galassi, M., Davies, J., Theiler, J., Gough, B., Jungman, G., Alken, P., Booth, M. and Rossi, F. 2009. GNU Scientific Library Reference Manual - 3rd ed. (v1.12). Network Theory Ltd. Available at http://www.gnu.org/software/gsl/.Google Scholar
Georgiou, K., Kerrison, S., Chamski, Z. and Eder, K. 2017. Energy transparency for deeply embedded programs. ACM Transactions on Architecture and Code Optimization 14, 1 (March), 8:18:26.Google Scholar
Gleich, D. F. 2005. Finite Calculus: A Tutorial for Solving Nasty Sums. Combinatorics, Stanford University.Google Scholar
Grebenshchikov, S., Gupta, A., Lopes, N. P., Popeea, C. and Rybalchenko, A. 2012. HSF(C): A software verifier based on Horn clauses — (competition contribution). In TACAS, Flanagan, C. and König, B., Eds. Lecture Notes in Computer Science, vol. 7214. Springer, 549551.Google Scholar
Hermenegildo, M. V., Bueno, F., Carro, M., López, P., Mera, E., Morales, J. and Puebla, G. 2012. An overview of Ciao and its design philosophy. Theory and Practice of Logic Programming 12, 1–2 (January), 219252. http://arxiv.org/abs/1102.5497.Google Scholar
Hermenegildo, M. V., Puebla, G. and Bueno, F. 1999. Using global analysis, partial specifications, and an extensible assertion language for program validation and debugging. In The Logic Programming Paradigm: A 25–Year Perspective, Apt, K. R., Marek, V., Truszczynski, M., and Warren, D. S., Eds. Springer-Verlag, 161–192.Google Scholar
Hermenegildo, M. V., Puebla, G., Bueno, F. and Lopez-Garcia, P. 2005. Integrated program debugging, verification, and optimization using abstract interpretation (and the Ciao system preprocessor). Science of Computer Programming 58, 1–2 (October), 115140.Google Scholar
Hojjat, H., Konecný, F., Garnier, F., Iosif, R., Kuncak, V. and Rümmer, P. 2012. A verification toolkit for numerical transition systems—Tool paper. In Proc. of Formal Methods (FM'12). Lecture Notes in Computer Science, vol. 7436. Springer, 247–251.Google Scholar
Kafle, B., Gallagher, J. P. and Morales, J. F. 2016. RAHFT: A tool for verifying Horn clauses using abstract interpretation and finite tree automata. In Proc. of 28th International Conference on Computer Aided Verification Part I (CAV'16), Toronto, ON, Canada, July 17–23, Chaudhuri, S. and Farzan, A., Eds. Lecture Notes in Computer Science, vol. 9779. Springer, 261–268.Google Scholar
Kerrison, S. and Eder, K. 2015. Energy modeling of software for a hardware multithreaded embedded microprocessor. ACM Transactions on Embedded Computing Systems 14, 3 (April), 125.Google Scholar
Lattner, C. and Adve, V. 2004. LLVM: A compilation framework for lifelong program analysis and transformation. In Proc. of the International Symposium on Code Generation and Optimization (CGO'04). IEEE Computer Society, 75–88.Google Scholar
Lichtenstein, Y. and Shapiro, E. Y. 1988. Abstract algorithmic debugging. In Proc. of 5th International Conference and Symposium on Logic Programming, Kowalski, R. A. and Bowen, K. A., Eds. MIT, Seattle, Washington, 512–531.Google Scholar
Liqat, U., Georgiou, K., Kerrison, S., Lopez-Garcia, P., Hermenegildo, M. V., Gallagher, J. P. and Eder, K. 2016. Inferring parametric energy consumption functions at different software levels: ISA vs. LLVM IR. In Proc. of 4th International Workshop on Foundational and Practical Aspects of Resource Analysis (FOPARA'15), London, UK, April 11, 2015. Revised Selected Papers, Eekelen, M. V. and Lago, U. D., Eds. Lecture Notes in Computer Science, vol. 9964. Springer, 81–100.Google Scholar
Liqat, U., Kerrison, S., Serrano, A., Georgiou, K., Lopez-Garcia, P., Grech, N., Hermenegildo, M. V. and Eder, K. 2014. Energy consumption analysis of programs based on XMOS ISA-level models. In Proc. of 23rd International Symposium on Logic-Based Program Synthesis and Transformation (LOPSTR'13), Revised Selected Papers, G. Gupta and R. Peña, Eds. Lecture Notes in Computer Science, vol. 8901. Springer, 72–90.Google Scholar
López-García, P., Ed. 2014. Initial Energy Consumption Analysis. ENTRA Project: Whole-Systems Energy Transparency (FET project 318337). Deliverable 3.2, http://entraproject.eu.Google Scholar
López-García, P., Darmawan, L. and Bueno, F. 2010. A framework for verification and debugging of resource usage properties. In Proc. of Technical Communications of the 26th International Conference on Logic Programming (ICLP'10), Hermenegildo, M. V. and Schaub, T., Eds. Leibniz International Proceedings in Informatics (LIPIcs), vol. 7. Schloss Dagstuhl–Leibniz-Zentrum fuer Informatik, Dagstuhl, Germany, 104–113.Google Scholar
Lopez-Garcia, P., Darmawan, L., Bueno, F. and Hermenegildo, M. V. 2012. Interval-based resource usage verification: Formalization and prototype. In Proc. of 2nd International Workshop on Foundational and Practical Aspects of Resource Analysis (FOPARA'11), Revised Selected Papers, na, R. P., Eekelen, M., and Shkaravska, O., Eds. Lecture Notes in Computer Science, vol. 7177. Springer-Verlag, 54–71.Google Scholar
Lopez-Garcia, P., Haemmerlé, R., Klemen, M., Liqat, U. and Hermenegildo, M. V. 2015. Towards energy consumption verification via static analysis. In Proc. of Workshop on High Performance Energy Efficient Embedded Systems (HIP3ES'15), arXiv:1501.03064. arXiv:1512.09369.Google Scholar
Méndez-Lojo, M., Navas, J. and Hermenegildo, M. 2007. A flexible (C)LP-based approach to the analysis of object-oriented programs. In Proc. of 17th International Symposium on Logic-based Program Synthesis and Transformation (LOPSTR'07). Number 4915 in Lecture Notes in Computer Science. Springer-Verlag, 154–168.Google Scholar
Mera, E., López-García, P. and Hermenegildo, M. V. 2009. Integrating software testing and run-time checking in an assertion verification framework. In Proc. of 25th International Conference on Logic Programming (ICLP'09). Lecture Notes in Computer Science, vol. 5649. Springer-Verlag, 281–295.Google Scholar
Muthukumar, K. and Hermenegildo, M. 1992. Compile-time derivation of variable dependency using abstract interpretation. Journal of Logic Programming 13, 2/3 (July), 315347.Google Scholar
Navas, J., Méndez-Lojo, M. and Hermenegildo, M. 2008. Safe upper-bounds inference of energy consumption for Java Bytecode applications. In Proc of The 6th NASA Langley Formal Methods Workshop (LFM'08). 29–32. Extended Abstract.Google Scholar
Navas, J., Méndez-Lojo, M. and Hermenegildo, M. V. 2009. User-definable resource usage bounds analysis for Java Bytecode. In Proc. of the Workshop on Bytecode Semantics, Verification, Analysis and Transformation (BYTECODE'09). Electronic Notes in Theoretical Computer Science, vol. 253. Elsevier–North Holland, 65–82.Google Scholar
Navas, J., Mera, E., López-García, P. and Hermenegildo, M. 2007. User-definable resource bounds analysis for logic programs. In Proc. of 23rd International Conference on Logic Programming (ICLP'07). Lecture Notes in Computer Science, vol. 4670. Springer.Google Scholar
Nguyen, P. and Horn, D. V. 2015. Relatively complete counterexamples for higher-order programs. In Proc. of Programming Language Design and Implementation (PLDI'15). ACM, 446–456.Google Scholar
Puebla, G., Bueno, F. and Hermenegildo, M. V. 2000a. An assertion language for constraint logic programs. In Analysis and Visualization Tools for Constraint Programming, Deransart, P., Hermenegildo, M. V., and Maluszynski, J., Eds. Number 1870 in Lecture Notes in Computer Science. Springer-Verlag, 23–61.Google Scholar
Puebla, G., Bueno, F. and Hermenegildo, M. V. 2000b. Combined static and dynamic assertion-based debugging of constraint logic programs. In Proc. of Logic-based Program Synthesis and Transformation (LOPSTR'99). Number 1817 in Lecture Notes in Computer Science. Springer-Verlag, 273–292.Google Scholar
Serrano, A., Lopez-Garcia, P. and Hermenegildo, M. V. 2014. 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'14) Special Issue 14, 4–5, 739754.Google Scholar
Tobin-Hochstadt, S. and Van Horn, D. 2012. Higher-order symbolic execution via contracts. In Proc. of Object-Oriented Programming, Systems, Languages, and Applications (OOPSLA'12). ACM, 537–554.Google Scholar
Vaucheret, C. and Bueno, F. 2002. More precise yet efficient type inference for logic programs. In Proc. of 9th International Static Analysis Symposium (SAS'02). Lecture Notes in Computer Science, vol. 2477. Springer-Verlag, 102–116.Google Scholar
Watt, D. 2009. Programming XC on XMOS Devices. XMOS Limited.Google Scholar