Tombstone
Vec4U
Nov 2004 โ Jul 2005 ยท age 22โ23
What it was
A tiny typed language for vector algebra that compiled one expression at a time into hand-tuned SSE intrinsics. Writing SIMD by hand in 2004 was miserable, so Jeff wrote a 500-line OCaml compiler: you typed A + (B - A) * s and got back a complete C++ function on __m128 registers. It knew four types, scalar, vector, matrix and quaternion, and a type checker built as a multiplication table chose which intrinsic sequence each operator became. The generated code was not naive: two-shuffle cross products, reciprocal square roots, a four-shuffle quaternion multiply. The whole thing went from first artifact to a manual, a licence and a $25 payment button in about seventy-two hours, and then spent six months writing the math for Jeff's own game engine.
Wins, for the age
- At twenty-two, Jeff made the type checker the thing that picks the intrinsics, so a well-typed expression could not emit the wrong sequence. ISPC and Halide built that idea at industrial scale in 2011, seven years later.
- Saw a SIMD register as four lanes running the same expression and gave lane-wise multiply its own operator. One Taylor series then computed four sines at once, with no branches.
- Read the Intel optimization manuals closely enough to emit code a careful human would write, in one primate's long weekend.
- Shipped it as a product, with a manual, a licence, payment and fulfilment, and then used it in anger. Six months of engine math is the best proof the compiler worked.
What it taught
- Build a language when the problem is a language. By now that move was cheap, and it stayed cheap for the rest of a career.
- Ask what the type system must guarantee before asking how to generate the code.
- Measure on day one: the benchmark predates the final source.
- Ship first, then circle back. A missing macro broke vector-by-scalar division for customers, and typing by first letter, where any name starting with
Mis a matrix, was charming exactly once.
Genealogy
Ancestors: Crml: camlp4 and the reflex to build a small language. Zsl: engine math, and OCaml already sitting beside the C++. Descendants: Edu Lang: another small language, this time teaching instead of computing. Vector Register: vector math generated as code, now in Java.
Epitaph
Here lies Vec4U, which typed vectors by their first letter, computed four sines at once, and moved a game camera for six months. It never became anything; it was the shape of things that did.