<div dir="ltr"><div dir="ltr">Hi everyone,<div><br></div><div>1) is already doing autotuning (it's a hybrid between a static cost model and an actual running in the target, you can see more here [1])</div><div>But what I tried to convey, at least from my perspective and that of the one of the authors (Alex Aiken) is that it is an example</div><div>of a bigger idea. Specifically, that we don't even code the transformation in the classic sense; we make "dumb"</div><div>optimizers which incidentally are also unconstrained.</div><div><br></div><div>Parallelization in 2) is based on different ideas than a loop transformation framework where we try multiple transformations.</div><div>The core idea is to remove dependence edges based on speculation to enable parallelization. To put it differently,</div><div>it is dependence-centric, where we don't have many transformations to do (actually, pretty much just one: parallelization)</div><div>as opposed to transformation-centric, where we care about what is the best sequence of e.g. loop transformations</div><div>to apply (and dependences are the means to the transformations, not the goal).</div><div><br></div><div>That is not to say that the framework you mentioned Michael is not great. It's just that AFAIU, the core</div><div>ideas are different (which is great for pluralism :))</div><div><br></div><div>IMHO, this framework certainly is great and in fact, it ties nicely with 3). I would argue that it is an important step for</div><div>loop optimizations in LLVM whether it is later used for auto-tuning or not.</div><div><br></div><div>(FWIW, I'm working on 3) from a different angle and hopefully, soon we'll be able to make the work public :))</div><div><br></div><div>Best,</div><div>Stefanos</div><div><br></div><div>[1] <a href="http://www.youtube.com/watch?v=rZFeTTFp7x4">www.youtube.com/watch?v=rZFeTTFp7x4</a></div></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">Στις Τετ, 24 Φεβ 2021 στις 4:42 π.μ., ο/η Michael Kruse <<a href="mailto:llvmdev@meinersbur.de">llvmdev@meinersbur.de</a>> έγραψε:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">To add to Stefanos' list, I think autotuning would be another point<br>
since at compile time it is unknown with which parameters a program is<br>
invoked and cost heuristics as in 1) cannot model the entire<br>
architecture. Ideally, reoptimization using collected information<br>
during runtime would be done transparently by a JIT as in Chis<br>
Lattner's original master's thesis.<br>
<br>
Stefanos' items 1)-3) would be possible, at least for loop nests,<br>
using a framework that I outlined in [7].<br>
<br>
[9] <a href="https://llvm.org/pubs/2004-01-30-CGO-LLVM.html" rel="noreferrer" target="_blank">https://llvm.org/pubs/2004-01-30-CGO-LLVM.html</a><br>
[7] <a href="https://youtu.be/zHHUh0c5wig" rel="noreferrer" target="_blank">https://youtu.be/zHHUh0c5wig</a><br>
<br>
<br>
Am Mo., 22. Feb. 2021 um 19:43 Uhr schrieb Stefanos Baziotis via<br>
llvm-dev <<a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a>>:<br>
><br>
> Hi Denis,<br>
><br>
> Looking forward to your talk at LLVM-CGO!<br>
><br>
> Here are some directions that I have seen lately:<br>
><br>
> 1) "Unconstrained" Optimization<br>
><br>
> Currently, optimization passes use a pre-determined series of steps. So, optimizations are inherently constrained in how big leaps<br>
> the transformations can make. On the other hand, research such as STOKE [1] has showed that a "more dumb" but unconstrained<br>
> optimizer can change radically even the very algorithm used. To explain the "more dumb" but unconstrained part, the algorithm used to optimize<br>
> the program is literally:<br>
><br>
> - Start with a program (or no program, in which case the program is synthesized)<br>
><br>
> - Do a random change to the program<br>
>   - 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)<br>
>   - If the cost is better, keep the change<br>
>   - Otherwise, based on some probability, keep the change<br>
>   - Repeat<br>
><br>
> This resulted in great improvements to the program, in a not horrible compilation time.<br>
><br>
> 2) Automatic Parallelization Revival<br>
><br>
> Automatic Parallelization is thought to have died, but in the last couple of years a group in Princeton has shown some<br>
> promising improvements, specifically with Perspective [2]. I think this a great step forward as it obtained a _23.0x_ for<br>
> 12 general-purpose C/C++ programs (SPEC IIRC) running on a 28-core shared-memory commodity machine.<br>
> I would urge you to take a closer look to that since the infrastructure is built on top of LLVM.<br>
><br>
> Here's some related work [3] trying to revive automatic parallelization from a different perspective (pun not intended).<br>
><br>
> 3) Decoupling Transformations and Cost-Modeling<br>
><br>
> An important problem I think in today's compilers is that cost is baked into the transformations (and it's<br>
> not even clear how it is computed).<br>
><br>
> The result of this is that even if you had a perfect oracle, which always knew the perfect transformations to be done,<br>
> there is simply no way to instruct the compiler to perform the sequence. So, my personal opinion is that in<br>
> the years to come, there will be an effort to separate transformations into their own, dedicated and fine-grained<br>
> modules (as opposed to the monolithic entities which now are, i.e. passes). This in turn can enable machine-learning<br>
> models (which will decide _what_ has to happen and then they'll use the fine-grained APIs of transformations to make it happen).<br>
><br>
> (I think this is closely related to what Mircea said above)<br>
><br>
> --- Random pointers ---<br>
><br>
> * The DeepCompiler [4] project at MIT has done significant improvements in predicting the performance of X86 code:<br>
> * Alex Aiken's opinion on the future of compilers [5]<br>
><br>
> Disclaimer: This is definitely not an exhaustive list!<br>
><br>
> [1] <a href="https://github.com/StanfordPL/stoke" rel="noreferrer" target="_blank">https://github.com/StanfordPL/stoke</a><br>
> [2] <a href="https://liberty.princeton.edu/Projects/AutoPar/Perspective/" rel="noreferrer" target="_blank">https://liberty.princeton.edu/Projects/AutoPar/Perspective/</a><br>
> [3] <a href="https://www.youtube.com/watch?v=8B25HQeJ0Ms" rel="noreferrer" target="_blank">https://www.youtube.com/watch?v=8B25HQeJ0Ms</a><br>
> [4] <a href="https://www.deep-compiler.org/" rel="noreferrer" target="_blank">https://www.deep-compiler.org/</a><br>
> [5] <a href="https://youtu.be/ob0nfNr2FLc?t=156" rel="noreferrer" target="_blank">https://youtu.be/ob0nfNr2FLc?t=156</a><br>
><br>
> Στις Τρί, 23 Φεβ 2021 στις 2:57 π.μ., ο/η Mircea Trofin via llvm-dev <<a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a>> έγραψε:<br>
>><br>
>><br>
>><br>
>> On Mon, Feb 22, 2021 at 4:50 PM Denis Bakhvalov via llvm-dev <<a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a>> wrote:<br>
>>><br>
>>> Hello,<br>
>>><br>
>>> 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 discussion.<br>
>>><br>
>>> There is already a body of research on the topic, including [1] which talks about superoptimizers, but maybe anybody has some interesting new ideas.<br>
>>> In particular, I'm interested to hear thoughts on the following things:<br>
>>> 1. How big is the performance headroom in existing LLVM optimization passes?<br>
>>> 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).<br>
>>> 3. ML opportunities in compiler tooling. For example, code similarity analysis [2][3] opens a wide range of opportunities, e.g. build a recommendation system that will suggest a better performing code sequence.<br>
>><br>
>> 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.<br>
>><br>
>>><br>
>>> Please also share any thoughts you have that are not on this list.<br>
>>><br>
>>> If that topic was discussed in the past, sorry, and please send links to those discussions.<br>
>>><br>
>>> -Denis<br>
>>> <a href="https://easyperf.net" rel="noreferrer" target="_blank">https://easyperf.net</a><br>
>>><br>
>>> [1]: <a href="https://arxiv.org/abs/1809.02161" rel="noreferrer" target="_blank">https://arxiv.org/abs/1809.02161</a><br>
>>> [2]: <a href="https://doi.org/10.1145/3360578" rel="noreferrer" target="_blank">https://doi.org/10.1145/3360578</a><br>
>>> [3]: <a href="https://arxiv.org/abs/2006.05265" rel="noreferrer" target="_blank">https://arxiv.org/abs/2006.05265</a><br>
>>><br>
>>><br>
>>><br>
>>><br>
>>> _______________________________________________<br>
>>> LLVM Developers mailing list<br>
>>> <a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a><br>
>>> <a href="https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev" rel="noreferrer" target="_blank">https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev</a><br>
>><br>
>> _______________________________________________<br>
>> LLVM Developers mailing list<br>
>> <a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a><br>
>> <a href="https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev" rel="noreferrer" target="_blank">https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev</a><br>
><br>
> _______________________________________________<br>
> LLVM Developers mailing list<br>
> <a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a><br>
> <a href="https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev" rel="noreferrer" target="_blank">https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev</a><br>
</blockquote></div>