A New GCC Plugin-Based Compiler Pass to Add Support for Thread-Level Speculation into OpenMP

  • Sergio Aldea
  • Alvaro Estebanez
  • Diego R. Llanos
  • Arturo Gonzalez-Escribano
Part of the Lecture Notes in Computer Science book series (LNCS, volume 8632)


In this paper we propose a compile-time system that adds support for Thread-Level Speculation (TLS) into OpenMP. Our solution augments the original user code with calls to a TLS library that handles the speculative parallel execution of a given loop, with the help of a new OpenMP speculative clause for variable usage classification. To support it, we have developed a plugin-based compiler pass for GCC that augments the code of the loop. With this approach, we only need one additional code line to speculatively parallelize the code, compared with the tens or hundreds of changes needed (depending on the number of accesses to speculative variables) to manually apply the required transformations. Moreover, the plugin leads to a faster performance than the manual parallelization.


Thread-Level Speculation TLS OpenMP Source code generation GCC plugin 


Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.


  1. 1.
    Chandra, R., Menon, R., et al.: Parallel Programming in OpenMP, 1st edn. Morgan Kaufmann (October 2000)Google Scholar
  2. 2.
    Aldea, S., Llanos, D.R., González-Escribano, A.: Support for thread-level speculation into OpenMP. In: Chapman, B.M., Massaioli, F., Müller, M.S., Rorro, M. (eds.) IWOMP 2012. LNCS, vol. 7312, pp. 275–278. Springer, Heidelberg (2012)CrossRefGoogle Scholar
  3. 3.
    Estebanez, A., Llanos, D.R., Gonzalez-Escribano, A.: New Data Structures to Handle Speculative Parallelization at Runtime. In: Proceedings of HLPP 2014 (2014)Google Scholar
  4. 4.
    Cintra, M., Llanos, D.R.: Toward efficient and robust software speculative parallelization on multiprocessors. In: Proceedings of PPoPP 2003 , pp. 13–24 (June 2003)Google Scholar
  5. 5.
    Cintra, M., Llanos, D.R.: Design space exploration of a software speculative parallelization scheme. IEEE Trans. Parallel Distrib. Syst. 16(6), 562–576 (2005)CrossRefGoogle Scholar
  6. 6.
    Kulkarni, M., Pingali, K., et al.: Optimistic parallelism requires abstractions. In: Proceedings of PLDI 2007, pp. 211–222 (2007)Google Scholar
  7. 7.
    Gupta, M., Nim, R.: Techniques for speculative run-time parallelization of loops. In: Proc. of the 1998 ACM/IEEE Conference on Supercomputing, pp. 1–12 (1998)Google Scholar
  8. 8.
    Rauchwerger, L., Padua, D.: The LRPD test: Speculative run-time parallelization of loops with privatization and reduction parallelization. In: Proceedings of PLDI 1995, pp. 218–232 (1995)Google Scholar
  9. 9.
    Dang, F.H., Yu, H., Rauchwerger, L.: The R-LRPD test: Speculative parallelization of partially parallel loops. In: Proceedings of 16th IPDPS, pp. 20–29 (2002)Google Scholar
  10. 10.
    Xekalakis, P., Ioannou, N., Cintra, M.: Combining thread level speculation helper threads and runahead execution. In: Proceedings of ICS 2009, pp. 410–420 (2009)Google Scholar
  11. 11.
    Gao, L., Li, L., et al.: SEED: A statically greedy and dynamically adaptive approach for speculative loop execution. IEEE Trans. Comput. 62(5), 1004–1016 (2013)MathSciNetCrossRefGoogle Scholar
  12. 12.
    GNU Project: GCC internals (2013),
  13. 13.
    Novillo, D.: GCC an architectural overview, current status, and future directions. In: Proceedings of the Linux Symposium, Tokyo, Japan, pp. 185–200 (September 2006)Google Scholar
  14. 14.
    Novillo, D.: OpenMP and automatic parallelization in GCC. In: Proceedings of the 2006 GCC Developers’ Summit, Ottawa, Canada (2006)Google Scholar
  15. 15.
    Clarkson, K.L., Mehlhorn, K., Seidel, R.: Four results on randomized incremental constructions. Comput. Geom. Theory Appl. 3(4), 185–212 (1993)MathSciNetCrossRefzbMATHGoogle Scholar
  16. 16.
    Devroye, L., Mücke, E.P., Zhu, B.: A note on point location in Delaunay triangulations of random points. Algorithmica 22, 477–482 (1998)MathSciNetCrossRefzbMATHGoogle Scholar
  17. 17.
    Welzl, E.: Smallest enclosing disks (balls and ellipsoids). In: Maurer, H. (ed.) New Results and New Trends in Computer Science. LNCS, vol. 555, pp. 359–370. Springer, Heidelberg (1991)CrossRefGoogle Scholar
  18. 18.
    Barnes, J.E.: TREE. Institute for Astronomy. University of Hawaii (1997),
  19. 19.
    Larus, J., Kozyrakis, C.: Transactional memory. Commun. ACM 51(7), 80–88 (2008)CrossRefGoogle Scholar
  20. 20.
    IBM: Thread-level speculative execution for C/C++. IBM XL C/C++ for Blue Gene, Tech. report (2012)Google Scholar
  21. 21.
    Packirisamy, V., Barathvajasankar, H.: OpenMP in multicore architectures. University of Minnesota, Tech. Rep (2005)Google Scholar
  22. 22.
    Martínez, J.F., Torrellas, J.: Speculative synchronization: Applying thread-level speculation to explicitly parallel applications. In: Proceedings of ASPLOS 2002, pp. 18–29 (2002)Google Scholar
  23. 23.
    Baek, W., Minh, C.C., et al.: The OpenTM transactional application programming interface. In: Proceedings of 16th ISCA, pp. 376–387. IEEE Computer Society (2007)Google Scholar
  24. 24.
    Milovanović, M., Ferrer, R., Unsal, O.S., Cristal, A., Martorell, X., Ayguadé, E., Labarta, J., Valero, M.: Transactional memory and OpenMP. In: Chapman, B., Zheng, W., Gao, G.R., Sato, M., Ayguadé, E., Wang, D. (eds.) IWOMP 2007. LNCS, vol. 4935, pp. 37–53. Springer, Heidelberg (2008)CrossRefGoogle Scholar
  25. 25.
    Wong, M., Bihari, B.L., de Supinski, B.R., Wu, P., Michael, M., Liu, Y., Chen, W.: A case for including transactions in OpenMP. In: Sato, M., Hanawa, T., Müller, M.S., Chapman, B.M., de Supinski, B.R. (eds.) IWOMP 2010. LNCS, vol. 6132, pp. 149–160. Springer, Heidelberg (2010)CrossRefGoogle Scholar
  26. 26.
    Ferri, C., Marongiu, A., et al.: SoC-TM: Integrated HW/SW support for transactional memory programming on embedded MPSoCs. In: Proceedings of CODES+ISSS 2011, pp. 39–48. ACM Press (2011)Google Scholar
  27. 27.
    Starynkevitch, B.: MELT: A translated domain specific language embedded in the GCC compiler. In: Proceedings of IFIP DSL 2011, pp. 118–142 (2011)Google Scholar
  28. 28.
    Fursin, G., Kashnikov, Y., et al.: Milepost GCC: machine learning enabled self-tuning compiler. Int’l. Journal of Parallel Programming 39(3), 296–327 (2011)CrossRefGoogle Scholar
  29. 29.
    Malcolm, D.: GCC python plugin v0.12.(2013), (last visit: May 2014)

Copyright information

© Springer International Publishing Switzerland 2014

Authors and Affiliations

  • Sergio Aldea
    • 1
  • Alvaro Estebanez
    • 1
  • Diego R. Llanos
    • 1
  • Arturo Gonzalez-Escribano
    • 1
  1. 1.Dpto. InformáticaUniversidad de ValladolidValladolidSpain

Personalised recommendations