The main innovation Halide brings is the separation of the algorithm being implemented from its execution schedule, i.e. code specifying the loopnesting, parallelization, loop unrolling and vector instruction.[3] These two are usually interleaved together and experimenting with changing the schedule requires the programmer to rewrite large portions of the algorithm with every change.[4] With Halide, changing the schedule does not require any changes to the algorithm, allowing the programmer to experiment with scheduling.[5][6]
Scheduled blur function
The following function defines and sets the schedule for a 3×3 box filter defined as a series of two 3×1 passes, allowing the blur algorithm to remain independent of the execution schedule.[7]
Funcblur_3x3(Funcinput){Funcblur_x,blur_y;Varx,y,xi,yi;// The algorithm - no storage or orderblur_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 storageblur_y.tile(x,y,xi,yi,256,32).vectorize(xi,8).parallel(y);blur_x.compute_at(blur_y,x).vectorize(x,8);returnblur_y;}
Uses and development
Halide was developed primarily at MIT's CSAIL lab. Both Google and Adobe have been involved in Halide research.[5] Google uses Halide in Pixel 2's Pixel Visual Core.[8][7] Adobe Photoshop also uses Halide.[9]
^Hinkel, Lauren (2024-05-03). "Creating bespoke programming languages for efficient visual AI systems". MIT News | Massachusetts Institute of Technology. Retrieved 2025-06-30. Ragan-Kelley notes that programmers can opt for "very painstaking, very unproductive, and very unsafe low-level code," which could introduce bugs, or "more safe, more productive, higher-level programming interfaces," that lack the ability to make fine adjustments in a compiler about how the program is run, and usually deliver lower performance. So, his team is trying to find a middle ground. "We're trying to figure out how to provide control for the key issues that human performance engineers want to be able to control," says Ragan-Kelley, "so, we're trying to build a new class of languages that we call user-schedulable languages that give safer and higher-level handles to control what the compiler does or control how the program is optimized."
^ abHennessy, John L.; Patterson, David A. (2019). Computer architecture: a quantitative approach (6th ed.). Cambridge, MA: Morgan Kaufmann Publishers. p. 582. ISBN978-0-12-811905-1.