Halide (programming language)

From Wikipedia, the free encyclopedia
Jump to navigation Jump to search
Halide
Paradigmsfunctional, parallel
Designed byJonathan Ragan-Kelley
Andrew Adams
DeveloperMIT, (with help from Stanford, Google, Adobe)
First appeared2012; 14 years ago (2012)
Typing disciplinestatic
Implementation languageC++
OSmacOS, mainstream Linux distributions, Windows
LicenseMIT License
Websitehalide-lang.org

Lua error in mw.title.lua at line 392: bad argument #2 to 'title.new' (unrecognized namespace name 'Portal'). Halide is a computer programming language designed for writing digital image processing code that takes advantage of memory locality, vectorized computation and multi-core central processing units (CPU) and graphics processing units (GPU). Halide is implemented as an internal domain-specific language (DSL) in C++. Halide was announced by MIT in 2012[1] and released in 2013.[2]

Purpose

[edit | edit source]

The main innovation Halide brings is the separation of the algorithm being implemented from its execution schedule, i.e. code specifying the loop nesting, 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

[edit | edit source]

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]

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;
}

Uses and development

[edit | edit source]

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]

See also

[edit | edit source]

References

[edit | edit source]
  1. ^ Lua error in Module:Citation/CS1/Configuration at line 2172: attempt to index field '?' (a nil value).
  2. ^ Lua error in Module:Citation/CS1/Configuration at line 2172: attempt to index field '?' (a nil value).
  3. ^ Lua error in Module:Citation/CS1/Configuration at line 2172: attempt to index field '?' (a nil value).
  4. ^ Lua error in Module:Citation/CS1/Configuration at line 2172: attempt to index field '?' (a nil value).
  5. ^ a b Lua error in Module:Citation/CS1/Configuration at line 2172: attempt to index field '?' (a nil value).
  6. ^ Lua error in Module:Citation/CS1/Configuration at line 2172: attempt to index field '?' (a nil value).
  7. ^ a b Lua error in Module:Citation/CS1/Configuration at line 2172: attempt to index field '?' (a nil value).
  8. ^ Lua error in Module:Citation/CS1/Configuration at line 2172: attempt to index field '?' (a nil value).
  9. ^ Lua error in Module:Citation/CS1/Configuration at line 2172: attempt to index field '?' (a nil value).
[edit | edit source]