top of page


Building my first MLIR-based Tensor Compiler
I'm writing this article to document my learning journey. This is my first compiler. I first discovered tensor compilers last year while digging through the PyTorch codebase. At the time, I wanted to transition into low-level programming, and since PyTorch was the only framework I was familiar with, I decided to explore their codebase. There, I discovered their compiler toolchain, TorchDynamo and TorchInductor, which, in simple terms, serve as PyTorch's machine learning compi
14 hours ago7 min read


Performance Analysis and Testing
This analysis evaluates the sequential performance impact of optimization passes done on a 2048 x 2048 floating-point matrix multiplication workload. The goal of this analysis is to measure the execution speedups, look at how these changes affected CPU cache behavior, and see what further adjustments can be made to improve performance Hardware Specs The following analysis was run on the following environment and hardware specs: Host Processor: Apple M1 Pro (10 cores: 8 perfor
14 hours ago10 min read


Implementing Linear Layers and Memory Optimizations on MLIR
In this article, I am expanding the basic pipeline from the previous article to support a Linear Layer (the foundational building block of modern neural networks). At the hardware level, this workload is driven by a GeMM (General Matrix Multiply) operation, traditionally defined as: C ← αAB + βC To achieve this, I added two new operations to the compiler: relu and matmul. Since relu shares a similar element-wise structure to the 'add' operator covered in Part 1, this article
14 hours ago14 min read


Building a Minimal MLIR Pipeline from ONNX to LLVM JIT
MLIR Lowering Pipeline Lowering Strategy (High-Level Overview) The lowering pipeline looks like this: ONNX graph -> custom mlir dialect -> tensor (value) -> memref (memory) -> llvm -> JIT Full code for this article is available here This article's focus is only building an end-to-end skeleton that takes a high-level ONNX model and lowers it through progressively more concrete representations until it executes via a JIT engine. I kept the initial scope to scalar and 1D vector
14 hours ago28 min read
bottom of page