Abstract
Peephole optimizations have proven to be effective on traditional compiler tasks such as instruction selection. MLIR raises the level of abstraction from machine instructions to high-level operations such as matrix-multiplication or an entire stencil application. In this project, we want to show the effectiveness of peephole style optimizations on domain-specific abstractions. We, therefore, optimize stencil programs from the weather and climate domain to demonstrate the effectiveness of the approach in the HPC space. As a vehicle to evaluate our idea, we introduce a high-level stencil dialect that models the data-flow of stencil programs. We deduce a set of high-level peephole optimizations to optimize stencil programs and implement a lowering to the GPU dialect of MLIR. The GPU dialect is a novel abstraction layer the allows compiler engineers to generate code that is performance portable across different GPU architectures.