Accelerating open source LLVM development

Arm today announces that it is supporting the open source LLVM community through the provision of a build bot and build cache that targets the Arm architecture. This allows LLVM developers to locate and fix build and test failures more rapidly.

What is the LLVM Project?

The LLVM project is an open source compiler framework that supports code-generation for many hardware platforms, including Arm. Toolchains based on the LLVM Project are widely adopted by major platform vendors due to its permissive free software license model as well as the modular design which allows reuse of code optimisation and generation components across different hardware platforms.

Technical aspects apart, building and testing such a complex tool is an expensive computing task, which can take several hours. Also, as LLVM supports many architectures, it is not a trivial task for a developer who works on a specific architecture to keep track of the impact of their changes on other architectures.

It is also important to highlight that LLVM project is a very dynamic and fast-paced community, with more than a hundred changes being made every day on average. Keeping track of how these changes are affecting the whole project is a very challenging task. For that reason, modern software development practices such as continuous integration and build automation play an important role in helping developers to be aware of the status of the code as fast and often as possible.

How is Arm contributing to the LLVM Project?

To help the LLVM community to succeed on the above-mentioned goals, Arm is contributing two new builder machines that will provide developers with continuous feedback about how their changes affect the stability of LLVM code on the Arm platform.

In this context, there are two main contributions we want to deliver with these new build servers:

  • Provide quick feedback in case a given commit breaks the build
  • Keep an archive of LLVM toolchain builds, also known as the LLVM build cache

The diagram below summarizes the steps from the source code to the final package being publicly available:

Works on Arm infrastructure process diagram

The process starts when a developer submits a patch to the upstream LLVM repository (step 1 in the diagram), which triggers a build job in the upstream LLVM build system (step 2). In this context, the actual build jobs are also triggered in order to build LLVM, clang (the LLVM's C/C++ frontend) and libraries as can be seen on step 3 in the image. Once the build is done, the resultant packages are uploaded to Google Cloud Storage (step 4), where they are publicly accessible for the community. In case the build fails, a notification goes out to the developer who submitted the code.

Works on Arm

We are currently using Works on Arm as the underlying platform to run these build jobs. Works on Arm provides free-of-charge Arm-based infrastructure for open source projects. In that way, we gain access to powerful build servers to complete such a challenging task within acceptable build time constraints.

Talking about time constraints, based on our experiments of building more than five hundred LLVM toolchains from real commits, this build system will deliver a ready-to-use native Arm toolchain in just 20 minutes after the code is merged on the LLVM repository. It also means that in case a developer accidentally breaks the build, the system will be able to send a message in about 10 minutes, to make the developer aware that a given commit just made the build unstable.

As mentioned before, all the successful builds will also be part of an archive of LLVM builds over time, also known as the LLVM build cache, which is already in place for other target platforms and we are introducing to Arm platforms for both 32 and 64 versions of the architecture.

This build cache aims to enable any interested person like open source developers and researchers to:

  • Have a single repository to refer when discussing recently introduced changes
  • Be able to analyze how the toolchain changes in behaviour over time without the need to build it several times
  • Investigate when issues were introduced by bisecting changes, using tools like llvmlab

With the introduction of these build servers, developing on and for your favorite Arm-based platforms got that much easier.

Anonymous