Fork me on GitHub


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, Native Client, 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. Expect rough edges with the Windows version - it is not as well tested as Linux and OS X. There are also "pnacl" versions. These are used for compiling for native client only.

For the freshest builds, see the nightly build folders: Linux, OS X, Windows. These have passed all our internal tests, but they're usually slightly less reliable than the latest binary release.

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

Frédo Durand also taught an introduction to Halide in his 6.815/6.865 computational photography course at MIT. The most recent offering, in Fall 2013, used the Python bindings, but the material still offers a useful introduction to programming in Halide which translates easily to the standard C++ front-end.

These academic publications describe the ideas behind Halide and its scheduling model. However, they are out-of-date in several respects. In particular, don't rely on them for correct syntax. The tutorials are a better introduction to Halide's syntax.

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.

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

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 is open source, under a commercially permissive MIT license. We encourage you to use it in other projects, open source or commercial!