Milepost GCC - Introduction

5:00 AM Nik 0 Comments

Continuing with the work of the previous week, this week I started reading up about Milepost GCC. Some of the information can be found on this link: and the following paper:

I am putting up here some of the extracts which I thought were important and which highlight the key concept of the Machine Learning based compiler:
  1. Considerable speed-ups can be already obtained after iterative compilation on all platforms. However, this is a time-consuming process and different speed-ups across different platforms motivate the use of machine learning to automatically build specialized compilers and predict the best optimization flags or sequences of passes for different architectures.

  2. Research has shown a great potential to improve program execution time or reduce code size by carefully selecting global compiler flags or transformation parameters using iterative compilation. The quality of generated code can also be improved by selecting different optimization orders. Milepost GCC's approach combines the selection of optimal optimization orders and tuning parameters of transformations at the same time.

  3. Here is a description of some of the related tools and frameworks:

    • Continuous Collective Compilation Framework (CCC): A tool that generates the training examples for the Machine Learning tools. It does this by evaluating different compilation optimizations, storing execution time, code size and other metrics in a database.
    • Interactive Compilation Interface (ICI): The ICI provides opportunities for external control and examination of the compiler. The new version of ICI expands on the capabilities of its predecessor permitting the pass order to be modified. This version of ICI is used in the Milepost GCC to automatically learn good sequences of optimization passes.
    • PLUGINS: The features of the program (program structure) are extracted from Milepost GCC via a plugin and are also stored in the database. They are driven through shared libraries.

  4. Working of Milepost GCC:

    • The plugins are invoked by the new -fici GCC flag or by setting ICI_USE environment variable to 1. When GCC detects these options, it loads a plugin (dynamic library) with a name specified by ICI_PLUGIN environment variable.
    • The machine learnt model predicts the best GCC optimization to apply to an input program based on its program structure or program features.
    • To extract these static program features an additional GCC pass 'ml-feat' is implemented. This pass can be called using a extract_program_static_features plugin after any arbitrary pass starting from FRE when all the GCC data necessary to produce features is ready.
There is still a lot of material to be read. I will give some details about the plugins I have installed in the next post. I believe Milepost GCC is an ingenious idea, however, as a user, I would have been happier if the documentation had been better. Currently I have to read the READMEs scattered around in the installation directories, and they are not very clear and specific.

You Might Also Like


Powered by Blogger.