MLIR-Forge: A Modular Framework for Language Smiths

Berke Ates, Philipp Schaad, Timo Schneider, Alexandru Calotoiu, Torsten Hoefler · 2026

Read MLIR-Forge: A Modular Framework for Language Smiths by Berke Ates, Philipp Schaad, Timo Schneider, Alexandru Calotoiu, Torsten Hoefler (2026) in the Tower of Babel, a free online library of public-domain works preserved in clean, searchable text. No sign-up. The full text is served as a plain-text file at a predictable URL, where text is present: https://antarctic-labs.com/tower-of-babel/arxiv-2601-09583.txt.

Introduction

Berke Ates, Philipp Schaad, Timo Schneider, Alexandru Calotoiu, and Torsten Hoefler build tooling for people who design compiler languages. Their 2026 arXiv paper presents MLIR-Forge, a modular framework for language smiths. Domain-specific languages rely on custom middle forms inside their compiler pipelines.

Each new form adds power but also bulk, so it must be tested with care. MLIR-Forge aims to make building and testing such forms easier within the MLIR project. Good compilers sit under most computing in science, so better tooling lifts many fields at once. The framework targets the gap between a language idea and a reliable compiler.

Catalog record

CREATORBerke Ates, Philipp Schaad, Timo Schneider, Alexandru Calotoiu, Torsten Hoefler
YEAR2026
COLLECTIONPAPERS
FORMATTXT
FILE SIZE49 KB
VERSION1.0
LICENSEhttp://creativecommons.org/licenses/by/4.0/
RIGHTSCC BY
SOURCEarXiv

Source: https://arxiv.org/abs/2601-09583

Browse the full library · About the Tower of Babel

Full text

The opening of the work, from the library's hosted text:

