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

85 Citations (Scopus)
197 Downloads (Pure)

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 PublicationNew York
PublisherAssociation for Computing Machinery
Pages205-217
Number of pages13
ISBN (Electronic)978-1-4503-3669-7
DOIs
Publication statusPublished - 1 Sept 2015
Event20th ACM SIGPLAN International Conference on Functional Programming - Vancouver, BC, Canada
Duration: 31 Aug 20152 Sept 2015

Conference

Conference20th ACM SIGPLAN International Conference on Functional Programming
Abbreviated titleICFP 2015
Country/TerritoryCanada
CityVancouver, BC
Period31/08/152/09/15

Keywords

  • algorithmic patterns
  • code generation
  • OpenCL
  • GPU
  • performance portability
  • rewrite rules

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