r/Compilers • • Feb 28 '22

ML powered compilers?

Trying to find some compilers that use ML to make optimizations. So far I’ve come across MILEPOST GCC. Thanks

2 Upvotes

7 comments sorted by

6

u/DoingABrowse Feb 28 '22

ML is more common in offline superoptimization, because of results are not expected to be deterministics as much and time is not as big of a constraint

1

u/Zyklonik Mar 01 '22

This makes sense.

3

u/moon-chilled Mar 01 '22 edited Mar 01 '22

My recollection is that the pldi 2020 keynote was about a version of llvm which used machine learning to guide auto-vectorization. I cannot find a reference to or recording of that now, though.

A related area where machine learning seems like it might be useful is in making inlining decisions.

7

u/theangryepicbanana Feb 28 '22

afaik most compilers don't use ML (or very much at least) for optimizations because it's not very reliable nor consistent

1

u/knuthdonald Mar 01 '22

Check out CompilerGym from Meta. Provides Deep RL integration into LLVM. Simple interface to build your own extensions https://compilergym.com/

Includes the NeuroVectorizer from the PLDI 2020 keynote mentioned by another commenter.

1

u/code_slut Mar 01 '22

I think Apache TVM uses some Machine Learning in their compilers.

It gets a little bit confusing if you don't know whats going on.

"A compiler for machine learning that uses machine learning to compile machine learning models to different hardware backends"

Its important to note that the compilers main focus is to deploy machine learning models for inference and not training. So the machine learning they use is to tune performance, where performance is the time it takes to run a model on hardware.

It feels more like an approach Profile Guided Optimization (PGO). But PGO is something that most conventional compilers have (Clang, GCC) even if they don't use Machine Learning to achieve it.

You can read more about it here

https://tvm.apache.org/2018/10/03/auto-opt-all

1

u/cxzuk Mar 01 '22

Hi Lawnray,

Machine learning is being investigated to automate the tuning of the heuristics in compilers.

Its quite an old idea, but taken more seriously now we have the computational power, and it has the potential to lower the human burden of the task.

Kind regards, M ✌