OpenMP Meta-Lowering: A Declarative Approach to Performance Portable Parallel Code Generation
Luca Parigi, Giuseppe Tagliavini
Abstract
The increasing diversity of parallel hardware challenges existing compilation flows. While OpenMP provides a portable abstraction for shared-memory parallelism, existing compilers tightly couple the frontend semantics with fixed lowering strategies. This design limits performance portability across different runtimes and architectures. In this paper, we present a modular approach to parallel code generation based on the Multi-Level Intermediate Representation (MLIR) framework. Our approach combines an OpenMP frontend with a domain-specific language (DSL) that specifies how OpenMP constructs are lowered for a target. We call this approach OpenMP meta-lowering, treating lowering as a programmable component rather than compiler-specific logic. This design provides explicit control over code outlining, data sharing, and runtime interfacing across diverse targets. We evaluate our approach on PolyBench/C-OMP across general-purpose and embedded multicore targets. Our results show that the proposed method matches the performance of state-of-the-art compiler toolchains with negligible code-size overhead (< 0.7%). Preserving OpenMP constructs until late lowering stages enables both general-purpose and OpenMP-specific MLIR optimizations. By decoupling lowering from compiler internals, our approach expresses the same OpenMP subset in 5,182 lines of code, ~32% fewer than the corresponding lowering code in Clang and ~76% fewer than in GCC, while supporting the pmsis runtime costs only a few specification lines, enabling rapid support for new runtimes without modifying the compiler.
Create a lesson
Related papers
Python Code Generation for Isabelle/HOL
Shared title terminology · Nikolaus Huber, Roly Perera, Dominic Orchard
CompCert4Lean: Porting a Verified C Compiler to Lean in Six Weeks with Parallel Coding Agents
Shared title terminology · Cong Wang, Zhiyang Chen, Fan Long et al.
Relational Task Generation Language: A Declarative Specification Framework for Relational Deep Learning
Shared title terminology · Oleksii Kolesnichenko, Jakub Peleška, Gustav Š\'ır
A Compilation Model for Divergent Parallel Workloads
Shared title terminology · Alexander J Root, Christophe Gyurgyik, Devanshu Ladsaria et al.
DeCompCert: A Verified Decompiler for CompCert-Generated AArch64
Shared title terminology · Swarn Priya, Basavesh Ammanaghatta Shivakumar, Thomas Gilray et al.
Meta Build Systems as Logic Programs
Shared title terminology · Alex Reinking