Researchers at MIT's Computer Science and Artificial Intelligence Laboratory (CSAIL) have written a new programming language dubbed "Halide."
MIT graduate student Jonathan Ragan-Kelley describes Halide as an optimized language for image-processing algorithms.
Indeed, Halide programs are easier to read, write and revise than current image-processing programs written in a conventional language. Plus, Halide automates code-optimization procedures that would ordinarily take hours to perform by hand.
"Digital-photo files are getting so big that, without a lot of clever software engineering, processing them would take a painfully long time on a desktop computer, let alone a cellphone," Ragan-Kelley explained.
"Unfortunately, the tricks that engineers use to speed up their image-processing algorithms make their code almost unreadable, and rarely reusable. Adding a new function to an image-processing program, or modifying it to run on a different device, often requires rethinking and revising it from top to bottom."
Fortunately, MIT researchers have already used Halide to rewrite several common image-processing algorithms whose performance was previously optimized by seasoned programmers. The Halide versions were typically about one-third as long but offered significant performance gains — two-, three-, or even six-fold speedups.
In one instance, the Halide program was actually longer than the original — but the speedup was 70-fold. Although Halide programs are simpler to write and to read than ordinary image-processing programs, they frequently offer performance gains over even the most carefully hand-engineered code - because the scheduling is handled automatically. In addition, Halide code is so easy to modify that programmers could simply experiment with half-baked (sandbox) ideas to see if they improve performance.
"When you have the idea that you might want to parallelize something a certain way or use stages a certain way, when writing that manually, it's really hard to express that idea correctly.
"If you have a new optimization idea that you want to apply, chances are you're going to spend three days debugging it because you've broken it in the process. With Halide, you change one line that expresses that idea, and it synthesizes the correct thing," Ragan-Kelley added.
Ragan-Kelley and Andrew Adams, a CSAIL postdoc, led the development of Halide. The two will be presenting a paper on the new programming language which they co-wrote with MIT computer science professors Saman Amarasinghe and Fredo Durand at the upcoming Siggraph 2012 conference.