In this blogpost, Gabor Ballabas and I share why and how we’ve set up a public buildbot for the LLVM AArch64 backend. This buildbot is part of the LLVM community’s continuous integration infrastructure.
LLVM is an open source project providing a set of code generation libraries which are increasingly used to generate code for platforms with ARM® CPUs. These libraries are responsible for the code generation in most OpenCL drivers, Renderscript and the Clang C and C++ compiler. FreeBSD and Tizen use Clang as the default platform compiler and Debian buildbots regularly build all of Debian with Clang. Clang is included in the Android NDK. The LLVM Linux project targets building the Linux kernel with LLVM.
To ensure first-class software support for the ARMv8 architecture, a well-functioning ARMv8 AArch64 backend for LLVM is a significant and necessary step. As of today, the ARMv8 AArch64 backend can compile regular C and C++ code and support for NEON™ instructions and intrinsics is being added. Furthermore, the addition of support for ARMv8 AArch32 in LLVM is in progress. The combination of the AArch64 and the AArch32 work ensures that LLVM will fully support the ARMv8 architecture. More information about ARM terminology can be found here.
One of our main concerns while implementing support for the ARMv8 architecture in LLVM is to make sure that you can trust LLVM to produce AArch64 object code correctly for C, C++, OpenCL, or any other programming language. One scary aspect of an open source compiler project is that every day, hundreds of patches get committed to the code base; often by developers focussing mostly on other architectures and instruction sets. Therefore, we've put great emphasis on adding high quality regression tests, blocking any changes to the LLVM open source project that would severely regress the AArch64 backend. Our efforts are paying off: the AArch64 backend is already one of the backends in LLVM that are best-covered by regression tests.
In addition to the regression tests, which are used by all LLVM developers to verify they are not introducing regressions when changing the code base, we have also set up a buildbot running on an ARMv8 Foundation Model. This buildbot continuously cross-compiles Clang and LLVM itself using the top-of-trunk sources. This way, every few hours, the buildbot tests whether Clang can still correctly cross-compile itself, targeting an AArch64 Linux platform.
In the paragraphs below, Gabor explains how this buildbot has been set up, including the underlying technologies used. This helps to enable developers to recreate a similar setup to test LLVM; but this can also be used as a guideline to set up similar testing environments for other software projects that you want to port to AArch64.
The main steps in setting up the buildbot consists of (a) setting up an ARMv8 Foundation Model with Linux running on it; (b) setting up a Linaro cross-compilation toolchain targeting AArch64 Linux; (c) cross-compiling Clang; (d) running the regression tests in the foundation model with the cross-compiled Clang and (e) integrating the setup with LLVM's buildbot infrastructure. This is explained in detail below.
In the following steps, we shall use the boot image and rootfs provided by Linaro. The Linaro solution is based on Ubuntu and it comes with the most important packages. It currently lacks some of the necessary packages (for example, Python lacks modules needed for running the LLVM test suite) but this can be worked around as described in section d).
Gabor Ballabas, Developer - University of Szeged, is a Developer at the Software Engineering Department in the University of Szeged, Hungary. Currently he is the maintainer of the LLVM Aarch64 buildbot.
Hey Software Development Tools, this article shows an example of utilisation of the ARMv8 Foundation Model.
George, I saw your Fast Models introduction (Fast Models (快速模型) 简介) article which Google Translate allowed me to somewhat read. If you are also working on ARMv8, this article should interest you!