COG Code Generator

Lightplane uses Triton to implement the fused rendering and splatting GPU kernels. While Triton is an amazing tool that largely enabled the project, it has certain limitations which we sidestepped using templated programming. In more detail, when using pure Triton, there is no efficient way to implement a configurable number of MLP layers in both the Renderer and Splatter kernels. To deal with the latter, we leverage COG to generate kernel code corresponding to the desired MLP settings automatically. This eliminates the need for manual code adjustment when alterring the number of network layers.

In practice, after specifying MLP layers of Lightplane Renderer and Splatter, our code will first scan generated dirs to see whether corresponding code already exists. If the code cannot be found, it will be automatically be generated by COG, given templates, and saved in generated dirs for further use. We additionally check the timestamps of template files and will regenerate kernel code after a template file was modifiied.