Everything should be
as simple as possible,
but not simpler ~
Albert Einstein

LLVM

Starting Out as a Research Project, Hits the Big Time
Click! magazine December 2013

Vikram Adve, professor of computer science, and his first-year graduate student, Chris Lattner, made a plan for their next project. It was not a big plan, just the kind of plan a professor and a graduate student make all the time in the course of their research. 

“We had talked about the idea of developing an infrastructure to use for both dynamic and static compilation, which we were going to work on after vacation,” remembers Adve.

Apparently, Lattner’s idea of vacation was to write code, because in January, 2001, when he returned from his Banks, Ore. home, Lattner had a rough prototype of what would eventually become LLVM.

 “I still remember him walking into my office and wanting to show me something,” says Adve. “It was a pleasant surprise.”

That prototype included a lot of the key design elements of what would become LLVM, says Adve. LLVM originally stood for “low level virtual machine,” but as LLVM has expanded its capabilities it has left that derivation behind and is known only by its initials.

Lattner’s approach involved building a modular infrastructure that could be put together in many different ways to build compilers and other tools.

“Developing a compiler is a huge effort, so having one that you could use for all languages saves a lot of effort,” says Adve. LLVM’s virtual instruction set is the “secret sauce, the crux of its being able to do so many languages, whether static, scripting or managed,” Adve adds.

Lattner had been deeply steeped in computing since he was a child.

“I had been interested in programming from a very young age, starting with basic programming on the Commodore “Vic 20" computer when I was in elementary school,” says Lattner, who has a bachelor’s degree in computer science from the University of Portland. “I had a fascination with getting the machine to do what I wanted it to, and was always the sort of person that liked taking things apart and rebuilding them. Plus I just really love programming and solving hard problems, and compilers require both.”

“I had no idea how good he was,” says Adve, referring to those early days. “He is single-handedly responsible for the elegance and cleanliness of the LLVM architecture, as well as much of the code.”

But neither Adve nor Lattner could have appreciated at the time just how big LLVM would grow.

This year, exactly a decade after LLVM was first released to the public, Lattner and Adve were awarded the prestigious ACM Software System Award. The award is given to an institution or individual(s) that has developed a software system with lasting influence, reflected in contributions to concepts, in commercial acceptance, or both.

The award is given to a single software system, worldwide, each year. Yet this is the second time a tool developed at the University of Illinois has won the award. In 1995, Marc Andreesen and Eric Bina, also received the ACM Software System Award. Working together at NCSA they developed the web browser Mosaic, which is generally credited with sparking the World Wide Web revolution.

Begun as a research project, LLVM is now used by many leading software companies worldwide. Although the average user is not aware of it, LLVM is integral to both the iPhone and the Android. Sony uses LLVM to compile code for PlayStation. Cray uses it to build software for supercomputers, including Blue Waters, the petaflop-scale system at the University of Illinois. Google also uses LLVM for all its internal software.

This year, a story in Wired magazine described LLVM as the only thing Apple and Google still have in common, and called LLVM “a piece of technological brilliance”…. that “is changing the way we build and run computer software — any computer software.”

While others had tried to solve the problem, with varying degrees of success, LLVM’s approach lies in its much more basic language. It has much less information specific to a given programming language, which makes it closer to machine code and more universal.

LLVM “is a way to effectively bury the compilation element of a language interpreter below the application layer where the runtime module normally resides, deep into object code,” Scott Fulton III wrote in Betanews.

There are other solutions like LLVM, but none are as robust, well supported, and flexible. In addition, LLVM has a very liberal open source license. That means that companies can adopt it for use in their proprietary programs and not worry about giving away clues about that program or proprietary hardware for which their compiler is used.

“It is one thing to develop a research infrastructure, but it’s another to make one robust enough and clean enough for companies to use,” says Adve.

Today LLVM has become a primary compiler at Apple, Qualcomm, nVidia and Cray.

“That is a very big deal,” says Adve. “The compiler is a linchpin piece of software. Replacing the compiler system is a much deeper change than you could imagine, especially for a major company with a large portfolio of software tools.”

Not only are companies using LLVM, but researchers are also using it, something that gratifies Adve and Lattner deeply. LLVM has been used in software research including architecture, compilers, software security, and silicon compilation.

Lattner, who has worked at Apple since 2005, continues to grow and support LLVM.

“LLVM has been a lot of work, and required a lot of dedication,” says Lattner, who was honored with a Distinguished Alumni Achievement award from the Department of Computer Science this year.  “For me, I look at LLVM as a collection of small successes, and take pride with each small achievement that I personally contributed to along the way. I really just like building useful things, and like seeing a well designed system come together.”

 

 

 

 

 

 

 

 

Read more writings in my features, essays or books