Halide (programming language): Difference between revisions

Content deleted Content added
m better source and finish register source
Citation bot (talk | contribs)
Alter: title, template type. Add: chapter-url-access, chapter-url, chapter, authors 1-1. Removed or converted URL. Removed parameters. Some additions/deletions were parameter name changes. | Use this bot. Report bugs. | Suggested by Headbomb | #UCB_toolbar
 
(5 intermediate revisions by 3 users not shown)
Line 1:
{{Short description|Computer programming language designed for digital image processing}}
{{Infobox programming language
| name = Halide
Line 23 ⟶ 24:
| influenced =
}}
{{Portal|Free and open-source software}}
'''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 [[central processing unit]]s (CPU) and [[graphics processing unit]]s (GPU). Halide is implemented as an internal [[___domain-specific language]] (DSL) in [[C++]]. Halide was announced by MIT in 2012<ref>{{Cite web |last=Hardesty |first=Larry |date=2012-08-02 |title=Writing graphics software gets much easier |url=https://news.mit.edu/2012/better-programming-language-for-image-processing-0802 |access-date=2025-06-30 |website=MIT News {{!}} Massachusetts Institute of Technology |language=en}}</ref> and released in 2013.<ref>{{Cite journalbook |lastlast1=Ragan-Kelley |firstfirst1=Jonathan |last2=Barnes |first2=Connelly |last3=Adams |first3=Andrew |last4=Paris |first4=Sylvain |last5=Durand |first5=Frédo |last6=Amarasinghe |first6=Saman |date=2013-06-16 |titlechapter=Halide: aA language and compiler for optimizing parallelism, locality, and recomputation in image processing pipelines |urldate=https://dl.acm.org/doi/10.1145/2491956.24621762013-06-16 |journaltitle=Proceedings of the 34th ACM SIGPLAN Conference on Programming Language Design and Implementation |chapter-url=https://dl.acm.org/doi/10.1145/2491956.2462176 |series=PLDI '13 |___location=New York, NY, USA |publisher=Association for Computing Machinery |pages=519–530 |doi=10.1145/2491956.2462176 |isbn=978-1-4503-2014-6|chapter-url-access=subscription }}</ref>
 
==LanguagePurpose==
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]].<ref>{{Cite journal |lastlast1=Ragan-Kelley |firstfirst1=Jonathan |last2=Adams |first2=Andrew |last3=Sharlet |first3=Dillon |last4=Barnes |first4=Connelly |last5=Paris |first5=Sylvain |last6=Levoy |first6=Marc |last7=Amarasinghe |first7=Saman |last8=Durand |first8=Frédo |date=2017-12-27 |title=Halide: decoupling algorithms from schedules for high-performance image processing |url=https://dl.acm.org/doi/10.1145/3150211 |journal=Commun. ACM |volume=61 |issue=1 |pages=106–115 |doi=10.1145/3150211 |issn=0001-0782}}</ref> 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.<ref>{{Cite web |last=Hinkel |first=Lauren |date=2024-05-03 |title=Creating bespoke programming languages for efficient visual AI systems |url=https://news.mit.edu/2024/creating-bespoke-programming-languages-efficient-visual-ai-systems-0503 |access-date=2025-06-30 |website=MIT News {{!}} Massachusetts Institute of Technology |language=en |quote=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.”}}</ref> With Halide, changing the schedule does not require any changes to the algorithm, and this allowsallowing the programmer to experiment with scheduling and finding the most efficient one.<ref name=":0">{{Cite journal |lastlast1=Adams |firstfirst1=Andrew |last2=Ma |first2=Karima |last3=Anderson |first3=Luke |last4=Baghdadi |first4=Riyadh |last5=Li |first5=Tzu-Mao |last6=Gharbi |first6=Michaël |last7=Steiner |first7=Benoit |last8=Johnson |first8=Steven |last9=Fatahalian |first9=Kayvon |last10=Durand |first10=Frédo |last11=Ragan-Kelley |first11=Jonathan |date=2019-07-12 |title=Learning to optimize halide with tree search and random programs |url=https://dl.acm.org/doi/10.1145/3306346.3322967 |journal=ACM Trans. Graph. |volume=38 |issue=4 |pages=121:1–121:12 |doi=10.1145/3306346.3322967 |issn=0730-0301|url-access=subscription }}</ref><ref>{{Cite web |last=Gottschlich |first=Justin |date=22 November 2019 |title=Machine Programming: What Lies Ahead? |url=https://knowledge.wharton.upenn.edu/article/ai-machine-learning/ |access-date=2025-06-30 |website=Knowledge at Wharton |language=en-US}}</ref>
 
== SampleScheduled sourceblur codefunction ==
The following function defines and sets the schedule for a 3×3 [[box blur|box filter]] defined as a series of two 3×1 passes, allowing the blur algorithm to remain independent of the execution schedule.<ref name=":1">{{Cite book |last1=Hennessy |first1=John L. |title=Computer architecture: a quantitative approach |last2=Patterson |first2=David A. |date=2019 |publisher=Morgan Kaufmann Publishers |isbn=978-0-12-811905-1 |edition=6th |___location=Cambridge, MA |pages=582}}</ref>
<syntaxhighlight lang="cpp">
Func blur_3x3(Func input) {
Line 48 ⟶ 50:
</syntaxhighlight>
 
==Uses and development==
==Use==
Halide was developed primarily at MIT's CSAIL lab. Both Google usedand Adobe have been involved in Halide andresearch.<ref [[TensorFlow]]name=":0" for/> itsGoogle uses Halide in Pixel 2's [[Pixel Visual Core]].<ref>{{cite web |last=Quach |first=Katyanna |date=22 October 2017 |title=Google and Intel cook AI chips, neural network exchanges – and more |url=https://www.theregister.co.uk/2017/10/22/ai_roundup/ |website=[[The Register]] |publisher=Situation Publishing}}</ref><ref name=":1" /> Adobe Photoshop also uses Halide.<ref>{{Cite web |title=Inside Halide, the open source language engineers use to make imaging tools faster |url=https://research.adobe.com/news/inside-halide-the-open-source-language |access-date=2025-06-30 |website=Adobe Research |language=en-US}}</ref> Both Google and Adobe have been involved in Halide research.<ref name=":0" />
 
== See also ==
Line 61 ⟶ 63:
== External links ==
* {{Official website|halide-lang.org}}
* {{GitHub|halide/Halide}}
 
[[Category:Image processing]]