Skip to content

Embedding Domain-Specific Languages in C or C++ with Polygeist

Photo of Johannes de Fine Licht
Hosted By
Johannes de Fine L. and 3 others
Embedding Domain-Specific Languages in C or C++ with Polygeist

Details

Domain-specific languages (DSLs) and compilers empower programmers to work at a high level of abstraction while achieving optimal performance by mapping these abstractions directly to the underlying hardware. Over the past decade, DSLs have become increasingly prevalent across various fields, from linear algebra to quantum computing, highlighting their significance in the modern software ecosystem. Despite their advantages, DSLs often function as isolated "silos" solutions tailored to specific domains. This isolation hinders the optimization of multi-domain applications and necessitates custom compilation flows. Consequently, integrating DSLs into existing C++ codebases is challenging, leading to a fragmentation of optimization knowledge, where advancements in one community fail to benefit others.

In this talk, we propose embedding DSLs and their associated domain-specific optimizations directly into general-purpose code (C++) via Polygeist, a C or C++ frontend for MLIR. By leveraging modern compiler technology, we can facilitate practical domain-specific compilation and mitigate the fragmentation of optimization knowledge. Our solution implements a plugin in the Polygeist frontend that enables the integration of domain-specific languages within low-level general-purpose code such as C or C++, bridging the gap between specialized and general-purpose programming.
We will present a practical use case where we integrated a linear algebra domain-specific language (Tensor Comprehension) via the Polygeist plugin, effectively mixing and matching C++ code with DSL code.

Photo of Compiler Social Zürich group
Compiler Social Zürich
See more events
ETH CAB Building (G56)
Universitätstrasse 6, 8092 Zürich · Zürich