TL;DR
Piko is a design framework and compiler that allows developers to build custom, high-performance graphics pipelines by treating spatial binning and scheduling as first-class programmable components. By decoupling the core computation from how work is distributed, Piko enables the creation of complex renderers—like Reyes or hybrid ray tracers—that are portable across both CPUs and GPUs while remaining within striking distance of hand-optimized performance.
What Problem Does This Paper Address?
Standard graphics APIs like OpenGL and Direct3D are incredibly fast because they are baked into hardware, but they are also rigid. If you want to implement a non-standard pipeline—such as a Reyes micropolygon renderer, a voxel-based system, or a custom hybrid of rasterization and ray tracing—you are often forced to write a "software renderer" from scratch.
Writing these software pipelines is a nightmare for performance. Developers must manually manage massive parallelism, complex load balancing, and data locality (keeping related data close together in memory). Furthermore, an implementation optimized for a massively parallel GPU usually won't run efficiently on a multicore CPU. Piko aims to solve this by providing a high-level abstraction that automates these low-level optimization headaches.
Methods
The core of Piko is a new way to describe a graphics pipeline stage. Instead of writing a single monolithic function, a Piko programmer decomposes each stage into three distinct phases:
- AssignBin: Defines how an input primitive (like a triangle or a patch) is mapped to a spatial bin (a 2D tile on the screen).
- Schedule: Specifies when and where (on which core) a bin should be processed.
- Process: Contains the actual functional logic (e.g., shading a pixel or intersecting a ray).
This description is fed into Pikoc, a compiler built on LLVM. Pikoc analyzes the pipeline's structure and performs several high-level optimizations:
- Kernel Fusion: It automatically merges adjacent stages into a single execution kernel to keep data in local registers and caches, reducing expensive memory round-trips.
- Schedule Elimination: If a programmer requests simple load balancing, the compiler can offload the work to the hardware's native scheduler (like CUDA blocks).
- Static Dependency Resolution: It manages synchronization points (e.g., "don't start shading until the shadow map is done") at compile time.
Datasets
The authors evaluated Piko using several standard 3D rendering benchmarks:
- Rasterization Scenes: Fairy Forest (174K triangles, mixed sizes), Buddha (1.1M tiny triangles), Mecha (254K triangles), and Dragon (871K triangles).
- Reyes Rendering Scenes: Bigguy and Teapot, used to test the framework's ability to handle irregular, recursive workloads like surface subdivision.
Key Insights and Ideas
- Binning as a First-Class Citizen: The authors argue that spatial binning isn't just a trick for rasterizers; it's the fundamental way to manage locality in any graphics workload. By making binning programmable, Piko allows developers to prune unnecessary work early.
- Decoupling Logic from Execution: By separating
ProcessfromSchedule, a developer can change how a renderer handles load balancing for a new architecture just by tweaking a few lines of scheduling code, without touching the core rendering math. - The Locality vs. Load Balance Trade-off: Piko makes it easy to explore design trade-offs. For example, "fusing" stages improves data locality but can hurt load balancing if some cores finish much faster than others. Piko allows programmers to toggle these strategies to find the "sweet spot" for specific hardware.
Key Results
- Performance: Piko-generated rasterizers achieve real-time performance, typically running about 3–6x slower than
cudaraster, which is considered the gold standard for hand-optimized software rasterization on GPUs. - Productivity: The Piko Reyes implementation is only 1.37x slower than
Micropolis(a heavily tuned, single-GPU research renderer) but is significantly simpler to write, modify, and port to other architectures. - Versatility: The authors successfully implemented a wide array of pipelines—including deferred shading, ray tracing, and particle rendering—demonstrating that the framework isn't limited to traditional triangle drawing.
Limitations and Future Work
- Hardware Specifics: Piko currently lacks an abstraction for managing core-local "shared memory" (scratchpad memory), which is a major reason for the performance gap compared to hand-tuned CUDA code.
- Binning Dimensions: The current implementation focuses on 2D spatial bins. The authors suggest that extending this to 3D (for voxels) or non-uniform bin sizes could further improve load balancing.
- Fixed-Function Units: Piko currently implements everything in software. Integrating access to fixed-function hardware (like the hardware rasterizer or texture units) within the Piko abstraction remains an open research challenge.
Summary updated