skip to main content
10.1145/2633628.2633632acmconferencesArticle/Chapter ViewAbstractPublication PagesicfpConference Proceedingsconference-collections
research-article

First-class isomorphic specialization by staged evaluation

Published: 26 August 2014 Publication History

Abstract

The state of the art approach for reducing complexity in software development is to use abstraction mechanisms of programming languages such as modules, types, higher-order functions etc. and develop high-level frameworks and domain-specific abstractions. Abstraction mechanisms, however, along with simplicity, introduce also execution overhead and often lead to significant performance degradation. Avoiding abstractions in favor of performance, on the other hand, increases code complexity and cost of maintenance.
We develop a systematic approach and formalized framework for implementing software components with a first-class specialization capability. We show how to extend a higher-order functional language with abstraction mechanisms carefully designed to provide automatic and guaranteed elimination of abstraction overhead.
We propose staged evaluation as a new method of program staging and show how it can be implemented as zipper-based traversal of program terms where one-hole contexts are generically constructed from the abstract syntax of the language.
We show how generic programming techniques together with staged evaluation lead to a very simple yet powerful method of isomorphic specialization which utilizes first-class definitions of isomorphisms between data types to provide guarantee of abstraction elimination.
We give a formalized description of the isomorphic specialization algorithm and show how it can be implemented as a set of term rewriting rules using active patterns and staged evaluation.
We implemented our approach as a generic programming framework with first-class staging, term rewriting and isomorphic specialization and show in our evaluation that the proposed capabilities give rise to a new paradigm to develop domain-specific software components without abstraction penalty.

References

