Compiler Support for High-Performance Graphics

„First general shading language infrastructure AnySL“

  • „AnySL: Efficient and Portable Shading for Ray Tracing“, Ralf Karrenberg, Dmitri Rubinstein, Philipp Slusallek and Sebastian Hack, High Performance Graphics (HPG), 2010

„First verctorizer for LLVM bitcode and SSE/AVX that drives a Renderman compiler and a prototype OpenCL framework“

  • „Whole-Function Vectorization“, Ralf Karrenberg and Sebastian Hack, Code Generation and Optimization (CGO), 2011

In general, our project aims at making programming of high-performance graphics systems easier while maintaining high performance. One part of our project is the AnySL project: In cooperation with the Computer Graphics Group we develop an unified shading system that is independent of source language, target architecture and rendering engine without sacrificing runtime performance.

Our goal is to eventually provide a shading-system that uses a portable shader-format to allow integration into any kind of rendering engine (e.g. ray-tracing, rasterization, global illumination). Additionally, integration of existing shading-languages only requires minimal effort while the compiler technology of AnySL still enables maximum performance.

Shaders denote program fragments that extend the functionality of a rendering system for specific tasks such as computing emission, light-material interaction, or geometry processing - similar to plug-ins used elsewhere. The key difference to such function-call and library-based plug-ins is that shading code usually needs to be transformed to meet the needs of the target applications regarding performance or program structure and should provide convenience for the programmer. However, to support a certain shading language, the compiler has to provide a compiler framework for it. Hence, the renderer's implementor ends up in investing a large part of his time in creating compilers; something he did not want to do in the first place.

AnySL is a novel approach to ease the integration of a shading language into a renderer. We compile shaders into a program representation that is independent of the shading language, the renderer, and the target hardware platform. The renderer has to provide the implementation of the basic constructs of the shading language. By augmenting the renderer with a just-in-time compiler library, the shaders are loaded and "glued" to the renderer's interface at runtime. Afterwards, the shader is mapped to the underlying hardware platform. With this approach, all performance obstacles incurred by common programming abstraction mechanisms are optimized away, resulting in high performance while keeping the maximum flexibility.

The AnySL Shading System uses an embedded just-in-time compiler (the "Low-Level Virtual Machine" (LLVM)) to load, specialize and optimize shaders at runtime. This allows us to recompile on the fly, e.g. after modifications of shader parameters, without sacrificing performance.