Aurelia Compiler & MLIR
A deep dive into the MLIR lowering process and build infrastructure.
Technical Deep Dive: Aurelia’s Compiler
The Aurelia compiler is a sophisticated multi-stage toolchain that leverages the latest advancements in LLVM and MLIR to provide a bridge between mathematical research and hardware execution.
The MLIR Lowering Process
Aurelia’s compiler architecture is built on the principle of progressive lowering. The source code is first parsed into an Abstract Syntax Tree (AST), which is then lowered into a series of MLIR dialects.
- Aurelia High-Level Dialect (AHL): Captures the intent of the programmer, including tensor shapes, differentiation attributes, and parallel loop constructs.
- Tensor Dialect: Performs shape inference and symbolic verification. Ensures that all tensor operations are mathematically sound.
- Linalg and MemRef Dialects: Maps tensor operations to specific memory buffers (MemRefs). This is where the Neuro-Linear Predictive Allocator inserts pre-fetch hints.
- Tiling and Fusion: Breaks down large tensor operations into smaller “tiles” that fit into the NPU’s local memory. Fuses consecutive operators (e.g., convolution + ReLU) into a single execution kernel.
- LLVM IR and Machine Code: The optimized MLIR is lowered to LLVM Intermediate Representation, compiled into machine code for specific GPU or NPU targets.
Formal Verification
A unique feature of the Aurelia language is its “Paper-First” verification capability. DeepcometAI has introduced attributes like @paper, @invariant, and @experiment to allow researchers to encode mathematical proofs directly into the source code.