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.
Access this chapter
Tax calculation will be finalised at checkout
Purchases are for personal use only
Preview
Unable to display preview. Download preview PDF.
References
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)
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)
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)
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)
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)
Jones, N.D.: Mix Ten Years Later. In: PEPM 1995: Partial Evaluation and Semantics-Based Program Manipulation (1995)
Intel Corporation: Integrated Performance Primitives for Intel Architecture. Reference Manual, vol. 2: Image and Video Processing (200–2001)
Intel Corporation: Intel Pentium 4 and Intel Xeon Processor Optimization Reference Manual (1999–2002) Available via developer.intel.com
Whaley, R.C., Petitet, A., Dongarra, J.J.: Automated empirical optimizations of software and the ATLAS project. Parallel Computing 27, 3–35 (2001)
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)
Taha, W., Sheard, T.: MetaML and multi-stage programming with explicit annotations. Theoretical Computer Science 248, 211–242 (2000)
Taha, W.: A gentle introduction to multi-stage programming. In: Gelenbe, E., Kaiser, C. (eds.) Operating Systems. LNCS, vol. 16. Springer, Heidelberg (1981)
Sheard, T., Peyton-Jones, S.: Template meta-programming for Haskell. ACM SIGPLAN Notices 37, 60–75 (2002)
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)
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)
Marlet, R., Consel, C., Boinot, P.: Efficient incremental run-time specialization for free. ACM SIGPLAN Notices 34, 281–292 (1999); Proceedings of PLDI 1999
Consel, C., Hornof, L., Marlet, R., Muller, G., Thibault, S., Volanschi, E.N.: Tempo: Specializing systems applications and beyond. ACM Computing Surveys 30 (1998)
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)
Sharma, S., Acharya, A., Saltz, J.: Deferred Data-Flow Analysis. Technical Report TRCS98-38, University of California, Santa Barbara (1998)
Bala, V., Duesterwald, E., Banerjia, S.: Dynamo: A transparent dynamic optimization system. In: PLDI 2000: Programming Language Design and Implementation, pp. 1–12 (2000)
Fordham, P.: Transparent run-time cross-component loop fusion. MEng Thesis, Department of Computing, Imperial College London (2002)
http://www.opnemp.org : OpenMP C and C++ Application Program Interface, Version 2.0 (2002)
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)
Subramanian, M.: A C++ library to manipulate parallel computation plans. Msc thesis, Department of Computing, Imperial College London, U.K. (2001)
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)
Veldhuizen, T.L.: C++ templates as partial evaluation. In: PEPM 1999: Partial Evaluation and Semantic-Based Program Manipulation, pp. 13–18 (1999)
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)
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)
Author information
Authors and Affiliations
Editor information
Editors and Affiliations
Rights 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