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

Support compiling codegen units in parallel #1271

Merged
merged 9 commits into from
Aug 24, 2022
Merged

Conversation

bjorn3
Copy link
Member

@bjorn3 bjorn3 commented Aug 24, 2022

With this on machines with many cores cg_llvm no longer has a perf advantage over cg_clif on the simple-raytracer benchmark:

$ hyperfine --prepare "cargo clean" "cargo build" "../build/cargo-clif build"
Benchmark 1: cargo build
  Time (mean ± σ):      6.782 s ±  0.014 s    [User: 23.918 s, System: 4.269 s]
  Range (min … max):    6.755 s …  6.800 s    10 runs
 
Benchmark 2: ../build/cargo-clif build
  Time (mean ± σ):      6.505 s ±  0.017 s    [User: 16.604 s, System: 3.640 s]
  Range (min … max):    6.484 s …  6.540 s    10 runs
 
Summary
  '../build/cargo-clif build' ran
    1.04 ± 0.00 times faster than 'cargo build'

And even on my personal laptop there is a non-trivial perf improvement (~35% perf benefit of cg_clif over cg_llvm as opposed to ~20% previously):

Benchmark 1: cargo build
  Time (mean ± σ):     16.985 s ±  0.487 s    [User: 48.250 s, System: 4.623 s]
  Range (min … max):   16.692 s … 18.339 s    10 runs
 
Benchmark 2: ~/Projects/cg_clif2/build/cargo-clif build
  Time (mean ± σ):     12.517 s ±  0.065 s    [User: 29.892 s, System: 4.536 s]
  Range (min … max):   12.438 s … 12.642 s    10 runs
 
Summary
  '~/Projects/cg_clif2/build/cargo-clif build' ran
    1.36 ± 0.04 times faster than 'cargo build'

On the rustc perf suite there are now only a couple of wall time regressions compared to cg_llvm as opposed to almost all.

Wall time on the rustc perf suite when compared to cg_llvm.

image

The jobserver handling could probably be finetuned for a bit more performance, but as I have been struggling with getting it to work correctly at all for almost a week, I'm going to leave that for now.

Fixes #652

See #1266 for the previous PR in this series.

@bjorn3 bjorn3 added C-enhancement Category: An issue proposing an enhancement or a PR with one. compile-time How fast is the code compiled labels Aug 24, 2022
@bjorn3 bjorn3 merged commit ee8f8bf into master Aug 24, 2022
@bjorn3 bjorn3 deleted the parallel_comp_support branch August 24, 2022 15:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-enhancement Category: An issue proposing an enhancement or a PR with one. compile-time How fast is the code compiled
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Use multiple threads for codegen
1 participant