Skip to content

[build] Add option to limit number of link jobs #29361

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

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 16 additions & 2 deletions utils/build-script-impl
Original file line number Diff line number Diff line change
Expand Up @@ -64,10 +64,12 @@ KNOWN_SETTINGS=(
build-stdlib-deployment-targets "all" "space-separated list that filters which of the configured targets to build the Swift standard library for, or 'all'"
build-toolchain-only "" "If set, only build the necessary tools to build an external toolchain"
cmake-generator "Unix Makefiles" "kind of build system to generate; see output of 'cmake --help' for choices"
llvm-num-parallel-lto-link-jobs "" "The number of parallel link jobs to use when compiling llvm"
llvm-num-parallel-link-jobs "" "The number of parallel link jobs to use when compiling llvm"
llvm-num-parallel-lto-link-jobs "" "The number of parallel link jobs to use when compiling llvm with LTO enabled"
reconfigure "" "force a CMake configuration run even if CMakeCache.txt already exists"
skip-reconfigure "" "set to skip reconfigure"
swift-tools-num-parallel-lto-link-jobs "" "The number of parallel link jobs to use when compiling swift tools"
swift-tools-num-parallel-link-jobs "" "The number of parallel link jobs to use when compiling swift tools"
swift-tools-num-parallel-lto-link-jobs "" "The number of parallel link jobs to use when compiling swift tools with LTO enabled"
use-gold-linker "" "Enable using the gold linker"
workspace "${HOME}/src" "source directory containing llvm, clang, swift"

Expand Down Expand Up @@ -640,6 +642,18 @@ function set_build_options_for_host() {
-DLLVM_BUILD_EXTERNAL_COMPILER_RT:BOOL="$(false_true ${SKIP_BUILD_COMPILER_RT})"
)

if [[ "${SWIFT_TOOLS_NUM_PARALLEL_LINK_JOBS}" != "" ]] && [[ $(is_swift_lto_enabled) == "FALSE" ]]; then
swift_cmake_options+=(
"-DSWIFT_PARALLEL_LINK_JOBS=${SWIFT_TOOLS_NUM_PARALLEL_LINK_JOBS}"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I haven't looked at this, but I wonder if it would make sense to just have one option for this rather than have two options. Is that possible? How do we do it in the lldb case?

)
fi

if [[ "${LLVM_NUM_PARALLEL_LINK_JOBS}" != "" ]] && [[ $(is_llvm_lto_enabled) == "FALSE" ]]; then
llvm_cmake_options+=(
"-DLLVM_PARALLEL_LINK_JOBS=${LLVM_NUM_PARALLEL_LINK_JOBS}"
)
fi

# If we are asked to not generate test targets for LLVM and or Swift,
# disable as many LLVM tools as we can. This improves compile time when
# compiling with LTO.
Expand Down
4 changes: 2 additions & 2 deletions utils/build_swift/build_swift/driver_arguments.py
Original file line number Diff line number Diff line change
Expand Up @@ -490,13 +490,13 @@ def create_argument_parser():
default=default_max_lto_link_job_counts['llvm'],
metavar='COUNT',
help='the maximum number of parallel link jobs to use when '
'compiling llvm')
'compiling llvm with LTO')

option('--swift-tools-max-parallel-lto-link-jobs', store_int,
default=default_max_lto_link_job_counts['swift'],
metavar='COUNT',
help='the maximum number of parallel link jobs to use when '
'compiling swift tools.')
'compiling swift tools with LTO')

option('--disable-guaranteed-normal-arguments', store_true,
help='Disable guaranteed normal arguments')
Expand Down