Skip to main content

Runtime Code Generation in C++ as a Foundation for Domain-Specific Optimisation

  • Chapter
Domain-Specific Program Generation

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

Abstract

The TaskGraph Library is a C++ library for dynamic code generation, which combines specialisation with dependence analysis and loop restructuring. A TaskGraph represents a fragment of code which is constructed and manipulated at runtime, then compiled, dynamically linked and executed. TaskGraphs are initialised using macros and overloading, which forms a simplified, C-like sub-language with first-class arrays and no pointers. Once a TaskGraph has been constructed, we can analyse its dependence structure and perform optimisations. In this Chapter, we present the design of the TaskGraph library, and two sample applications to demonstrate its use for runtime code specialisation and restructuring optimisation.

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

Access this chapter

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

Institutional subscriptions

Preview

Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.

References

  1. Wilson, R.P., French, R.S., Wilson, C.S., Amarasinghe, S.P., Anderson, J.M., Tjiang, S.W.K., Liao, S.W., Tseng, C.W., Hall, M.W., Lam, M.S., Hennessy, J.L.: SUIF: an infrastructure for research on parallelizing and optimizing compilers. ACM SIGPLAN Notices 29, 31–37 (1994)

    Article  Google Scholar 

  2. Engler, D.R., Hsieh, W.C., Kaashoek, M.F.: C: a language for high-level, efficient, and machine-independent dynamic code generation. In: POPL 1996: Principles of Programming Languages, pp. 131–144 (1996)

    Google Scholar 

  3. Grant, B., Mock, M., Philipose, M., Chambers, C., Eggers, S.J.: DyC: An expressive annotation-directed dynamic compiler for C. Theoretical Computer Science 248, 147–199 (2000)

    Article  MATH  Google Scholar 

  4. McCarthy, J.: History of LISP. In: The first ACM SIGPLAN Conference on History of Programming Languages. ACM SIGPLAN Notices, vol. 13(8), pp. 217–223 (1978)

    Google Scholar 

  5. Grant, B., Philipose, M., Mock, M., Chambers, C., Eggers, S.J.: An evaluation of staged run-time optimizations in DyC. In: PLDI 1999: Programming Language Design and Implementation, pp. 293–304 (1999)

    Google Scholar 

  6. Jones, N.D.: Mix Ten Years Later. In: PEPM 1995: Partial Evaluation and Semantics-Based Program Manipulation (1995)

    Google Scholar 

  7. Intel Corporation: Integrated Performance Primitives for Intel Architecture. Reference Manual, vol. 2: Image and Video Processing (200–2001)

    Google Scholar 

  8. Intel Corporation: Intel Pentium 4 and Intel Xeon Processor Optimization Reference Manual (1999–2002) Available via developer.intel.com

    Google Scholar 

  9. Whaley, R.C., Petitet, A., Dongarra, J.J.: Automated empirical optimizations of software and the ATLAS project. Parallel Computing 27, 3–35 (2001)

    Article  MATH  Google Scholar 

  10. Batory, D., Lofaso, B., Smaragdakis, Y.: JTS: Tools for Implementing Domain- Specific Languages. In: Fifth International Conference on Software Reuse. IEEE Computer Society Press, Los Alamitos (1998)

    Google Scholar 

  11. Taha, W., Sheard, T.: MetaML and multi-stage programming with explicit annotations. Theoretical Computer Science 248, 211–242 (2000)

    Article  MATH  Google Scholar 

  12. Taha, W.: A gentle introduction to multi-stage programming. In: Gelenbe, E., Kaiser, C. (eds.) Operating Systems. LNCS, vol. 16. Springer, Heidelberg (1981)

    Google Scholar 

  13. Sheard, T., Peyton-Jones, S.: Template meta-programming for Haskell. ACM SIGPLAN Notices 37, 60–75 (2002)

    Article  Google Scholar 

  14. Veldhuizen, T.L.: Arrays in Blitz++. In: Caromel, D., Oldehoeft, R.R., Tholburn, M. (eds.) ISCOPE 1998. LNCS, vol. 1505, pp. 223–230. Springer, Heidelberg (1998)

    Chapter  Google Scholar 

  15. Karmesin, S., Crotinger, J., Cummings, J., Haney, S., Humphrey, W.J., Reynders, J., Smith, S., Williams, T.: Array design and expression evaluation in POOMA II. In: Caromel, D., Oldehoeft, R.R., Tholburn, M. (eds.) ISCOPE 1998. LNCS, vol. 1505, pp. 231–238. Springer, Heidelberg (1998)

    Chapter  Google Scholar 

  16. Marlet, R., Consel, C., Boinot, P.: Efficient incremental run-time specialization for free. ACM SIGPLAN Notices 34, 281–292 (1999); Proceedings of PLDI 1999

    Article  Google Scholar 

  17. Consel, C., Hornof, L., Marlet, R., Muller, G., Thibault, S., Volanschi, E.N.: Tempo: Specializing systems applications and beyond. ACM Computing Surveys 30 (1998)

    Google Scholar 

  18. Glück, R., Jørgensen, J.: Fast binding-time analysis for multi-level specialization. In: Bjorner, D., Broy, M., Pottosin, I.V. (eds.) PSI 1996. LNCS, vol. 1181, pp. 261–272. Springer, Heidelberg (1996)

    Google Scholar 

  19. Sharma, S., Acharya, A., Saltz, J.: Deferred Data-Flow Analysis. Technical Report TRCS98-38, University of California, Santa Barbara (1998)

    Google Scholar 

  20. Bala, V., Duesterwald, E., Banerjia, S.: Dynamo: A transparent dynamic optimization system. In: PLDI 2000: Programming Language Design and Implementation, pp. 1–12 (2000)

    Google Scholar 

  21. Fordham, P.: Transparent run-time cross-component loop fusion. MEng Thesis, Department of Computing, Imperial College London (2002)

    Google Scholar 

  22. http://www.opnemp.org : OpenMP C and C++ Application Program Interface, Version 2.0 (2002)

  23. Liniker, P., Beckmann, O., Kelly, P.H.J.: Delayed evaluation, self-optimising software components as a programming model. In: Monien, B., Feldmann, R.L. (eds.) Euro-Par 2002. LNCS, vol. 2400, pp. 666–673. Springer, Heidelberg (2002)

    Chapter  Google Scholar 

  24. Subramanian, M.: A C++ library to manipulate parallel computation plans. Msc thesis, Department of Computing, Imperial College London, U.K. (2001)

    Google Scholar 

  25. Lengauer, C.: Program optimization in the domain of high-performance parallelism. In: Lengauer, C., Batory, D., Consel, C., Odersky, M. (eds.) Domain-Specific Program Generation. LNCS, vol. 3016, pp. 73–91. Springer, Heidelberg (2004)

    Chapter  Google Scholar 

  26. Veldhuizen, T.L.: C++ templates as partial evaluation. In: PEPM 1999: Partial Evaluation and Semantic-Based Program Manipulation, pp. 13–18 (1999)

    Google Scholar 

  27. Czarnecki, K., O’Donnell, J., Striegnitz, J., Taha, W.: DSL Implementation in MetaOCaml, Template Haskell, and C++. In: Lengauer, C., Batory, D., Consel, C., Odersky, M. (eds.) Domain-Specific Program Generation. LNCS, vol. 3016, pp. 51–72. Springer, Heidelberg (2004)

    Chapter  Google Scholar 

  28. Visser, E.: Program Transformation with Stratego/XT: Rules, Strategies, Tools, and Systems in Stratego/XT 0.9. In: Lengauer, C., Batory, D., Consel, C., Odersky, M. (eds.) Domain-Specific Program Generation. LNCS, vol. 3016, pp. 216–238. Springer, Heidelberg (2004)

    Chapter  Google Scholar 

Download references

Author information

Authors and Affiliations

Authors

Editor information

Editors and Affiliations

Rights and permissions

Reprints and permissions

Copyright information

© 2004 Springer-Verlag Berlin Heidelberg

About this chapter

Cite this chapter

Beckmann, O., Houghton, A., Mellor, M., Kelly, P.H.J. (2004). Runtime Code Generation in C++ as a Foundation for Domain-Specific Optimisation. In: Lengauer, C., Batory, D., Consel, C., Odersky, M. (eds) Domain-Specific Program Generation. Lecture Notes in Computer Science, vol 3016. Springer, Berlin, Heidelberg. https://doi.org/10.1007/978-3-540-25935-0_17

Download citation

  • DOI: https://doi.org/10.1007/978-3-540-25935-0_17

  • Publisher Name: Springer, Berlin, Heidelberg

  • Print ISBN: 978-3-540-22119-7

  • Online ISBN: 978-3-540-25935-0

  • eBook Packages: Springer Book Archive

Publish with us

Policies and ethics