Fork me on GitHub

Halide

a language for image processing and computational photography

Halide is a new programming language designed to make it easier to write high-performance image processing code on modern machines. Its current front end is embedded in C++. Compiler targets include x86/SSE, ARM v7/NEON, CUDA, and OpenCL.

The following function defines and sets the schedule for a 3x3 box filter defined as a series of two 3x1 passes:

Func blur_3x3(Func input) {
  Func blur_x, blur_y;
  Var x, y, xi, yi;

  // The algorithm - no storage or order
  blur_x(x, y) = (input(x-1, y) + input(x, y) + input(x+1, y))/3;
  blur_y(x, y) = (blur_x(x, y-1) + blur_x(x, y) + blur_x(x, y+1))/3;

  // The schedule - defines order, locality; implies storage
  blur_y.tile(x, y, xi, yi, 256, 32)
        .vectorize(xi, 8).parallel(y);
  blur_x.compute_at(blur_y, x).vectorize(x, 8);

  return blur_y;
}

Download a binary release of Halide. You probably want the version starting with halide_Linux_64_trunk, halide_Darwin_64_trunk, or halide_Windows_64_trunk for Linux, OS X, and Windows respectively.

For the freshest builds, see the continuous build server. The status of the build on each platform is here. If it's green, then it has passed all of our internal tests.

If you would prefer to build Halide from source, see README for instructions.

To get started writing code, look through the tutorials, and the example apps. The tests are small self-contained programs that cover all corners of the language, so they can also be instructive. However they're not designed to teach, so you may find them cryptic.

Course Notes

We taught a course on Halide at CVPR 2015. The course notes are a useful introduction to Halide.

Frédo Durand also taught an introduction to Halide in his 6.815/6.865 computational photography course at MIT.

These academic publications describe the ideas behind Halide and its scheduling model. Halide syntax changes over time, so don't rely on them for correct syntax. The tutorials are a better introduction to Halide's syntax. Two of the papers describe algorithms that automatically determine schedules, but neither of these algorithms are in trunk Halide (yet).

Automatically Scheduling Halide Image Processing Pipelines
Ravi Teja Mullapudi Andrew Adams, Dillon Sharlet, Jonathan Ragan-Kelley, Kayvon Fatahalian.
SIGGRAPH 2016

Decoupling Algorithms from the Organization of Computation for High Performance Image Processing: The design and implementation of the Halide language and compiler
Jonathan Ragan-Kelley
Ph.D. dissertation, MIT, May 2014.

Halide: A Language and Compiler for Optimizing Parallelism, Locality, and Recomputation in Image Processing Pipelines
Jonathan Ragan-Kelley, Connelly Barnes, Andrew Adams, Sylvain Paris, Frédo Durand, Saman Amarasinghe.
PLDI 2013

Decoupling Algorithms from Schedules for Easy Optimization of Image Processing Pipelines
Jonathan Ragan-Kelley, Andrew Adams, Sylvain Paris, Marc Levoy, Saman Amarasinghe, Frédo Durand.
SIGGRAPH 2012


This talk is a companion to the papers. It describes the philosophy of Halide, and the ideas behind the scheduling model.

Development
tutorials
docs
wiki
issues
code
Mailing Lists
halide-announce - announcement of releases and other news.
halide-dev - technical discussion on the development and use of Halide. When in doubt, ask here for help.
Stack Overflow
#halide
License
Halide is open source, under a commercially permissive MIT license. We encourage you to use it in other projects, open source or commercial!