VizGen: Accelerating Visual Computing Prototypes in Dynamic Languages

Yuting Yang     Samantha Prestwood     Connelly Barnes

ACM Transactions on Graphics (presented at ACM SIGGRAPH Asia 2016)

Three applications that were compiled with our compiler, which is specialized for visual computing programs. Image compositing (a) gains a 1732X speedup over the equivalent code in the Python interpreter. Our result is shown in the diagonal upper-left corner, and the Python result is shown in the diagonal lower-right corner: notice there is no difference between the two images. A Harris corner detector (b) and a Mandelbrot fractal renderer (c) likewise gain significant speedups after being compiled with our compiler, relative to Python.


This paper introduces a novel domain-specific compiler, which translates visual computing programs written in dynamic languages to highly efficient code. We define ``dynamic" languages as those such as Python and MATLAB, which feature dynamic typing and flexible array operations. Such language features can be useful for rapid prototyping, however, the dynamic computation model introduces significant overheads in program execution time. We introduce a compiler framework for accelerating visual computing programs, such as graphics and vision programs, written in general-purpose dynamic languages. Our compiler allows substantial performance gains (frequently orders of magnitude) over general compilers for dynamic languages by specializing the compiler for visual computation. Specifically, our compiler takes advantage of three key properties of visual computing programs, which permit optimizations: (1) many array data structures have small, constant, or bounded size, (2) many operations on visual data are supported in hardware or are embarrassingly parallel, and (3) humans are not sensitive to small numerical errors in visual outputs due to changing floating-point precisions. Our compiler integrates program transformations that have been described previously, and improves existing transformations to handle visual programs that perform complicated array computations. In particular, we show that dependent type analysis can be used to infer sizes and guide optimizations for many small-sized array operations that arise in visual programs. Programmers who are not experts on visual computation can use our compiler to produce more efficient Python programs than if they write manually parallelized C, with fewer lines of application logic.

Links Photo credits

The photos in the paper are licensed under Creative Commons or public domain licenses. Links to the original photographs on Flickr (which includes each full license text) are included as hyperlinks in the paper. The photos in the caption above are: (a) Karen Arnold and Skitterphoto, (b) modified from original by Tim Green.