The Machine Guided Energy Efficient Compiler (MAGEEEC) project was an InnovateUK supported research program between University of Bristol and Embecosm, with the aim of making machine learning feasible in commercial compilers, specifically for generating energy efficient code. Running from mid-2012 to the end of 2013, the objective was to achieve a 20% reduction in typical code energy usage in deeply embedded systems.
Under this project we implemented the first version of the MAGEEC framework, and integrated it with an energy measurement board (the MAGEEC Wand) designed by Dr Simon Hollis, then at Bristol University. This allowed us to sample energy usage on small computers up to 2 million times per second to an accuracy of 1%, essential if we were to get accurate training data. This first version of MAGEEC used the plugin interface to control the GCC pass manager directly. We were able to demonstrate machine learning that could reduce energy consumption in deeply embedded computers, using Atmel AVR processors as the evaluation system.
Total Software Energy Reduction and Optimization (TSERO) was an InnovateUK supported follow-on project between Embecosm, Allinea (now part of ARM), Concertim and STFC Daresbury Hartree Center, which aimed to apply the same techniques to high performance computing systems and data centers. Running between 2015 and 2017, this project added superoptimization as a technique for energy optimization. University of Bristol continued to be involved as technical advisors to the project.
Fitting custom energy loggers to valuable HPC systems was not an option, so the data for machine learning was taken from the Allinea MAP tool, which collates energy information from all nodes in an HPC system. This required the MAGEEC system to use a much larger statistical sample to get useful data.
The MAGEEC system was rewritten for this project, based on the previous experience. Interfacing through the GCC plugin interface was too compiler specific, and proved very easy to select invalid optimization pass combinations which would crash to the compiler. We switched to controlling the compiler through the command line. This also made it easier to work with LLVM which has no standard plugin interface.
By late 2017 we were able to demonstrate that MAGEEC could improve execution speed compared to standard -O3 for some common HPC kernels. We did not see improvement in call cases, but where we did, the improvement averaged 8%. This is not as much as the target 20%, but still represents an important gain, particularly if we can achieve the same for energy efficiency. Google and Amazon between them spend US$1billion each year on energy for their data centers, and an 8% reduction is a significant saving.