-
Notifications
You must be signed in to change notification settings - Fork 10.8k
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
[CMake][Release] Add option for enabling PGO to release cache file. #78823
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
The option is LLVM_RELEASE_ENABLE_PGO and it's turned on by default.
@llvm/pr-subscribers-clang Author: Tom Stellard (tstellar) ChangesThe option is LLVM_RELEASE_ENABLE_PGO and it's turned on by default. Full diff: https://github.com/llvm/llvm-project/pull/78823.diff 2 Files Affected:
diff --git a/clang/cmake/caches/Release.cmake b/clang/cmake/caches/Release.cmake
index a7b9a8d0e29f88f..0d114c3734a82d3 100644
--- a/clang/cmake/caches/Release.cmake
+++ b/clang/cmake/caches/Release.cmake
@@ -4,27 +4,53 @@
# General Options
set(LLVM_RELEASE_ENABLE_LTO THIN CACHE STRING "")
+set(LLVM_RELEASE_ENABLE_PGO ON CACHE BOOL "")
set(CMAKE_BUILD_TYPE RELEASE CACHE STRING "")
# Stage 1 Bootstrap Setup
set(CLANG_ENABLE_BOOTSTRAP ON CACHE BOOL "")
-set(CLANG_BOOTSTRAP_TARGETS
- clang
- check-all
- check-llvm
- check-clang
- test-suite
- stage3
- stage3-clang
- stage3-check-all
- stage3-check-llvm
- stage3-check-clang
- stage3-install
- stage3-test-suite CACHE STRING "")
+if (LLVM_RELEASE_ENABLE_PGO)
+ set(CLANG_BOOTSTRAP_TARGETS
+ generate-profdata
+ stage2
+ stage2-clang
+ stage2-distribution
+ stage2-install
+ stage2-install-distribution
+ stage2-install-distribution-toolchain
+ stage2-check-all
+ stage2-check-llvm
+ stage2-check-clang
+ stage2-test-suite CACHE STRING "")
+else()
+ set(CLANG_BOOTSTRAP_TARGETS
+ clang
+ check-all
+ check-llvm
+ check-clang
+ test-suite
+ stage3
+ stage3-clang
+ stage3-check-all
+ stage3-check-llvm
+ stage3-check-clang
+ stage3-install
+ stage3-test-suite CACHE STRING "")
+endif()
# Stage 1 Options
-set(LLVM_ENABLE_PROJECTS "clang" CACHE STRING "")
+set(STAGE1_PROJECTS "clang")
+set(STAGE1_RUNTIMES "")
+
+if (LLVM_RELEASE_ENABLE_PGO)
+ list(APPEND STAGE1_PROJECTS "lld")
+ list(APPEND STAGE1_RUNTIMES "compiler-rt")
+endif()
+
+set(LLVM_ENABLE_RUNTIMES ${STAGE1_RUNTIMES} CACHE STRING "")
+set(LLVM_ENABLE_PROJECTS ${STAGE1_PROJECTS} CACHE STRING "")
+
set(LLVM_TARGETS_TO_BUILD Native CACHE STRING "")
# Stage 2 Bootstrap Setup
@@ -37,11 +63,26 @@ set(BOOTSTRAP_CLANG_BOOTSTRAP_TARGETS
# Stage 2 Options
set(STAGE2_PROJECTS "clang")
-if (LLVM_RELEASE_ENABLE_LTO)
+set(STAGE2_RUNTIMES "")
+
+if (LLVM_RELEASE_ENABLE_LTO OR LLVM_RELEASE_ENABLE_PGO)
list(APPEND STAGE2_PROJECTS "lld")
endif()
+
+if (LLVM_RELEASE_ENABLE_PGO)
+ set(BOOTSTRAP_LLVM_BUILD_INSTRUMENTED ON CACHE BOOL "")
+ list(APPEND STAGE2_RUNTIMES "compiler-rt")
+ set(BOOTSTRAP_LLVM_ENABLE_LTO ${LLVM_RELEASE_ENABLE_LTO})
+ if (LLVM_RELEASE_ENABLE_LTO)
+ set(BOOTSTRAP_LLVM_ENABLE_LLD ON CACHE BOOL "")
+ endif()
+endif()
+
set(BOOTSTRAP_LLVM_ENABLE_PROJECTS ${STAGE2_PROJECTS} CACHE STRING "")
-set(BOOTSTRAP_LLVM_TARGETS_TO_BUILD Native CACHE STRING "")
+set(BOOTSTRAP_LLVM_ENABLE_RUNTIMES ${STAGE2_RUNTIMES} CACHE STRING "")
+if (NOT LLVM_RELEASE_ENABLE_PGO)
+ set(BOOTSTRAP_LLVM_TARGETS_TO_BUILD Native CACHE STRING "")
+endif()
# Stage 3 Options
set(BOOTSTRAP_BOOTSTRAP_LLVM_ENABLE_RUNTIMES "compiler-rt;libcxx;libcxxabi;libunwind" CACHE STRING "")
diff --git a/llvm/utils/release/test-release.sh b/llvm/utils/release/test-release.sh
index 544d4bfdd799ce8..5b1945df47d24a7 100755
--- a/llvm/utils/release/test-release.sh
+++ b/llvm/utils/release/test-release.sh
@@ -359,11 +359,11 @@ function build_with_cmake_cache() {
$ExtraConfigureFlags
2>&1 | tee $LogDir/llvm.configure-$Flavor.log
- ${MAKE} $J_ARG $Verbose -C $CMakeBuildDir stage3-check-all \
+ ${MAKE} $J_ARG $Verbose -C $CMakeBuildDir stage2-check-all \
2>&1 | tee $LogDir/llvm.make-$Flavor.log > $redir
DESTDIR="${InstallDir}" \
- ${MAKE} -C $CMakeBuildDir stage3-install \
+ ${MAKE} -C $CMakeBuildDir stage2-install \
2>&1 | tee $LogDir/llvm.install-$Flavor.log > $redir
mkdir -p $BuildDir/Release
|
tru
approved these changes
Jan 20, 2024
petrhosek
reviewed
Jan 21, 2024
Co-authored-by: Petr Hosek <phosek@google.com>
petrhosek
approved these changes
Jan 21, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The option is LLVM_RELEASE_ENABLE_PGO and it's turned on by default.