Skip to main content

Verifying Fence Elimination Optimisations

  • Conference paper

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

Abstract

We consider simple compiler optimisations for removing redundant memory fences in programs running on top of the x86-TSO relaxed memory model. While the optimisations are performed using standard thread-local control flow analyses, their correctness is subtle and relies on a non-standard global simulation argument. The implementation and the proof of correctness are programmed in Coq as part of CompCertTSO, a fully-fledged certified compiler from a concurrent extension of a C-like language to x86 assembler. In this article, we describe the soundness proof of the optimisations and evaluate their effectiveness.

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 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

Preview

Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.

References

  1. Abadi, M., Lamport, L.: The existence of refinement mappings. Theor. Comput. Sci., 253–284 (1991)

    Google Scholar 

  2. Alglave, J.: A shared memory poetics. Ph.D. thesis, Université Paris 7 (2010)

    Google Scholar 

  3. Becker, P.: Working draft, standard for programming language C++, n3090=10-0080 (March 2010)

    Google Scholar 

  4. Blazy, S., Leroy, X.: Mechanized semantics for the Clight subset of the C language. J. Autom. Reasoning 43(3), 263–288 (2009)

    Article  MathSciNet  MATH  Google Scholar 

  5. Burckhardt, S., Alur, R., Martin, M.M.K.: CheckFence: checking consistency of concurrent data types on relaxed memory models. In: PLDI (2007)

    Google Scholar 

  6. Burckhardt, S., Musuvathi, M., Singh, V.: Verifying local transformations on relaxed memory models. In: Gupta, R. (ed.) CC 2010. LNCS, vol. 6011, pp. 104–123. Springer, Heidelberg (2010)

    Chapter  Google Scholar 

  7. Cao Minh, C., Chung, J., Kozyrakis, C., Olukotun, K.: STAMP: Stanford transactional applications for multi-processing. In: IISWC (2008)

    Google Scholar 

  8. The Compcert verified compiler, v. 1.5 (August 2009), http://compcert.inria.fr/release/compcert-1.5.tgz

  9. CompCertTSO (2011), http://www.cl.cam.ac.uk/~pes20/CompCertTSO

  10. Dice, D., Shalev, O., Shavit, N.N.: Transactional locking II. In: Dolev, S. (ed.) DISC 2006. LNCS, vol. 4167, pp. 194–208. Springer, Heidelberg (2006)

    Chapter  Google Scholar 

  11. Eide, E., Regehr, J.: Volatiles are miscompiled, and what to do about it. In: EMSOFT (2008)

    Google Scholar 

  12. Fraser, K.: Practical Lock Freedom. Ph.D. thesis, University of Cambridge, also available as Tech. Report UCAM-CL-TR-639 (2003)

    Google Scholar 

  13. Huynh, T.Q., Roychoudhury, A.: Memory model sensitive bytecode verification. Form. Methods Syst. Des. 31, 281–305 (2007)

    Article  MATH  Google Scholar 

  14. Kuperstein, M., Vechev, M., Yahav, E.: Automatic inference of memory fences. In: FMCAD (2010)

    Google Scholar 

  15. Lee, J., Padua, D.A.: Hiding relaxed memory consistency with a compiler. IEEE Trans. Comput. 50, 824–833 (2001)

    Article  Google Scholar 

  16. Leroy, X.: A formally verified compiler back-end. Journal of Automated Reasoning 43(4), 363–446 (2009), http://gallium.inria.fr/~xleroy/publi/compcert-backend.pdf

    Article  MathSciNet  MATH  Google Scholar 

  17. Lynch, N., Vaandrager, F.: Forward and backward simulations I: untimed systems. Inf. Comput. 121, 214–233 (1995)

    Article  MathSciNet  MATH  Google Scholar 

  18. Manson, J., Pugh, W., Adve, S.: The Java memory model. In: POPL (2005)

    Google Scholar 

  19. Morel, E., Renvoise, C.: Global optimization by suppression of partial redundancies. Commun. ACM 22, 96–103 (1979)

    Article  MathSciNet  MATH  Google Scholar 

  20. Owens, S., Sarkar, S., Sewell, P.: A better x86 memory model: x86-TSO. In: Berghofer, S., Nipkow, T., Urban, C., Wenzel, M. (eds.) TPHOLs 2009. LNCS, vol. 5674, pp. 391–407. Springer, Heidelberg (2009)

    Chapter  Google Scholar 

  21. Sarkar, S., Sewell, P., Alglave, J., Maranget, L., Williams, D.: Understanding POWER multiprocessors. In: PLDI (2011)

    Google Scholar 

  22. Ševčík, J., Aspinall, D.: On validity of program transformations in the java memory model. In: Ryan, M. (ed.) ECOOP 2008. LNCS, vol. 5142, pp. 27–51. Springer, Heidelberg (2008)

    Chapter  Google Scholar 

  23. Ševčik, J.: Safe optimisations for shared-memory concurrent programs. In: PLDI (2011)

    Google Scholar 

  24. Ševčik, J., Vafeiadis, V., Zappa Nardelli, F., Jagannathan, S., Sewell, P.: Relaxed-memory concurrency and verified compilation. In: POPL (2011)

    Google Scholar 

  25. Sewell, P., Sarkar, S., Owens, S., Zappa Nardelli, F., Myreen, M.O.: x86-TSO: a rigorous and usable programmer’s model for x86 multiprocessors. Commun. ACM 53(7), 89–97 (2010)

    Article  Google Scholar 

  26. Shasha, D., Snir, M.: Efficient and correct execution of parallel programs that share memory. ACM Trans. Program. Lang. Syst. 10, 282–312 (1988)

    Article  Google Scholar 

  27. Sura, Z., Fang, X., Wong, C.-L., Midkiff, S.P., Lee, J., Padua, D.: Compiler techniques for high performance sequentially consistent Java programs. In: PPoPP (2005)

    Google Scholar 

  28. Terekhov, A.: Brief tentative example x86 implementation for C/C++ memory model. cpp-threads mailing list (2008), http://www.decadent.org.uk/pipermail/cpp-threads/2008-December/001933.html

  29. Treiber, R.K.: Systems programming: Coping with parallelism. Tech. rep. (1986)

    Google Scholar 

Download references

Author information

Authors and Affiliations

Authors

Editor information

Editors and Affiliations

Rights and permissions

Reprints and permissions

Copyright information

© 2011 Springer-Verlag Berlin Heidelberg

About this paper

Cite this paper

Vafeiadis, V., Zappa Nardelli, F. (2011). Verifying Fence Elimination Optimisations. In: Yahav, E. (eds) Static Analysis. SAS 2011. Lecture Notes in Computer Science, vol 6887. Springer, Berlin, Heidelberg. https://doi.org/10.1007/978-3-642-23702-7_14

Download citation

  • DOI: https://doi.org/10.1007/978-3-642-23702-7_14

  • Publisher Name: Springer, Berlin, Heidelberg

  • Print ISBN: 978-3-642-23701-0

  • Online ISBN: 978-3-642-23702-7

  • eBook Packages: Computer ScienceComputer Science (R0)

Publish with us

Policies and ethics