tra added a comment.

I would argue that parallel compilation and linking may need to be disabled by 
default. I believe similar patches were discussed in the past regarding 
sub-compilations, but they are relevant for parallel linking, too.
Google search shows D52193 <https://reviews.llvm.org/D52193>, but I believe 
there were other attempts in the past. 
@yaxunl - I vaguely recall that we did discuss parallel HIP/CUDA compilation in 
the past, but I can't find the details.

These days most of the builds are parallel already and it's very likely that 
the build system already launches as many jobs as there are CPUs available. 
Making each compilation launch multiple parallel subcompilations would likely 
result in way too many simultaneously running processes.
Granted, linking is done less often than compilation, so having parallel 
linking may be lucky to be the last remaining process in the parallel build, 
but it's not unusual to have multiple linker processes running simultaneously 
during the build either. Linking is often the most resource-heavy part of the 
build, so I would not be surprised if even a few linker instances would cause 
problems if they spawn parallel sub-linking jobs.

Having parallel subcompilations may be useful in some cases -- e.g. distributed 
compilation with one compilation per remote worker w/ multiple CPUs available 
on the worker, but that's unlikely to be a common scenario.

Having deterministic output is also very important, both for the build 
repeatability/provenance tracking and for the build system's cache hit rates. 
Reliably cached slow repeatable compilation will be a net win over fast, but 
unstable compilation that causes cache churn and triggers more things to be 
rebuilt.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D136701/new/

https://reviews.llvm.org/D136701

_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to