julia icon indicating copy to clipboard operation
julia copied to clipboard

Pass CodeGenOpt::Less to LLVM at O1 (rather than CodeGenOpt::None).

Open Sacha0 opened this issue 5 years ago • 6 comments

For context, please see https://github.com/JuliaLang/julia/pull/35086#issuecomment-700944522. Regarding alignment with clang, please see https://reviews.llvm.org/D28409 (/https://github.com/JuliaLang/julia/pull/35086#issuecomment-598282810).

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! :)

Sacha0 avatar Oct 05 '20 19:10 Sacha0

For me this increases the TTFP from 7.3 to 8.5 seconds.

JeffBezanson avatar Oct 06 '20 17:10 JeffBezanson

For me this increases the TTFP from 7.3 to 8.5 seconds.

Ouch, that's more significant than observed on our workloads. Thoughts on acceptability at O1? :)

Sacha0 avatar Oct 06 '20 17:10 Sacha0

Well, Plots specifies @optlevel 1, so maybe we can reduce that to 0.

JeffBezanson avatar Oct 06 '20 18:10 JeffBezanson

Well, Plots specifies @optlevel 1, so maybe we can reduce that to 0.

I see, and cheers if that's workable; if not, I totally understand :).

Sacha0 avatar Oct 06 '20 18:10 Sacha0

We managed to work around the LLVM compilation time blowup at O2 that was keeping us at O1, subsequently migrated back to O2, and so no longer need to carry this patch. That said, this change may still make sense in principle though, what with e.g. clang's behavior; it also may not given the tradeoff identified above. Thoughts Jeff? :)

Sacha0 avatar Oct 26 '20 18:10 Sacha0

The change here itself seems fine but it's probably good to get some updated benchmarks on this @kpamnany

gbaraldi avatar Apr 25 '24 18:04 gbaraldi

This could do with a rebase + CI before merging @NHDaly

gbaraldi avatar Apr 29 '24 17:04 gbaraldi

Tapped the handy master-merge button. Let's see what explodes! 🎉

Sacha0 avatar Apr 29 '24 18:04 Sacha0

@gbaraldi, if you're happy with this patch, would you like to do the honors? :)

Sacha0 avatar May 01 '24 18:05 Sacha0