Repository logo

Infoscience

  • English
  • French
Log In
Logo EPFL, École polytechnique fédérale de Lausanne

Infoscience

  • English
  • French
Log In
  1. Home
  2. Academic and Research Output
  3. Conferences, Workshops, Symposiums, and Seminars
  4. Quoted Staged Rewriting: A Practical Approach to Library-Defined Optimizations
 
conference paper

Quoted Staged Rewriting: A Practical Approach to Library-Defined Optimizations

Parreaux, Lionel  
•
Shaikhha, Amir  
•
Koch, Christoph  
2017
Proceedings of 16th ACM SIGPLAN International Conference on Generative Programming: Concepts and Experiences (GPCE’17)
16th ACM SIGPLAN International Conference on Generative Programming: Concepts and Experiences (GPCE'17)

Staging has proved a successful technique for programmatically removing code abstractions, thereby allowing for faster program execution while retaining a high-level interface for the programmer. Unfortunately, techniques based on staging suffer from a number of problems — ranging from practicalities to fundamental limitations — which have prevented their widespread adoption. We introduce Quoted Staged Rewriting (QSR), an approach that uses type-safe, pattern matching-enabled quasiquotes to define optimizations. The approach is “staged” in two ways: first, rewrite rules can execute arbitrary code during pattern matching and code reconstruction, leveraging the power and flexibility of staging; second, library designers can orchestrate the application of successive rewriting phases (stages). The advantages of using quasiquote-based rewriting are that library designers never have to deal directly with the intermediate representation (IR), and that it allows for non-intrusive optimizations — in contrast with staging, it is not necessary to adapt the entire library and user programs to accommodate optimizations. We show how Squid, a Scala macro-based framework, enables QSR and renders library-defined optimizations more practical than ever before: library designers write domain-specific optimizers that users invoke transparently on delimited portions of their code base. As a motivating example we describe an implementation of stream fusion (a well-known deforestation technique) that is both simpler and more powerful than the state of the art, and can readily be used by Scala programmers with no knowledge of metaprogramming.

  • Files
  • Details
  • Metrics
Type
conference paper
DOI
10.1145/3136040.3136043
Web of Science ID

WOS:000417312000012

Author(s)
Parreaux, Lionel  
Shaikhha, Amir  
Koch, Christoph  
Date Issued

2017

Publisher

ACM

Publisher place

New York, NY, USA

Published in
Proceedings of 16th ACM SIGPLAN International Conference on Generative Programming: Concepts and Experiences (GPCE’17)
ISBN of the book

978-1-4503-5524-7/17/10

Total of pages

15

Subjects

Rewrite Rules

•

Staging

•

Optimization

URL

URL

https://conf.researchr.org/event/gpce-2017/gpce-2017-gpce-2017-staged-rewriting-a-practical-approach-to-library-defined-optimization
Editorial or Peer reviewed

REVIEWED

Written at

EPFL

EPFL units
DATA  
Event nameEvent placeEvent date
16th ACM SIGPLAN International Conference on Generative Programming: Concepts and Experiences (GPCE'17)

Vancouver, Canada

October 23–24, 2017

Available on Infoscience
September 15, 2017
Use this identifier to reference this record
https://infoscience.epfl.ch/handle/20.500.14299/140652
Logo EPFL, École polytechnique fédérale de Lausanne
  • Contact
  • infoscience@epfl.ch

  • Follow us on Facebook
  • Follow us on Instagram
  • Follow us on LinkedIn
  • Follow us on X
  • Follow us on Youtube
AccessibilityLegal noticePrivacy policyCookie settingsEnd User AgreementGet helpFeedback

Infoscience is a service managed and provided by the Library and IT Services of EPFL. © EPFL, tous droits réservés