Halide - AshokBhat/notes GitHub Wiki

About

  • A language for fast, portable computation on images and tensors
  • Embedded in C++
  • Allows algorithm and implementation details to be separated, making to easier to tune to a platform.

Repository

Example

Func halide_blur(Func in) f
 Func tmp, blurred;
  Var x, y, xi, yi;

  // The algorithm - No storage or order
  // Defines a simple 3x3 blur filter split into a blur horizontal followed by a blur vertical step

  tmp(x, y) = (in(x-1, y) + in(x, y) + in(x+1, y))/3;
  blurred(x, y) = (tmp(x, y-1) + tmp(x, y) + tmp(x, y+1))/3;

  // The schedule - 
  // Specifies how the algorithm can be treated in a parallel implementation

  blurred.tile(x, y, xi, yi, 256, 32).vectorize(xi, 8).parallel(y);
  tmp.chunk(x).vectorize(x, 8);
 return blurred;
}

FAQ

  • What is Halide?
  • What is the key innovation?
  • Where is it used?
  • What does it use for underlying technology?

Users

  • Adobe for Photoshop
  • Google for Pixel

See also