

Drag or use arrow keys to rotate
The No Nonsense Guide
Machine Learning Compilers
Bridging Models and Hardware for Maximum Performance
LAXMEN MURALI · FIRST EDITION, 2026
A first-principles path that takes you from a single transistor to writing production GPU kernels, and then to building an ML compiler of your own.
- chapters
- 63
- parts
- 9
- pages
- 1,068
- updates
- Free
₹3,499
₹5,999 42% off, save ₹2,500
- eBook
- Delivered in about a minute
- Every future edition free, for life
Free trial
Read a chapter before you decide
A 67-page excerpt: the full table of contents and complete chapters exactly as they appear in the book. No email, no signup.


The book
Why it exists
Every time a model runs fast, a compiler made a decision. It fused two operators so a tensor never touched DRAM. It picked a tile size that kept the L2 warm. It chose bf16 over fp32 and proved the numerics still held. Those decisions are where most of the performance in modern AI comes from, and almost nobody outside a handful of teams understands how they are made.
This book is the missing curriculum. It starts at the switch, a physical thing that is either on or off, and does not stop until you have designed an intermediate representation, written the optimisation passes that walk it, generated code for a GPU, and benchmarked the result against PyTorch. There is no chapter where you are asked to accept something on faith.
It is deliberately long. A book this size is not padding; it is the honest measure of the gap between "I can train a model" and "I can explain, in cycles, why this kernel falls short of what the roofline says it should achieve." Every chapter carries the same nine sections: a story, the theory, the mathematics, the engineering reality, a performance analysis, a build-it exercise in real code, a debugging guide, interview questions, and the misconceptions that trip people up.
Inside
What makes it different
Genuinely first principles
The book starts with a single switch and has you build a working CPU simulator in Python before going any further. Every layer above it is built, not assumed.
The whole stack, one narrative
Logic gates, caches, C++, SSA, LLVM, MLIR, tensors, transformers, CUDA, fusion, Triton and FlashAttention. One continuous thread, not nine disconnected books.
You build things, constantly
A cache simulator in 25 lines. malloc-lite. A bytecode interpreter running real CPython opcodes. A register allocator. And finally, a complete ML compiler.
Performance treated as a science
Roofline, Amdahl, Gustafson, Little's Law, tail percentiles, and the seven ways benchmarks lie, applied to measured numbers rather than hand-waved ones.
Real stacks, dissected
TVM, PyTorch Dynamo and Inductor, XLA, IREE, Triton, TensorRT and ONNX Runtime. What each one actually does differently, and why.
Written for the interview and the job
Every chapter ends with the questions that get asked at compiler teams, the mistakes that get made in review, and the debugging playbook for when it breaks in production.
Who it's for
Written for
- ML engineers who are tired of torch.compile being a black box
- Compiler engineers moving from classical backends into the AI stack
- Systems and performance engineers targeting GPUs and accelerators
- Students who want the whole ladder, not one rung of it
- Anyone preparing for ML-compiler, CUDA, or performance-engineering interviews
What you need first
You should be able to write a program in any language. That's it. Python and C++ are taught from scratch where the book needs them, and no prior compilers, CUDA, or machine-learning background is assumed.
Table of contents
9 parts, 63 chapters
Every chapter listed. Nothing hidden.
PART I Foundations of Computing 7 ch
How machines actually compute: switches, binary, memory, CPUs, caches, and the discipline of performance.
- 1 What Is a Computer? From Switches to Thinking Machines
- 2 Binary: The Language of Machines
- 3 Memory: The Computer’s Notebook
- 4 The CPU: The Engine of Computation
- 5 Caches and the Memory Hierarchy
- 6 Processes, Threads, and Virtual Memory
- 7 Performance: Thinking Like a Speed Engineer
PART II Programming and Systems 7 ch
The languages compilers consume and are written in: semantics, pointers, data structures, Python internals, and modern C++.
- 8 What Is Programming? Variables, Types, and Functions
- 9 Pointers, References, and the Shape of Memory
- 10 Recursion and the Call Stack
- 11 Data Structures: Organizing Information
- 12 Algorithms and Complexity
- 13 Python: How the Interpreter Really Works
- 14 C++ for Systems and Compiler Engineers
PART III Compiler Fundamentals 10 ch
The classical pipeline end to end: lexing, parsing, ASTs, SSA, dataflow, optimization, codegen, LLVM and MLIR.
- 15 What Is a Compiler? The Grand Tour
- 16 Lexing: Turning Characters into Words
- 17 Parsing: Turning Words into Structure
- 18 ASTs and Semantic Analysis
- 19 Intermediate Representations and SSA
- 20 Control Flow Graphs and Data Flow Analysis
- 21 Classical Optimizations
- 22 The Backend: Instruction Selection, Scheduling, Register Allocation, Codegen
- 23 LLVM: The Industry Workhorse
- 24 MLIR: The Compiler Construction Kit
PART IV Mathematics and Machine Learning 8 ch
Tensors, numerical precision, and the models themselves, from linear algebra to transformers and LLMs.
- 25 Vectors and Matrices from First Principles
- 26 Tensors, Broadcasting, and Memory Layout
- 27 Numerical Precision: FP32, FP16, BF16, FP8, INT8
- 28 What Is Machine Learning?
- 29 Neural Networks and Backpropagation
- 30 Convolutional Neural Networks
- 31 Transformers and Attention
- 32 Training, Inference, and Large Language Models
PART V GPUs and Parallel Hardware 4 ch
Why accelerators won, the SIMT model, the GPU memory hierarchy, and tensor-core scheduling.
- 33 Why GPUs? The Parallel Revolution
- 34 CUDA and the SIMT Programming Model
- 35 The GPU Memory Hierarchy
- 36 Tensor Cores, Occupancy, and Kernel Scheduling
PART VI Inside an ML Compiler 7 ch
Graph IR, shape inference, fusion, scheduling, memory planning, cost models, and kernel generation.
- 37 Anatomy of an ML Compiler: Graph IR and Tensor IR
- 38 Shape Inference and Graph Optimization
- 39 Operator and Kernel Fusion
- 40 Scheduling: Separating What from How
- 41 Memory Planning
- 42 Cost Models and Auto-Tuning
- 43 Kernel Generation
PART VII Production Compiler Stacks 6 ch
TVM, PyTorch 2 (Dynamo/Inductor), XLA, IREE, Triton, TensorRT and ONNX Runtime, dissected.
- 44 TVM: The Full-Stack Pioneer
- 45 PyTorch Compilation: FX, Dynamo, and Inductor
- 46 XLA and OpenXLA
- 47 IREE and the MLIR-Based Stacks
- 48 Triton: Python-to-GPU Kernels
- 49 TensorRT and ONNX Runtime
PART VIII High-Performance Kernels 8 ch
GEMM to near-peak, convolutions, FlashAttention, reductions, loop craft, serving, parallelism and quantization.
- 50 GEMM: From Naive to Near-Peak
- 51 Convolution Kernels
- 52 Attention Kernels and FlashAttention
- 53 Normalization, Activations, and Reductions
- 54 Advanced Loop Craft
- 55 Inference Serving: KV Cache, Continuous Batching, and Speculative Decoding
- 56 Parallelism: Tensor, Pipeline, and Expert
- 57 Quantization
PART IX Build Your Own ML Compiler 6 ch
A capstone covering design, IR, passes, backend and testing, plus how real teams and careers work.
- 58 Design and Architecture
- 59 Building the IR and Optimization Passes
- 60 The Backend and Code Generation
- 61 Testing, Benchmarking, and Debugging
- 62 How Real Teams Build ML Compilers
- 63 The Road Ahead: Careers, Interviews, and the Future
Readers
In their own words
What I really liked about Machine Learning Compilers is how it builds everything from first principles, taking you from the basics to advanced concepts without skipping the important details. It’s rare to find a book that is genuinely accessible to beginners while still offering enough depth for experienced engineers.
01 / 04
Questions
Before you buy
Do I need to know compilers or CUDA already?
No. The books are built for exactly the opposite case. They start at the fundamentals and teach Python, C++, compiler theory, linear algebra, machine learning and GPU programming as they need them. If you can write a program in any language, you can read this.
Can I see some of it before buying?
Yes. There is a free excerpt on this page: the complete table of contents plus full chapters exactly as they appear in the book, with no email address and no signup required.
Isn't the book excessively long?
It's the honest length. The distance between using a model and understanding why it runs at the speed it does spans hardware, systems, languages, compilers, numerics and ML. Any book that covers that in 300 pages is skipping something you'll later have to learn anyway.
What exactly do I get after paying?
Within a minute of payment, you receive an email at the address you entered at checkout with access to everything you bought in Google Drive. Access is granted to that specific email address, is yours permanently, and includes every future edition of each book you bought.
Can I download the book?
No. The books are read online through the Google Drive viewer, on any device with a browser. Downloading, printing and copying are disabled. This keeps independently published books from being redistributed, and it also means every correction reaches you automatically without you having to fetch anything.
Do I need a Google account?
Yes. The book is delivered through Google Drive, so you'll need to be signed in to a Google account using the same email address you gave at checkout. If you use a non-Google address, write to us right after purchase and we'll sort out access for you.
Are purchases refundable?
All purchases are final. Because each book is delivered in full immediately after payment, orders cannot be cancelled or refunded once access has been granted. The sole exception is a delivery failure that cannot be resolved, in which case a full refund is issued.
Can I share or resell it?
No. The book is copyrighted, and sharing, reselling, uploading or redistributing it in any form is prohibited. Your access is tied to your email address and is licensed to you alone.
I didn't receive the email. What now?
Check spam and promotions first. If it still isn't there after 10 minutes, email us with your Razorpay payment ID and we'll re-issue access immediately. Every payment is recorded on our side, so nothing is ever lost.
Is there a paperback?
Not yet. Everything sold here today is an eBook, read online. A paperback edition is being worked on, and if you have already bought the eBook you will hear about it first.
Do I get future updates and new editions?
Yes, all of them, for life. Corrections and revisions arrive automatically: the file is updated in place, so the link you already have always shows the current version. And when a new edition of a book you own is published, that is free too. You never re-download or re-purchase anything.
What can I do with the code in the book?
Use it freely, including in commercial work. The code examples exist to be run and built upon. It is the text, diagrams and the book itself that are copyrighted.

