Specialization through Dynamic Staging

Danilewski, Piotr; Köster, Marcel; Leißa, Roland; Membarth, Richard; Slusallek, Philipp

Partial evaluation allows for specialization of program fragments. This can be realized by staging, where one fragment is executed earlier than its surrounding code. However, taking advantage of these capabilities is often a cumbersome endeavor.

In this paper, we present a new metaprogramming concept using staging parameters that are first-class citizen entities and define the order of execution of the program. Staging parameters can be used to define MetaML-like quotations, but can also allow stages to be created and resolved dynamically. The programmer can write generic, polyvariant code which can be reused in the context of different stages. We demonstrate how our approach can be used to define and apply domain-specific optimizations. Our implementation of the proposed metaprogramming concept generates code which is on a par with templated C++ code in terms of execution time.

In Proceedings of the 13th International Conference on Generative Programming: Concepts & Experiences (GPCE), pp. 103-112, Västerås, Sweden, September 15-16, 2014

[pdf] [doi>10.1145/2658761.2658774]

@inproceedings{danilewski2014specialization,
  author    = {Danilewski, Piotr and Köster, Marcel and Leißa, Roland and Membarth, Richard and Slusallek, Philipp},
  address   = {Västerås, Sweden},
  booktitle = {Proceedings of the 13th International Conference on Generative Programming: Concepts \& Experiences (GPCE)},
  title     = {{Specialization through Dynamic Staging}},
  pages     = {103--112},
  year      = 2014,
  month     = sep,
  date      = {2014-09-15/2014-09-16},
}