Skip to main content

Semantic Foundations for Cost Analysis of Pipeline-Optimized Programs

  • Conference paper
  • First Online:
Static Analysis (SAS 2022)

Part of the book series: Lecture Notes in Computer Science ((LNCS,volume 13790))

Included in the following conference series:

  • 662 Accesses

Abstract

In this paper, we develop semantic foundations for precise cost analyses of programs running on architectures with multi-scalar pipelines and in-order execution with branch prediction. This model is then used to prove the correction of an automatic cost analysis we designed. The analysis is implemented and evaluated in an extant framework for high-assurance cryptography. In this field, developers aggressively hand-optimize their code to take maximal advantage of micro-architectural features while looking for provable semantic guarantees.

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

Access this chapter

Subscribe and save

Springer+ Basic
$34.99 /Month
  • Get 10 units per month
  • Download Article/Chapter or eBook
  • 1 Unit = 1 Article or 1 Chapter
  • Cancel anytime
Subscribe now

Buy Now

Chapter
USD 29.95
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever

Tax calculation will be finalised at checkout

Purchases are for personal use only

Institutional subscriptions

Similar content being viewed by others

Notes

  1. 1.

    Currently, Jasmin only supports x86 architectures. Note however that our method is not specific to x86, and can be applied to other architectures.

