[llvm-dev] [Q] What can drive compiler performance improvements in the future?
Stefanos Baziotis via llvm-dev
llvm-dev at lists.llvm.org
Mon Feb 22 17:43:13 PST 2021
Looking forward to your talk at LLVM-CGO!
Here are some directions that I have seen lately:
1) "Unconstrained" Optimization
Currently, optimization passes use a pre-determined series of steps. So,
optimizations are inherently constrained in how big leaps
the transformations can make. On the other hand, research such as STOKE 
has showed that a "more dumb" but unconstrained
optimizer can change radically even the very algorithm used. To explain the
"more dumb" but unconstrained part, the algorithm used to optimize
the program is literally:
- Start with a program (or no program, in which case the program is
- Do a random change to the program
- Compute a cost (whose specifics deserve a big discussion but it's not
the central point here; the first pointer at the end is related though)
- If the cost is better, keep the change
- Otherwise, based on some probability, keep the change
This resulted in great improvements to the program, in a not horrible
2) Automatic Parallelization Revival
Automatic Parallelization is thought to have died, but in the last couple
of years a group in Princeton has shown some
promising improvements, specifically with Perspective . I think this a
great step forward as it obtained a _23.0x_ for
12 general-purpose C/C++ programs (SPEC IIRC) running on a 28-core
shared-memory commodity machine.
I would urge you to take a closer look to that since the infrastructure is
built on top of LLVM.
Here's some related work  trying to revive automatic parallelization
from a different perspective (pun not intended).
3) Decoupling Transformations and Cost-Modeling
An important problem I think in today's compilers is that cost is baked
into the transformations (and it's
not even clear how it is computed).
The result of this is that even if you had a perfect oracle, which always
knew the perfect transformations to be done,
there is simply no way to instruct the compiler to perform the sequence.
So, my personal opinion is that in
the years to come, there will be an effort to separate transformations into
their own, dedicated and fine-grained
modules (as opposed to the monolithic entities which now are, i.e. passes).
This in turn can enable machine-learning
models (which will decide _what_ has to happen and then they'll use the
fine-grained APIs of transformations to make it happen).
(I think this is closely related to what Mircea said above)
--- Random pointers ---
* The DeepCompiler  project at MIT has done significant improvements in
predicting the performance of X86 code:
* Alex Aiken's opinion on the future of compilers 
Disclaimer: This is definitely not an exhaustive list!
Στις Τρί, 23 Φεβ 2021 στις 2:57 π.μ., ο/η Mircea Trofin via llvm-dev <
llvm-dev at lists.llvm.org> έγραψε:
> On Mon, Feb 22, 2021 at 4:50 PM Denis Bakhvalov via llvm-dev <
> llvm-dev at lists.llvm.org> wrote:
>> I'll be giving a short presentation on the LLVM performance workshop soon
>> and I want to touch on the topic of future performance improvements. I
>> decided to ask the community about what can drive performance improvements
>> in a classic C++ LLVM compiler CPU backend in the future? If I summarize
>> all the thoughts and opinions, I think it would be an interesting
>> There is already a body of research on the topic, including  which
>> talks about superoptimizers, but maybe anybody has some interesting new
>> In particular, I'm interested to hear thoughts on the following things:
>> 1. How big is the performance headroom in existing LLVM optimization
>> 2. I think PGO can play a bigger role in the future. I see the benefits
>> of more optimizations being guided by profiling data. For example, there is
>> potential for intelligent injection of memory prefetching hints based on HW
>> telemetry data on modern Intel CPUs. This HW telemetry data allows finding
>> memory accesses that miss in caches and estimate the prefetch window (in
>> cycles). Using this data compiler can determine the place for a prefetch
>> hint. Obviously, there are lots of limitations, but it's just a thought.
>> BTW, the same can be done for PGO-driven branch-to-cmov conversion
>> (fighting branch mispredictions).
>> 3. ML opportunities in compiler tooling. For example, code similarity
>> analysis  opens a wide range of opportunities, e.g. build a
>> recommendation system that will suggest a better performing code sequence.
> on this, also: replacing hand-crafted heuristics with machine learned
> policies, for those passes that are heuristics driven - like inlining,
> regalloc, instruction selection, etc. Same for cost models.
>> Please also share any thoughts you have that are not on this list.
>> If that topic was discussed in the past, sorry, and please send links to
>> those discussions.
>> : https://arxiv.org/abs/1809.02161
>> : https://doi.org/10.1145/3360578
>> : https://arxiv.org/abs/2006.05265
>> LLVM Developers mailing list
>> llvm-dev at lists.llvm.org
> LLVM Developers mailing list
> llvm-dev at lists.llvm.org
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the llvm-dev