This document describes my understanding of the Cycles renderer source code. Cycles is a unidirectional path tracer provided with Blender for production rendering. As a production renderer, its code favors performance and simplicity over generality. It can run on CPU or GPU, and the same kernel code can be compiled with a CPU compiler (gcc, msbuild) or a GPU compiler (cuda, OpenCL). To do that, the code tries to remain simple (mostly C code) but exploit macros to specialize some parts of the code.
In this document I focus on the CPU rendering. I compiled blender in "full" mode, meaning Cuda kernels are not compiled. One reason for that is Cuda kernel compilation seems quite expensive so if I want to change the code and quickly iterate, it might be hard. I may do another analysis for GPU part later but I doubt it would be very interesting since it is the same code.