Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
12 changes: 12 additions & 0 deletions flang/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -473,6 +473,18 @@ if (APPLE)
endif()
endif()

# Set up job pools for flang. Some of the flang sources take a lot of memory to
# compile, so allow users to limit the number of parallel flang jobs. This is
# useful for building flang alongside several other projects since you can use
# the maximum number of build jobs for the other projects while limiting the
# number of flang compile jobs.
#
# We want this set to infinity by default
set(FLANG_PARALLEL_COMPILE_JOBS 0 CACHE STRING
"The maximum number of concurrent compilation jobs (Ninja only)")
Copy link
Contributor

Choose a reason for hiding this comment

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

There was a comment by @Meinersbur that this default is not a good setting.

#112789 (comment)

Separately, why doesn't this apply to Make?

Copy link
Member

Choose a reason for hiding this comment

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

Documented here:

Ninja only: List of available pools.

Ninja has job pools, GNU Make does not.


set_property(GLOBAL APPEND PROPERTY JOB_POOLS flang_compile_job_pool=${FLANG_PARALLEL_COMPILE_JOBS})

include(AddFlang)

if (FLANG_INCLUDE_TESTS)
Expand Down
1 change: 1 addition & 0 deletions flang/cmake/modules/AddFlang.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ function(add_flang_library name)
set_property(GLOBAL APPEND PROPERTY FLANG_LIBS ${name})
endif()
set_property(GLOBAL APPEND PROPERTY FLANG_EXPORTS ${name})
set_property(TARGET ${name} PROPERTY JOB_POOL_COMPILE flang_compile_job_pool)
else()
# Add empty "phony" target
add_custom_target(${name})
Expand Down
5 changes: 5 additions & 0 deletions flang/runtime/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,11 @@ if (CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR)
REAL(16) is mapped to __float128, or libm for targets where REAL(16) \
is mapped to long double, etc."
)

# For the stand alone runtime builds, we need to define this job pool,
# because add_flang_library will use it. If we don't define it here, the
# build will fail.
set_property(GLOBAL APPEND PROPERTY JOB_POOLS flang_compile_job_pool=0)
endif()

set(linked_libraries "")
Expand Down
Loading