Computer program fixes old code faster than expert engineers

July 10, 2015 by Adam Conner-Simons, Massachusetts Institute of Technology
The Helium program could help solve “a billion-dollar problem” in computing: companies having to devote time and energy to patching old code by hand. Credit: Christine Daniloff/MIT

Last year, MIT computer scientists and Adobe engineers came together to try to solve a major problem that many companies face: bit-rot.

A good example is Adobe's successful Photoshop photo editor, which just celebrated its 25th birthday. Over the years Photoshop had accumulated heaps of code that had been optimized for what is now old hardware.

"For high- code used for image-processing, you have to optimize the heck out of the software," says Saman Amarasinghe, a professor at MIT and researcher at the Computer Science and Artificial Intelligence Laboratory (CSAIL). "The downside is that the code becomes much less effective and much more difficult to understand."

This results in what Amarasinghe describes as "a billion-dollar problem": companies like Adobe having to devote massive manpower to going back into the code every few years and, by hand, testing out a bunch of different strategies to try to patch it.

But what if there were a computer program that could automatically fix old code so that engineers can focus on more important tasks, such as actually dreaming up new software?

Enter Helium, a CSAIL system that revamps and fine-tunes code without ever needing the original source, in a matter of hours or even minutes.

The team started with a simple building block of programming that's nevertheless extremely difficult to analyze: binary code that has been stripped of debug symbols, which represents the only piece of code that is available for proprietary software such as Photoshop.

A particular type of computational kernel popular for such software are "stencil kernels," which allow you to do operations for entire areas of pixels. Stencil kernels are especially important to update because they use huge amounts of memory and compute power, and their performance degenerates quickly as new hardware become available.

With Helium, the researchers are able to lift these kernels from a stripped binary and restructure them as high-level representations that are readable in Halide, a CSAIL-designed geared towards image-processing.

Going from binary to high-level languages was a big leap that the team originally didn't think was doable, according to lead author Charith Mendis.

"The order of operations in these optimized binaries are complicated, which means that they can be hard to disentangle," says Mendis, a graduate student at CSAIL. "Because stencils do the same computation over and over again, we are able to accumulate enough data to recover the original algorithms."

From there, the Helium system then replaces the original bit-rotted components with the re-optimized ones. The net result: Helium can improve the performance of certain Photoshop filters by 75 percent, and the performance of less optimized programs such as Microsoft Windows' IrfanView by 400 to 500 percent.

"We've found that Helium can make updates in one day that would take human engineers upwards of three months," says Amarasinghe. "A system like this can help companies make sure that the next generation of code is faster, and save them the trouble of putting 100 people on these sorts of problems."

The research was presented in a paper accepted to the Association for Computing Machinery SIGPLAN conference on Programming Language Design and Implementation (PLDI 2015), which took place June 13-17 in Portland, Oregon.

The paper was written by Mendis, fellow graduate students Jeffrey Bosboom and Kevin Wu, research scientist Shoaib Kamil, postdoc Jonathan Ragan-Kelley PhD '14, Amarasinghe, and researchers from Adobe and Google.

"We are in an era where computer architectures are changing at a dramatic rate, which makes it important to write code that can work on multiple platforms," says Mary Hall, a professor at the University of Utah's School of Computing. "Helium is an interesting approach that has the potential to facilitate higher-level descriptions of stencil computations that could then be more easily ported to future architectures."

One unexpected byproduct of the work is that it lets researchers see the different tricks that programmers used on the old , such as archaeologists combing through computational fossils.

"We can see the 'bit hacks' that engineers use to optimize their algorithms," says Amarasinghe, "as well as better understand the larger context of how programmers approach different coding challenges."

Explore further: Writing graphics software gets much easier

More information: "Helium: Lifting High-Performance Stencil Kernels from Stripped x86 Binaries to Halide DSL Code." groups.csail.mit.edu/commit/pa … is-pldi15-helium.pdf

Related Stories

Writing graphics software gets much easier

August 1, 2012

(Phys.org) -- Image-processing software is a hot commodity: Just look at Instagram, a company built around image processing that Facebook is trying to buy for a billion dollars. Image processing is also going mobile, as more ...

Computer scientists simplify parallel programming

March 12, 2015

Modern software takes computational speed for granted. But modern microprocessors can only speed up by increasing the number of cores. To take full advantage of multiple cores, software developers have to arrange their code ...

Recommended for you

EU set to fine Google billions over Android: sources

July 17, 2018

The EU is set to fine US internet giant Google several billion euros this week for freezing out rivals of its Android mobile phone system, sources said, in a ruling that risks fresh tensions with Washington.

5 comments

Adjust slider to filter visible comments by rank

Display comments: newest first

krundoloss
4.7 / 5 (3) Jul 10, 2015
"We've found that Helium can make updates in one day that would take human engineers upwards of three months," says Amarasinghe. "A system like this can help companies make sure that the next generation of code is faster, and save them the trouble of putting 100 people on these sorts of problems."


Finally, all those pesky humans with their "jobs" and "families" can get out the way of progress! I'm totally kidding, LOL. There should always be work for software engineers, the whole world is running off software at this point. It is interesting to see some automation in the programming field, though!
TheGhostofOtto1923
1 / 5 (1) Jul 10, 2015
How soon before programs can write their own code?
del2
4 / 5 (1) Jul 11, 2015
One unexpected byproduct of the work is that it lets researchers see the different tricks that programmers used on the old code, such as archaeologists combing through computational fossils.

"such as" implies that 'archaeologists combing through computational fossils' is an example of 'different tricks that programmers used'. 'Like archaeologists combing…' should be used here to indicate a similarity.
sebastian_schleussner
5 / 5 (1) Jul 11, 2015
IrfanView is as little "Microsoft Windows'" as Photoshop. It is a freeware program by a Bosnian programmer, which happens to run on Windows.
24volts
not rated yet Jul 11, 2015
How soon before programs can write their own code?


Well, I had programs written in BASIC back in the early 80's that could do that. So you can be pretty sure it's being done already.

Please sign in to add a comment. Registration is free, and takes less than a minute. Read more

Click here to reset your password.
Sign in to get notified via email when new comments are made.