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;

Check out INSTALL to set up Halide, and look through the tutorials to get started writing code.

The compiler is currently supported on recent releases of Mac OS X (we use 10.6 through 10.8) and mainstream Linux distributions (we use Ubuntu 12.04 through 13.04). Windows support is in progress (it builds and tests pass, but static compilation has link issues and parallelism is not yet enabled in the platform runtime).

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.

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