click the book to open it
the first compiler
uops, rewrites and c, built from zero
a book on the first two weeks of geohot's compilers for machine learning course. you build a small compiler in python: a graph of arithmetic ops, rewrite rules that simplify it, a c renderer, and a runtime that compiles it with clang and runs it.
it starts with a 14 step short path, one small program per step with its real output, then 16 deep chapters with exercises. every program in it was run. the compiler is checked against numpy and separate c code in over 2.1 million checks, 59 rewrite claims are settled with z3, and 19 deliberately planted bugs were all caught.
click the book to open it
Below the code
A working engineer's guide to assembly, from bits to GPU kernels: RISC-V, x86-64, SIMD, PTX and SASS.
what the hardware does when your code runs, and what it costs. it starts at bits and the loop a cpu runs forever, teaches risc-v first because it is clean, then x86-64, simd and the cost model, and ends on how a gpu runs code and how to read ptx and sass. every program in it was assembled and run, and every compiler listing and benchmark number came from a real tool. one sass listing in chapter 15 could not be run, and the book says so.