Halide (programming language): Difference between revisions

Content deleted Content added
Replaced content with 'This article is about the programming launguage Halide.'
Tag: Replaced
Undid revision 864483035 by 47.44.232.138 (talk)
Line 1:
{{more citations needed|date=March 2018}}
This article is about the programming launguage Halide.
{{Infobox programming language
| name = Halide
| logo =
| caption =
| file_ext =
| paradigm = [[Functional programming|functional]], [[Parallel programming model|parallel]]
| year = 2012
| designer = Jonathan Ragan-Kelley and Andrew Adams
| developer = [[Massachusetts Institute of Technology|MIT]], (with help from [[Stanford University|Stanford]] and [[Adobe Systems|Adobe]])
| latest_release_version =
| latest_release_date =
| latest_test_version =
| latest_test_date =
| typing = [[Static typing|static]]
| implementations =
| dialects =
| influenced_by =
| influenced =
| programming_language = [[C++]]
| operating_system = Mac OS X (10.6 through 10.8), mainstream Linux distributions, Windows
| license =
| website = http://halide-lang.org/
| wikibooks =
}}
'''Halide''' is a computer [[programming language]] designed for writing [[digital image processing]] code that takes advantage of [[memory locality]], [[array programming|vectorized computation]] and multi-core [[CPU]]s and [[GPU]]s.<ref name="refsite1">{{cite web |url=http://www.i-programmer.info/news/192-photography-a-imaging/4588-halide-new-language-for-image-processing.html | title=Halide - New Language For Image Processing |year=2012 |accessdate=20 September 2013}}</ref> Halide is implemented as an internal [[___domain-specific language]] (DSL) in [[C++]].
 
==Language==
The main innovation Halide brings is the separation of the [[algorithm]] being implemented from its [[scheduling (computing)|execution schedule]], i.e. code specifying the [[loop (computing)|loop]] [[nesting (computing)|nesting]], [[parallelization]], [[loop unrolling]] and [[vector processor|vector instruction]]. 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. With Halide, changing the schedule does not require any changes to the algorithm and this allows the programmer to experiment with scheduling and finding the most efficient one.
 
== Sample source code ==
The following function defines and sets the schedule for a 3x3 [[box blur|box filter]] defined as a series of two 3x1 passes:
<source lang="cpp">
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;
}
</source>
 
==Use==
Google used Halide and [[TensorFlow]] for its Pixel 2 [[Pixel Visual Core]].<ref>{{cite web|url=https://www.theregister.co.uk/2017/10/22/ai_roundup/|title=Google and Intel cook AI chips, neural network exchanges – and more|publisher=Situation Publishing|website=[[The Register]]}}</ref>
 
== See also ==
* [[Cuneiform (programming language)]]
* [[Algorithmic skeleton]]
* [[Parallel programming model]]
 
== References ==
{{Reflist}}
 
== External links ==
* [http://halide-lang.org/ http://halide-lang.org/]
* [http://people.csail.mit.edu/jrk/halide12 Decoupling Algorithms from Schedules for Easy Optimization of Image Processing Pipelines]
* {{cite web|url= http://people.csail.mit.edu/jrk/halide-pldi13.pdf |title=Halide: A Language and Compiler for Optimizing Parallelism, Locality, and Recomputation in Image Processing Pipelines }}&nbsp;{{small|(8,259&nbsp;KB)}}
 
[[Category:Image processing]]
[[Category:Functional languages]]
[[Category:Parallel computing]]