Automatic Code Rewriting for Performance Portability
Loading...
Date
2024-08-07
Authors
Johnson, Alister
Journal Title
Journal ISSN
Volume Title
Publisher
University of Oregon
Abstract
Rewriting code for cleanliness, API changes, and new programming models is a common, yet time-consuming task. This is important for HPC applications that desire performance portability in particular, since these applications are usually very long lived and wish to run on many architectures, so they need to be written such that they can make good use of all the available hardware with minimal code changes. Furthermore, it is unknown what future supercomputer hardware and programming models will be, so they need to be written in such a way that they are ``future proof'' and will only need minimal rewrites in the future.
Localized or syntax-based changes are often mechanical and can be automated with text-based rewriting tools, like sed.However, non-localized or semantic-based changes require specialized tools that usually come with complex, hard-coded rules that require expertise in compilers.
This means techniques for source rewriting are either too simple for complex tasks or too complex to be customized by non-expert users; in either case, developers are often forced to manually update their code instead.
This work describes a new approach to code rewriting which exposes complex and semantic-driven rewrite capabilities to users in a simple and natural way.Rewrite rules are expressed as a pair of parameterized ``before-and-after'' source code snippets, one to describe what to match and one to describe what the replacement looks like.
Through this novel and user-friendly interface, programmers can automate and customize complex code changes which require a deep understanding of the language without any knowledge of compiler internals.
This dissertation includes previously published and unpublished co-authored material.
Description
Keywords
compilers, metaprogramming