Skip to content

Tutorials

Work through the optimization ladder step by step. Each tutorial is self-contained: it explains a concept, shows the relevant code, and points to the research notes for the full mathematics.

The path through the ladder

Naive
  └─ dot-product extraction (AddDot)
       └─ unrolling
            └─ fused micro-kernel  (matmul: 4×4  /  matvec: 4×1)
                 └─ register accumulators
                      └─ pointer arithmetic
                           └─ vectorization
                                └─ cache blocking  (mc × kc)
                                     └─ matrix packing
                                          └─ fully-packed micro-kernel

Table of contents

# Tutorial What you'll learn
00 Overview How the ladder is organized and how to use it
01 Build & run the ladder Compile everything, run levels, measure
02 Reading GFLOPS & roofline Interpreting numbers; memory- vs compute-bound
03 matmul: naive → micro-kernel optim0 → optim8
04 matmul: blocking & packing optim9 → optim14
05 matvec: the 4-output kernel the 4×1 kernel and why it differs
06 Writing a new level How to add optim15 yourself

Research notes

For the complete mathematics of each level, see the matmul research notes and matvec research notes sections (one page per optimN).