References

  1. Companion report. https://hal.inria.fr/hal-03779257

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

    Article  MathSciNet  MATH  Google Scholar 

  3. Almeida, J.B., et al.: Jasmin: high-assurance and high-speed cryptography. In: Proceedings of CCS’2017, pp. 1807–1823. ACM (2017)

    Google Scholar 

  4. Almeida, J.B., et al.: The last mile: high-assurance and high-speed cryptographic implementations. In: Proceedings of S &P’2020, pp. 965–982. IEEE (2020)

    Google Scholar 

  5. Barbosa, M., et al.: SoK: computer-aided cryptography. In: Proceedings of S &P 2021, pp. 777–795. IEEE (2021)

    Google Scholar 

  6. Barthe, G., Dupressoir, F., Grégoire, B., Kunz, C., Schmidt, B., Strub, P.-Y.: EasyCrypt: a tutorial. In: Aldini, A., Lopez, J., Martinelli, F. (eds.) FOSAD 2012-2013. LNCS, vol. 8604, pp. 146–166. Springer, Cham (2014). https://doi.org/10.1007/978-3-319-10082-1_6

    Chapter  Google Scholar 

  7. Bernstein, D.J.: The Poly1305-AES message-authentication code. In: Gilbert, H., Handschuh, H. (eds.) FSE 2005. LNCS, vol. 3557, pp. 32–49. Springer, Heidelberg (2005). https://doi.org/10.1007/11502760_3

    Chapter  Google Scholar 

  8. Bernstein, D.J.: Curve25519: new Diffie-Hellman speed records. In: Yung, M., Dodis, Y., Kiayias, A., Malkin, T. (eds.) PKC 2006. LNCS, vol. 3958, pp. 207–228. Springer, Heidelberg (2006). https://doi.org/10.1007/11745853_14

    Chapter  Google Scholar 

  9. Bernstein, D.J.: ChaCha, a variant of Salsa20. In: Workshop Record of SASC 2008: The State of the Art of Stream Ciphers (2008)

    Google Scholar 

  10. Cauligi, S., et al.: Constant-time foundations for the new spectre era. In: Proceedings of PLDI’2020, pp. 913–926. ACM (2020)

    Google Scholar 

  11. Çiçek, E., Barthe, G., Gaboardi, M., Garg, D., Hoffmann, J.: Relational cost analysis. In: Proceedings of POPL 2017, pp. 316–329. ACM (2017)

    Google Scholar 

  12. Cousot, P., Cousot, R.: Abstract interpretation: a unified lattice model for static analysis of programs by construction or approximation of fixpoints. In: Proceedings of POPL 1977, pp. 238–252. ACM (1977)

    Google Scholar 

  13. Cousot, P., et al.: The ASTREÉ analyzer. In: Sagiv, M. (ed.) ESOP 2005. LNCS, vol. 3444, pp. 21–30. Springer, Heidelberg (2005). https://doi.org/10.1007/978-3-540-31987-0_3

    Chapter  Google Scholar 

  14. Crary, K., Weirich, S.: Resource bound certification. In: Proceedings of POPL 2000, pp. 184–198. ACM (2000)

    Google Scholar 

  15. Daemen, J., Rijmen, V.: AES proposal: Rijndael, version 2 (1999). http://csrc.nist.gov/archive/aes/rijndael/Rijndael-ammended.pdf

  16. Ferdinand, C., et al.: Reliable and precise WCET determination for a real-life processor. In: Henzinger, T.A., Kirsch, C.M. (eds.) EMSOFT 2001. LNCS, vol. 2211, pp. 469–485. Springer, Heidelberg (2001). https://doi.org/10.1007/3-540-45449-7_32

    Chapter  Google Scholar 

  17. Fog, A.: The microarchitecture of Intel, AMD and VIA CPUs - An optimization guide for assembly programmers and compiler makers (2020). https://www.agner.org/optimize/microarchitecture.pdf

  18. Fog, A.: The microarchitecture of Intel, AMD and VIA CPUs - instruction tables (2020). https://www.agner.org/optimize/instruction_tables.pdf

  19. Gulwani, S., Mehra, K.K., Chilimbi, T.M.: SPEED: precise and efficient static estimation of program computational complexity. In: Proceedings of POPL 2009, pp. 127–139. ACM (2009)

    Google Scholar 

  20. Hahn, S., Reineke, J.: Design and analysis of SIC: a provably timing-predictable pipelined processor core. In: Proceedings of RTSS 2018, pp. 469–481. IEEE (2018)

    Google Scholar 

  21. Hughes, J., Pareto, L.: Recursion and dynamic data-structures in bounded space: towards embedded ML programming. In: Proceedings of ICFP 1999. pp. 70–81. ACM (1999)

    Google Scholar 

  22. Knoth, T., Wang, D., Polikarpova, N., Hoffmann, J.: Resource-guided program synthesis. In: Proceedings of PLDI 2019, pp. 253–268. ACM (2019)

    Google Scholar 

  23. Knoth, T., Wang, D., Reynolds, A., Hoffmann, J., Polikarpova, N.: Liquid resource types. In: Proceedings of ICFP 2020, pp. 106:1–106:29 (2020)

    Google Scholar 

  24. Ngo, V.C., Dehesa-Azuara, M., Fredrikson, M., Hoffmann, J.: Verifying and synthesizing constant-resource implementations with types. In: Proceedings of SP 2017, pp. 710–728. IEEE Computer Society (2017)

    Google Scholar 

  25. Nielson, H.R.: A Hoare-like proof system for analysing the computation time of programs. Sci. Comput. Program. 9(2), 107–136 (1987)

    Article  MathSciNet  MATH  Google Scholar 

  26. Reistad, B., Gifford, D.K.: Static dependent costs for estimating execution time. In: Proceedings of LFP1994, pp. 65–78. ACM (1994)

    Google Scholar 

  27. Reparaz, O., Balasch, J., Verbauwhede, I.: Dude, is my code constant time? In: Proceedings of DATE 2017, pp. 1697–1702. IEEE (2017)

    Google Scholar 

  28. Wegbreit, B.: Verifying program performance. J. ACM 23(4), 691–699 (1976)

    Article  MathSciNet  MATH  Google Scholar 

  29. Wilhelm, R., Grund, D., Reineke, J., Schlickling, M., Pister, M., Ferdinand, C.: Memory hierarchies, pipelines, and buses for future architectures in time-critical embedded systems. IEEE Trans. Comput. Aided Des. Integr. Circuits Syst. 28(7), 966–978 (2009)

    Google Scholar 

  30. Yourst, M.T.: PTLsim: a cycle accurate full system x86-64 microarchitectural simulator. In: Proceedings of ISPASS 2019, pp. 23–34. IEEE Computer Society (2007)

    Google Scholar 

Download references

Author information

Authors and Affiliations

Authors

Corresponding author

Correspondence to David Pichardie .

Editor information

Editors and Affiliations

Rights and permissions

Reprints and permissions

Copyright information

© 2022 The Author(s), under exclusive license to Springer Nature Switzerland AG

About this paper

Check for updates. Verify currency and authenticity via CrossMark

Cite this paper

Barthe, G., Koutsos, A., Mirliaz, S., Pichardie, D., Schwabe, P. (2022). Semantic Foundations for Cost Analysis of Pipeline-Optimized Programs. In: Singh, G., Urban, C. (eds) Static Analysis. SAS 2022. Lecture Notes in Computer Science, vol 13790. Springer, Cham. https://doi.org/10.1007/978-3-031-22308-2_17

Download citation

  • DOI: https://doi.org/10.1007/978-3-031-22308-2_17

  • Published:

  • Publisher Name: Springer, Cham

  • Print ISBN: 978-3-031-22307-5

  • Online ISBN: 978-3-031-22308-2

  • eBook Packages: Computer ScienceComputer Science (R0)

Publish with us

Policies and ethics