BookNotesSlidesP-sets Syllabusdraft · v0.2.49.1
◀▲⌂▶
💬Comments welcome. To leave a note, select any text and click the note / highlight button that pops up — or open the panel with the tab at the top-right (‹). Notes are visible only inside our private review group.

29.0 MAKING COMPUTATIONAL PHOTOGRAPHY CODE FAST⧉

A useful camera pipeline must finish within a time, memory, and energy budget. A viewfinder needs sustained frame throughput and bounded latency; an offline editor may accept a longer wait for better quality. State that budget before optimizing, and keep a correct reference implementation to check against.

There are three ways to improve performance: change the algorithm, change the hardware or numerical representation, and change how the computation uses the machine. They interact. An algorithm with fewer operations can lose because it reads more memory, and a low-precision implementation helps only if the target executes it efficiently at acceptable quality.

Chapter 29.1, Algorithmic speedups starts with reusable structure: separable filters, running sums, pyramids, and approximations. Chapter 29.2, Modern CPUs: memory hierarchy, parallelism, and what it takes to go fast explains memory traffic and parallelism. The three Halide chapters then make loop organization, storage, and recomputation explicit while keeping the algorithm readable: Chapter 29.3, Halide at a high level: decoupling algorithms from schedules, Chapter 29.4, Halide programming, and Chapter 29.5, Scaling up Halide.

The remaining chapters cover Chapter 29.6, Hardware backends: GPU, NPU, DSP, Chapter 29.7, Efficient neural network inference, Chapter 29.8, Automatic search for fast methods, and Chapter 29.9, 8-bit and fixed-point arithmetic. Throughout, compare the complete pipeline at the same output quality and report what the timing includes. A faster kernel matters only to the extent that it improves the workload that uses it.

Performance is part of the method’s usefulness alongside predictable behavior and controllable results (Big lesson L1.1). Keeping the mathematical operation separate from its execution plan lets us ask two different questions: whether the method produces the intended image, and whether this organization uses the machine well. A reference implementation answers the first while schedules, storage choices, and hardware-specific versions explore the second.


Contents of this part

▸ full collapsible outline of this part