[1]
Shapeless: Generic Programming for Scala. http://typelevel.org/.
[2]
Failure is not an option: Popular parallel programming. Technical report, Workshop on Advancing Computer Architecture Research (ACAR-1), 2010.
[3]
Philipp Haller Adriaan Moors, Tiark Rompf and Martin Odersky. Tool Demo: Scala-Virtualized, 2011.
[4]
Baris Aktemur, Yukiyoshi Kameyama, Oleg Kiselyov, and Chung chieh Shan. Shonan challenge for generative programming: short position paper. In PEPM, pages 147--154, 2013.
[5]
Kevin J. Brown, Arvind K. Sujeeth, Hyoukjoong Lee, Tiark Rompf, Hassan Chafi, Martin Odersky, and Kunle Olukotun. A heterogeneous parallel framework for domain-specific languages. volume 2011 International Conference on Parallel Architectures and Compilation Techniques, 2011.
[6]
Manuel M. T. Chakravarty and Gabriele Keller. More Types for Nested Data Parallel Programming. In Proceedings ICFP 2000: International Conference on Functional Programming, pages 94--105. ACM Press, 2000.
[7]
Manuel M. T. Chakravarty, Gabriele Keller, Simon Peyton Jones, and Simon Marlow. Associated Types with Class. In POPL '05: Proceedings of the 32nd ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages, pages 1--13. ACM Press, 2005.
[8]
Manuel M. T. Chakravarty, Roman Leshchinskiy, Simon Peyton Jones, Gabriele Keller, and Simon Marlow. Data Parallel Haskell: a status report. In DAMP 2007: Workshop on Declarative Aspects of Multicore Programming. ACMPress, 2007.
[9]
Olivier Danvy. On evaluation contexts, continuations, and the rest of the computation. ACM SIGPLAN Workshop on Continuations, 2004.
[10]
Olivier Danvy and Jacob Johannsen. Inter-deriving semantic artifacts for objectoriented programming. In Wilfrid Hodges and Ruy de Queiroz, editors, Logic, Language, Information and Computation, volume 5110 of Lecture Notes in Computer Science, pages 1--16. Springer Berlin Heidelberg, 2008.
[11]
Burak Emir,Martin Odersky, and JohnWilliams. Matching object with patterns. In Proceedings of the 21st European Conference on Object-Oriented Programming, ECOOP'07, pages 273--298, Berlin, Heidelberg, 2007. Springer-Verlag.
[12]
William Gropp, Steven Huss-Lederman, Andrew Lumsdaine, Ewing Lusk, Bill Nitzberg, William Saphir, and Marc Snir. MPI: The Complete Reference (Vol. Technical report, The MIT Press, 1998.
[13]
Christian Hofer, Klaus Ostermann, Tillmann Rendel, and Adriaan Moors. Polymorphic embedding of DSLs. In Proceedings of the 7th international conference on Generative programming and component engineering, GPCE '08, pages 137--148, New York, NY, USA, 2008. ACM.
[14]
Stefan Holdermans, Johan Jeuring, Andres Löh, and Alexey Rodriguez. Generic views on data types. In Tarmo Uustalu, editor, Proceedings 8th International Conference on Mathematics of Program Construction, MPC'06, volume 4014 of LNCS, pages 209--234. Springer-Verlag, 2006.
[15]
Gérard Huet. The zipper. J. Funct. Program., 7(5):549--554, September 1997.
[16]
Atsushi Igarashi, BC Pierce, and Philip Wadler. Featherweight Java : A Minimal Core Calculus for Java and GJ. ACM Transactions on Programming . . . , 23(3):396--450, 2001.
[17]
Stefan Kahrs. Unlimp uniqueness as a leitmotiv for implementation. In Maurice Bruynooghe and Martin Wirsing, editors, Programming Language Implementation and Logic Programming, volume 631 of Lecture Notes in Computer Science, pages 115--129. Springer Berlin Heidelberg, 1992.
[18]
Roman Leshchinskiy, Manuel M. T. Chakravarty, and Gabriele Keller. Higher Order Flattening. In International Conference on Computational Science (2), pages 920--928, 2006.
[19]
Conor Mcbride. The derivative of a regular type is its type of one-hole contexts (extended abstract), 2001.
[20]
NVIDIA. NVIDIA CUDA C Programming Guide, 2011.
[21]
Tiark Rompf. Lightweight Modular Staging and Embedded Compilers. PhD thesis, IC, Lausanne, 2012.
[22]
Tiark Rompf and Martin Odersky. Lightweight modular staging: a pragmatic approach to runtime code generation and compiled dsls. In Proceedings of the ninth international conference on Generative programming and component engineering, GPCE '10, pages 127--136, New York, NY, USA, 2010. ACM.
[23]
Tiark Rompf, Arvind K. Sujeeth, Nada Amin, Kevin J. Brown, Vojin Jovanovic, HyoukJoong Lee,Manohar Jonnalagedda, Kunle Olukotun, and Martin Odersky. Optimizing data structures in high-level programs: new directions for extensible compilers based on staging. In POPL, pages 497--510, 2013.
[24]
Tiark Rompf, Arvind K. Sujeeth, HyoukJoong Lee, Kevin J. Brown, Hassan Chafi, Martin Odersky, and Kunle Olukotun. Building-Blocks for Performance Oriented DSLs. In DSL, pages 93--117, 2011.
[25]
Masataka Sassa and Eiichi Goto. A hashing method for fast set operations. Inf. Process. Lett., 5(2):31--34, 1976.
[26]
Jens Peter Secher. Driving-based program transformation in theory and practice, 2002.
[27]
Alexander Slesarenko. Scalan: polytypic library for nested parallelism in Scala. Preprint 22, Keldysh Institute of Applied Mathematics, 2011.
[28]
Alexander V. Slesarenko. Lightweight Polytypic Staging of DSLs in Scala. In S.A. Romanenko A.V. Klimov, editor, Proceedings of the Third International Valentin TurchinWorkshop onMetacomputation, pages pp.228--256. Ailamazyan University of Pereslavl, July 2012.
[29]
Arvind K. Sujeeth, Austin Gibbons, Kevin J. Brown, HyoukJoong Lee, Tiark Rompf, Martin Odersky, and Kunle Olukotun. Forge: generating a high performance DSL implementation from a declarative specification. In GPCE, pages 145--154, 2013.
[30]
Arvind K. Sujeeth, Tiark Rompf, Kevin J. Brown, HyoukJoong Lee, Hassan Chafi, Victoria Popic, MichaelWu, Aleksandar Prokopec, Vojin Jovanovic,Martin Odersky, and Kunle Olukotun. Composition and reuse with compiled domainspecific languages. In ECOOP, pages 52--78, 2013.
[31]
Don Syme, Gregory Neverov, and JamesMargetson. Extensible pattern matching via a lightweight language extension. In Proceedings of the 12th ACM SIGPLAN International Conference on Functional Programming, ICFP '07, pages 29--40, New York, NY, USA, 2007. ACM.
[32]
Walid Taha and Tim Sheard. Multi-stage programming with explicit annotations. SIGPLAN Not., 32(12):203--217, December 1997.
[33]
Matei Zaharia, Mosharaf Chowdhury, Tathagata Das, Ankur Dave, Justin Ma, Murphy Mccauley, Michael J. Franklin, Scott Shenker, and Ion Stoica. Resilient distributed datasets: A fault-tolerant abstraction for in-memory cluster computing, 2011.

Cited By

View all
  • (2017)Staging for generic programming in space and timeACM SIGPLAN Notices10.1145/3170492.313606052:12(15-28)Online publication date: 23-Oct-2017
  • (2017)Staging for generic programming in space and timeProceedings of the 16th ACM SIGPLAN International Conference on Generative Programming: Concepts and Experiences10.1145/3136040.3136060(15-28)Online publication date: 23-Oct-2017
  • (2017)LMS-Verify: abstraction without regret for verified systems programmingACM SIGPLAN Notices10.1145/3093333.300986752:1(859-873)Online publication date: 1-Jan-2017
  • Show More Cited By

Index Terms

  1. First-class isomorphic specialization by staged evaluation

    Recommendations

    Comments

    Information & Contributors

    Information

    Published In

    cover image ACM Conferences
    WGP '14: Proceedings of the 10th ACM SIGPLAN workshop on Generic programming
    August 2014
    102 pages
    ISBN:9781450330428
    DOI:10.1145/2633628
    • Program Chairs:
    • José Pedro Magalhäes,
    • Tiark Rompf
    Permission to make digital or hard copies of all or part of this work for personal or classroom use is granted without fee provided that copies are not made or distributed for profit or commercial advantage and that copies bear this notice and the full citation on the first page. Copyrights for components of this work owned by others than ACM must be honored. Abstracting with credit is permitted. To copy otherwise, or republish, to post on servers or to redistribute to lists, requires prior specific permission and/or a fee. Request permissions from [email protected]

    Sponsors

    Publisher

    Association for Computing Machinery

    New York, NY, United States

    Publication History

    Published: 26 August 2014

    Permissions

    Request permissions for this article.

    Check for updates

    Author Tags

    1. domain-specific languages
    2. dsl
    3. generic programming
    4. isomorphisms
    5. multi-stage programming
    6. polytypic programming
    7. specialization
    8. staging

    Qualifiers

    • Research-article

    Conference

    ICFP'14
    Sponsor:

    Acceptance Rates

    WGP '14 Paper Acceptance Rate 8 of 9 submissions, 89%;
    Overall Acceptance Rate 30 of 43 submissions, 70%

    Upcoming Conference

    ICFP '25
    ACM SIGPLAN International Conference on Functional Programming
    October 12 - 18, 2025
    Singapore , Singapore

    Contributors

    Other Metrics

    Bibliometrics & Citations

    Bibliometrics

    Article Metrics

    • Downloads (Last 12 months)2
    • Downloads (Last 6 weeks)0
    Reflects downloads up to 08 Mar 2025

    Other Metrics

    Citations

    Cited By

    View all
    • (2017)Staging for generic programming in space and timeACM SIGPLAN Notices10.1145/3170492.313606052:12(15-28)Online publication date: 23-Oct-2017
    • (2017)Staging for generic programming in space and timeProceedings of the 16th ACM SIGPLAN International Conference on Generative Programming: Concepts and Experiences10.1145/3136040.3136060(15-28)Online publication date: 23-Oct-2017
    • (2017)LMS-Verify: abstraction without regret for verified systems programmingACM SIGPLAN Notices10.1145/3093333.300986752:1(859-873)Online publication date: 1-Jan-2017
    • (2017)LMS-Verify: abstraction without regret for verified systems programmingProceedings of the 44th ACM SIGPLAN Symposium on Principles of Programming Languages10.1145/3009837.3009867(859-873)Online publication date: 1-Jan-2017
    • (2016)Reflections on LMS: exploring front-end alternativesProceedings of the 2016 7th ACM SIGPLAN Symposium on Scala10.1145/2998392.2998399(41-50)Online publication date: 30-Oct-2016
    • (2015)Scalan: a framework for domain-specific hotspot optimization (invited tutorial)Proceedings of the 4th ACM SIGPLAN Workshop on Functional High-Performance Computing10.1145/2808091.2814203(54-54)Online publication date: 30-Aug-2015

    View Options

    Login options

    View options

    PDF

    View or Download as a PDF file.

    PDF

    eReader

    View online with eReader.

    eReader

    Figures

    Tables

    Media

    Share

    Share

    Share this Publication link

    Share on social media