-
Notifications
You must be signed in to change notification settings - Fork 12.2k
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][PGO] Add option for using an external project to generate profile data #78879
Merged
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
0719f49
[CMake][PGO] Add libunwind to list of stage1 runtimes
tstellar 5c60223
[CMake][PGO] Add option for using an external project to generate pro…
tstellar 4f9fa29
Update clang/utils/perf-training/perf-helper.py
tstellar 552d251
Rename CLANG_PERF_TRAINING_DEPS to CLANG_PGO_TRAINING_DEPS
tstellar 80d98a7
Merge remote-tracking branch 'origin/main' into clang-pgo-external
tstellar File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,10 @@ | ||
include(LLVMExternalProjectUtils) | ||
|
||
set(CLANG_PGO_TRAINING_DATA "${CMAKE_CURRENT_SOURCE_DIR}" CACHE PATH | ||
"The path to a lit testsuite containing samples for PGO and order file generation" | ||
) | ||
set(CLANG_PGO_TRAINING_DATA_SOURCE_DIR OFF CACHE STRING "Path to source directory containing cmake project with source files to use for generating pgo data") | ||
set(CLANG_PGO_TRAINING_DEPS "" CACHE STRING "Extra dependencies needed to build the PGO training data.") | ||
|
||
if(LLVM_BUILD_INSTRUMENTED) | ||
configure_lit_site_cfg( | ||
|
@@ -11,11 +15,11 @@ if(LLVM_BUILD_INSTRUMENTED) | |
add_lit_testsuite(generate-profraw "Generating clang PGO data" | ||
${CMAKE_CURRENT_BINARY_DIR}/pgo-data/ | ||
EXCLUDE_FROM_CHECK_ALL | ||
DEPENDS clang clear-profraw ${CLANG_PERF_TRAINING_DEPS} | ||
DEPENDS clang clear-profraw ${CLANG_PGO_TRAINING_DEPS} | ||
) | ||
|
||
add_custom_target(clear-profraw | ||
COMMAND "${Python3_EXECUTABLE}" ${CMAKE_CURRENT_SOURCE_DIR}/perf-helper.py clean ${CMAKE_CURRENT_BINARY_DIR} profraw | ||
COMMAND "${Python3_EXECUTABLE}" ${CMAKE_CURRENT_SOURCE_DIR}/perf-helper.py clean ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_BINARY_DIR}/profiles/ profraw | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Where does this new path ( There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @aaupov That's the directory where clang will write it's profiles to by default. |
||
COMMENT "Clearing old profraw data") | ||
|
||
if(NOT LLVM_PROFDATA) | ||
|
@@ -26,9 +30,14 @@ if(LLVM_BUILD_INSTRUMENTED) | |
message(STATUS "To enable merging PGO data LLVM_PROFDATA has to point to llvm-profdata") | ||
else() | ||
add_custom_target(generate-profdata | ||
COMMAND "${Python3_EXECUTABLE}" ${CMAKE_CURRENT_SOURCE_DIR}/perf-helper.py merge ${LLVM_PROFDATA} ${CMAKE_CURRENT_BINARY_DIR}/clang.profdata ${CMAKE_CURRENT_BINARY_DIR} | ||
COMMAND "${Python3_EXECUTABLE}" ${CMAKE_CURRENT_SOURCE_DIR}/perf-helper.py merge ${LLVM_PROFDATA} ${CMAKE_CURRENT_BINARY_DIR}/clang.profdata ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_BINARY_DIR}/profiles/ | ||
COMMENT "Merging profdata" | ||
DEPENDS generate-profraw) | ||
if (CLANG_PGO_TRAINING_DATA_SOURCE_DIR) | ||
llvm_ExternalProject_Add(generate-profraw-external ${CLANG_PGO_TRAINING_DATA_SOURCE_DIR} | ||
USE_TOOLCHAIN EXLUDE_FROM_ALL NO_INSTALL DEPENDS generate-profraw) | ||
add_dependencies(generate-profdata generate-profraw-external) | ||
endif() | ||
endif() | ||
endif() | ||
|
||
|
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
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
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@petrhosek CLANG_PERF_TRAINING_DEPS was an existing variable that's used here. I think it was meant to be added to cache files, but I added it to CMakeLists.txt file here so that it could be passed on the command line without modifying the cache files.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like I added that in https://reviews.llvm.org/D138974 but I'm not aware of it being used anywhere at the moment. I'd still prefer renaming it to
CLANG_PGO_TRAINING_DEPS
for consistency, especially that we're now adding it to cache.