Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

use CodeGenOpt::None at optlevel<2, Default at 2, and Aggressive at >2 #35086

Merged
merged 1 commit into from
Mar 12, 2020

Conversation

JeffBezanson
Copy link
Member

This provides a little bit of speedup. I don't fully understand what these flags mean, but it seems to make sense to use Default at the default optimization level. Anyway I'm curious to see what the benchmarks say.

The difference in compile time between None and Default is quite large, with a much smaller difference between Default and Aggressive (which I assume is why we were using Aggressive most of the time). In fact using None for -O1 is even faster than using FastISel, so we might want to consider dropping FastISel entirely.

@nanosoldier runbenchmarks(ALL, vs=":master")

@JeffBezanson JeffBezanson added compiler:codegen Generation of LLVM IR and native code compiler:latency Compiler latency labels Mar 12, 2020
@nanosoldier
Copy link
Collaborator

Your benchmark job has completed - possible performance regressions were detected. A full report can be found here. cc @ararslan

@vtjnash
Copy link
Member

vtjnash commented Mar 12, 2020

FWIW, looks like clang made a similar change recently https://reviews.llvm.org/D28409

@Keno Keno merged commit c92af51 into master Mar 12, 2020
@Keno Keno deleted the jb/codegenoptlevel branch March 12, 2020 20:21
@Sacha0
Copy link
Member

Sacha0 commented Sep 29, 2020

This change caused some runtime regressions in RAI's codebase between 1.4 and 1.5 at O1. For the moment we've happily resolved those regressions by patching Julia to pass CodeGenOpt::Default to LLVM at O1 (while leaving e.g. O1's pass set and ordering the same), and hope to ultimately resolve those regressions by migrating back to O2 (after the interesting compilation blowup at O2 that we've discussed elsewhere is addressed).

Out of curiosity, why depart from clang's selection of CodeGenOpt::Less for O1? :) Best!

@JeffBezanson
Copy link
Member Author

We should compare some latencies with CodeGenOpt::Less, and if it seems to be a better trade-off we can switch to it. (I assume Less also fixes your performance regressions?)

@Sacha0
Copy link
Member

Sacha0 commented Sep 30, 2020

(I assume Less also fixes your performance regressions?)

Haven't tested, but will! :)

@Sacha0
Copy link
Member

Sacha0 commented Oct 5, 2020

A bit of testing indicates that using CodeGenOpt::Less at O1: a) mitigates some of the runtime regressions we observe with CodeGenOpt::None at O1; and b) provides most of the compilation time reduction we observe with CodeGenOpt::None at O1. That being the case, I will submit a pull request migrating O1 to CodeGenOpt::Less shortly, with the hope that it can find its way into 1.6 :). Thanks and best!

gbaraldi pushed a commit that referenced this pull request May 2, 2024
…37893)

For context, please see
#35086 (comment).
Regarding alignment with clang, please see
https://reviews.llvm.org/D28409
(/#35086 (comment)).

```
Prior to Julia 1.5, Julia passed CodeGenOpt::Aggressive to LLVM at -O1.
As of Julia 1.5, Julia passes CodeGenOpt::None to LLVM at -O1.

This reduction in optimization effort at -O1 improved compilation latency,
but induced appreciable runtime regressions.

This commit makes Julia pass CodeGenOpt::Less to LLVM at -O1,
mitigating the runtime regressions caused by CodeGenOpt::None,
while retaining most of CodeGenOpt::None's latency improvements.

This commit also aligns Julia's CodeGenOpt selection at -O1
with that of clang.
```

Best! :)
lazarusA pushed a commit to lazarusA/julia that referenced this pull request Jul 12, 2024
…uliaLang#37893)

For context, please see
JuliaLang#35086 (comment).
Regarding alignment with clang, please see
https://reviews.llvm.org/D28409
(/JuliaLang#35086 (comment)).

```
Prior to Julia 1.5, Julia passed CodeGenOpt::Aggressive to LLVM at -O1.
As of Julia 1.5, Julia passes CodeGenOpt::None to LLVM at -O1.

This reduction in optimization effort at -O1 improved compilation latency,
but induced appreciable runtime regressions.

This commit makes Julia pass CodeGenOpt::Less to LLVM at -O1,
mitigating the runtime regressions caused by CodeGenOpt::None,
while retaining most of CodeGenOpt::None's latency improvements.

This commit also aligns Julia's CodeGenOpt selection at -O1
with that of clang.
```

Best! :)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
compiler:codegen Generation of LLVM IR and native code compiler:latency Compiler latency
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants