stdir is a new general-purpose dialect for MLIR that introduces a modern type system and reusable operations for building compilers and domain-specific languages (DSLs).
Note: This is not the deprecated Standard dialect.
stdiris built from scratch using modern MLIR design principles. It is extensible, type-rich, and designed to lower cleanly to existing MLIR dialects.
- Provide a standardized, modern type system for MLIR
- Define a core set of reusable operations: control flow, arithmetic, tensors, memory, etc.
- Support lowering to existing dialects like
SCF,Arith,LLVM, and others - Enable Python integration for machine learning workflows and compiler tooling
The stdir dialect includes a wide range of types:
- Scalars:
iN,fN,bool - Tensors: shaped and shape-polymorphic
- Vectors: parametric width and element types
- Structs: named, nested fields
- Tuples: positional types
- Optionals: null-safe values
- Generic Containers: arrays, maps, sets
- Parametric & Opaque Types: for abstraction and generality
Basic reusable operations provided by the dialect include:
-
Control Flow:
stdir.if,stdir.for,stdir.while -
Arithmetic:
stdir.add,stdir.sub,stdir.mul,stdir.div -
Memory Management:
stdir.alloc,stdir.load,stdir.store -
Asynchronous Execution:
stdir.async_execute,stdir.await -
Utilities:
stdir.print,stdir.assert,stdir.cast
stdir is designed to lower to a wide range of existing MLIR dialects:
SCF,CF– structured and conventional control flowArith,Math– scalar and numeric operationsTensor,MemRef– data structure manipulationLinalg,Vector– loop nests, matrix ops, and vectorizationAsync– asynchronous and concurrent executionLLVM– low-level backend loweringPDL,PDLInterp– pattern-driven transformations