Generating Performance Portable Code using Rewrite Rules: From High-Level Functional Expressions to High-Performance OpenCL Code

Michel Steuwer, Christian Fensch, Sam Lindley, Christophe Dubach

Research output: Chapter in Book/Report/Conference proceedingConference contribution

Abstract

Computers have become increasingly complex with the emergence of heterogeneous hardware combining multicore CPUs and GPUs. These parallel systems exhibit tremendous computational power at the cost of increased programming effort resulting in a tension between performance and code portability. Typically, code is either tuned in a low-level imperative language using hardware-specific optimizations to achieve maximum performance or is written in a high-level, possibly functional, language to achieve portability at the expense of performance.

We propose a novel approach aiming to combine high-level programming, code portability, and high-performance. Starting from a high-level functional expression we apply a simple set of rewrite rules to transform it into a low-level functional representation, close to the OpenCL programming model, from which OpenCL code is generated. Our rewrite rules define a space of possible implementations which we automatically explore to generate hardware-specific OpenCL implementations. We formalize our system with a core dependently-typed λ-calculus along with a denotational semantics which we use to prove the correctness of the rewrite rules.

We test our design in practice by implementing a compiler which generates high performance imperative OpenCL code. Our experiments show that we can automatically derive hardware-specific implementations from simple functional high-level algorithmic expressions offering performance on a par with highly tuned code for multicore CPUs and GPUs written by experts.
Original languageEnglish
Title of host publicationProceedings of the 20th ACM SIGPLAN International Conference on Functional Programming
Place of PublicationVancouver, BC, Canada
PublisherACM
Pages205-217
Number of pages13
ISBN (Electronic)978-1-4503-3669-7
DOIs
Publication statusPublished - 29 Aug 2015
Event20th ACM SIGPLAN International Conference on Functional Programming - Vancouver, Canada
Duration: 31 Aug 20152 Sep 2015
https://dl.acm.org/citation.cfm?id=2784754

Publication series

NameACM SIGPLAN Notices
PublisherACM
Number9
Volume50
ISSN (Print)0362-1340
ISSN (Electronic)1558-1160

Conference

Conference20th ACM SIGPLAN International Conference on Functional Programming
Abbreviated titleICFP 2015
CountryCanada
CityVancouver
Period31/08/152/09/15
Internet address

Fingerprint Dive into the research topics of 'Generating Performance Portable Code using Rewrite Rules: From High-Level Functional Expressions to High-Performance OpenCL Code'. Together they form a unique fingerprint.

Cite this