MLIR-Forge: A Modular Framework for Language Smiths Berke Ates, Philipp Schaad, Timo Schneider, Alexandru Calotoiu, Torsten Hoefler Abstract . Optimizing compilers are essential for the efficient and correct execution of software across various scientific fields. Domain-specific languages (DSL) typically use higher level intermediate representations (IR) in their compiler pipelines for domain-specific optimizations. As these IRs add to complexity, it is crucial to test them thoroughly. Random program generators have proven to be an effective tool to test compilers through differential and fuzz testing. However, developing specialized program generators for compiler IRs is not straightforward and demands considerable resources. We introduce MLIR-Forge, a novel random program generator framework that leverages the flexibility of MLIR, aiming to simplify the creation of specialized program generators. MLIR-Forge achieves this by splitting the generation process into fundamental building blocks that are language specific, and reusable program creation logic that constructs random programs from these building blocks. This hides complexity and furthermore, even the language specific components can be defined using a set of common tools. We demonstrate MLIR-Forge’s capabilities by generating MLIR with built-in dialects, WebAssembly, and a data-centric program representation, DaCe — requiring less than a week of development time in total for each of them. Using the generated programs we conduct differential testing and find 9 9 MLIR, 15 15 WebAssembly, and 774 774 DaCe groups of bugs with the corresponding program generators, after running them until the rate of new bugs stagnates. Figure 1 . Overview of MLIR-Forge. 1. Introduction To achieve good performance in the current post-Moore era, both hardware and software are increasingly more specialized and optimized for specific tasks ( 27 ; 32 ) . Following this trend of specialization, programming languages have also evolved to cater to specific domains with so called Domain-Specific Languages (DSLs) ( 29 ; 22 ) . DSLs are tailored for specific tasks or industries and make it easier for experts in a field to work with computational tools. The vast majority of DSLs and general-purpose languages utilize intermediate representations (IRs) in their compiler pipelines to perform general and purpose-specific optimizations. General-purpose programming languages often use several higher-level IRs before moving to a more general low-level IR. This approach allows language-specific optimizations to easily be implemented in a modular fashion, such as in the Soot framework, where three IRs are used to effectively optimize Java bytecode ( 38 ) . MLIR ( 24 ) (Multi-Level Intermediate Representation) is a key development in this area. It simplifies the process of creating a new IR by offering a framework capable of handling many IRs and promoting reuse through a provided pass infrastructure, tools for diagnostics, testing facilities, and much more. Thanks to MLIR, creating and experimenting with new IRs has become easier and quicker. This has encouraged more research in the fields of machine learning, quantum computation, and code optimization through the use of specialized IRs ( 15 ; 3 ; 25 ; 21 ; 26 ) . Early testing of such custom IRs is vital to prevent costly bug fixes later on and ensure trust in experimental results ( 35 ) . Random program generators are valuable tools for finding compiler bugs. Tools such as Csmith ( 40 ) and DeepSmith ( 6 ) demonstrate how many compilers could crash or produce incorrect code despite receiving valid input programs. Handwritten tests usually follow structured patterns with sensible inputs due to subconscious biases introduced by the human developers writing them. In contrast, random program generators can create unusual and unexpected programs containing patterns far outside of what is typically seen in sensible code. While both are valid, the unpredictable nature of randomly generated code can challenge a compiler in unique ways. This makes program generators effective at revealing complex bugs that standard tests might miss. However, developing a program generator for a specific IR can be time-consuming and expensive. This can take away from the savings of using MLIR for IR development. We introduce MLIR-Forge, a program generator framework in MLIR that separates this task into program generation and language specification, and automates the program generation procedure. This limits the developers’ responsibility to specifying the fundamental language building blocks – e.g., defining the IR operations specific to the language. We summarize our approach in Fig. 1 . MLIR-Forge provides a set of common tools to minimize the effort required to implement a program generator, making testing more affordable and common – a goal aligned with MLIR’s philosophy. Our approach facilitates code reuse, allowing users to leverage the work of other MLIR-Forge-based program generators. We demonstrate the use of MLIR-Forge by creating a program generator for a subset of MLIR’s built-in dialects, and one for a custom dialect for program dataflow optimizations, the SDFG dialect ( 1 ) . We show that even IRs not originally designed for MLIR can benefit from MLIR-Forge by combining the MLIR program generator with translators to produce and test WebAssembly ( 17 ) code. In summary, our main contributions are: • Separating random program generator development into program construction and language specification by defining an abstraction layer between them. • Automating the program construction process and reducing developer responsibility to language specification alone. • Facilitating reuse between program generators through sharing language specifications for shared language features. • Demonstration of the framework with a proof-of-concept implementation in MLIR, used to implement three program generators, each in less than one week, and uncovering 798 groups of bugs. 2. IR Abstraction To build a random program generator framework capable of producing a variety of IRs, a common IR abstraction is essential. This abstraction provides a unified way to describe individual IRs within the framework. The following section outlines the abstraction, which offers a standardized expression for instructions across different IRs. 2.1. Operation Model Since instructions in IRs can have arbitrary semantics, a fixed instruction set is insufficient to represent a wide variety of IRs. We address this challenge by using an abstracted view on operations, as depicted in Fig. 2 . Figure 2 . Overview of an operation. These operations can take any number of operands or arguments and produce zero or more results. Operations are grouped into dialects, which are namespaces for operations and types. To identify the dialect of operations, they are prefixed with the dialect’s name, which allows different dialects to share the same name for operations with differing application-specific semantics, such as arithmetic and vector addition. Operations may also contain attributes which represent static information that can change the behavior of the operation. For example, a rounding operation might have an attribute that sets the rounding method. Operations can also use arguments which are direct results from other operations. While the type of an operation usually tells us about its results, it can also give information about its arguments. Operations follow a hierarchical or nested design which allows them to contain multiple regions. Each region is made up of basic blocks, containing a list of operations. This design enables us to represent even (structured) control flow instructions as operations, as shown in Fig. 3(a) . By grouping operations into namespaced dialects, we can utilize multiple dialects in the same program, as seen in Fig. 3(b) . This design allows

Read the complete text