Phase 6 · Applied C — ML Inference & Kernel-Adjacent (M10–M11)

Window: April 2027 – May 2027 · Load: 10–15 h/week · Prereq: you’ve closed Phase 5 (concurrency, sockets, atomics) and can read a stack trace without opening a browser tab.

This is the phase where “I know C” becomes “I know where C actually earns its rent in 2026.” Python is the receptionist of modern ML — the actual work happens in tight C, C++, and CUDA loops that push tensors through cache. By the end of M11 you will have opened ggml-org/llama.cpp, understood the Q4_K matmul kernel, written your own 4× speedup GEMM, and shipped a Python C extension that quantizes fp32 → INT8 and back. That is the moment you stop being an ML engineer who “uses” inference libraries and start being one who could contribute to them.

Why this phase exists at all

The M13 pitch sentence promises “SIMD-accelerated ML inference kernels.” That promise is empty unless you can (a) reason about L1/L2/L3 cache and DRAM bandwidth in cycles, (b) hand-write an AVX2 or NEON inner loop that beats -O3, and (c) read ggml-quants.c and know what a block_q4_0 is. Phases 1–5 built the language and the OS interface. This phase builds the numerical systems muscle that separates “web-backend C” from “inference-kernel C.” It is the higher-paying half of the C job market, and it is the half most self-taught C learners never reach.

Target artifact by end of M11

You should be able to walk into a llama.cpp community call, open Discussion #16770 (the “adding a new model architecture” guide by the Qwen3-Next author), and follow every reference — gguf-py/constants.py, tensor_mapping.py, convert_hf_to_gguf.py, mul_mat in ggml.c — without having to Google a single one. You should also have benchmarked your own GEMM against your machine’s OpenBLAS build and know, to within 20%, where the gap comes from.

File map

#

File

What you learn

1

01_why_c_for_ml_inference.md

The honest case for C in the LLM era

2

02_simd_and_vectorization.md

SSE/AVX2/AVX-512, NEON, intrinsics vs auto-vec

3

03_cache_and_memory_hierarchy.md

Cycle-counts, cache lines, roofline in 60 seconds

4

04_matmul_and_gemm.md

Naive → blocked → SIMD; the OpenBLAS/BLIS path

5

05_quantization_kernels_in_c.md

INT8/INT4 math, Q4_0/Q4_K/Q8_0 block formats

6

06_reading_llama_cpp.md

A guided tour: what to open first

7

07_kernel_and_driver_intro.md

Hello-world kernel module; when not to write one

8

08_ffi_c_from_python.md

ctypes, cffi, pybind11, native CPython ext

9

09_the_ml_serving_c_stack.md

Triton, ONNX Runtime, TensorRT, llama.cpp server

P

projects.md

2 hard deliverables

Exit criteria (all must be true)

  • You have a gemm_bench repo on your GitHub: naive, blocked, SIMD-intrinsic versions, plus a plot showing GFLOPS vs matrix size against OpenBLAS on your Mac’s Accelerate/Homebrew OpenBLAS. Delta from OpenBLAS documented with a paragraph explaining why (register blocking? micro-kernel scheduling? multithreading?).

  • You have a quantize_ext Python C extension: setup.py, quantize_module.c doing symmetric per-tensor INT8 quant + dequant, unit tests against a NumPy reference, pytest -q green.

  • You can, from memory, sketch the layout of block_q4_0 (32 nibbles + FP16 scale), name why LLM decode is memory-bandwidth bound, and cite the ~2× speedup this buys.

  • You have read at least 4 files inside ggml-org/llama.cpp in depth: ggml.c’s ggml_compute_forward_mul_mat, ggml-quants.c’s Q4_0 quantize/dequantize, llama.cpp’s llm_build_context, and src/llama-model.cpp’s tensor loader.

  • You can defend, in one paragraph each, why you are learning C and not Mojo (compiler still closed until late 2026), why not Zig (still pre-1.0 in July 2026), and why not Rust (you already work in Python — the marginal skill is systems C, not another safe language).

  • One entry in 99_pre_mortem/ retros this phase honestly: what you thought you understood but didn’t.

What most people get wrong about this phase

They treat it as a math problem. It isn’t. GEMM is a memory problem. The person who wins is the one who thinks about bytes moving through cache lines, not the one who remembers linear algebra. If at any point in M10–M11 you find yourself thinking “I need to review matrix multiplication,” stop and go read 03_cache_and_memory_hierarchy.md again. The math is trivial. The hardware is not.

Time budget (11 h/week × 8 weeks = 88 h)

Weeks

Focus

Hours

W1–W2

Files 01–03, first naive GEMM

22

W3–W4

File 04, blocked GEMM, SIMD kernel

22

W5–W6

Files 05–06, read llama.cpp, quant math

22

W7

Files 07–09, Python C ext project

11

W8

Slack week: benchmarks, write-up, retro

11


You are two months from being the person other ML engineers ask about inference performance. Keep the head down, brother.

Next: 01_why_c_for_ml_inference.md