[LinkerWrapper] Perform device linking steps in parallel
authorJoseph Huber <jhuber6@vols.utk.edu>
Tue, 25 Oct 2022 17:28:28 +0000 (12:28 -0500)
committerJoseph Huber <jhuber6@vols.utk.edu>
Fri, 11 Nov 2022 19:46:33 +0000 (13:46 -0600)
commit0f7e8631547ad2cbbe5bcf1933e1353e58f58406
tree181969a3fef0af1f1115a25b04a27834c5ab27bd
parent8f121a3f18f7cc9dac08b7fb43ed7deec6adf583
[LinkerWrapper] Perform device linking steps in parallel

This patch changes the device linking steps to be performed in parallel
when multiple offloading architectures are being used. We use the LLVM
parallelism support to accomplish this by simply doing each inidividual
device linking job in a single thread. This change required re-parsing
the input arguments as these arguments have internal state that would
not be properly shared between the threads otherwise.

By default, the parallelism uses all threads availible. But this can be
controlled with the `--wrapper-jobs=` option. This was required in a few
tests to ensure the ordering was still deterministic.

Reviewed By: tra

Differential Revision: https://reviews.llvm.org/D136701
clang/test/Driver/linker-wrapper.c
clang/tools/clang-linker-wrapper/ClangLinkerWrapper.cpp
clang/tools/clang-linker-wrapper/LinkerWrapperOpts.td