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
22 changes: 18 additions & 4 deletions clang/utils/perf-training/bolt.lit.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -8,21 +8,32 @@ import subprocess

clang_bolt_mode = config.clang_bolt_mode.lower()
clang_binary = "clang"
perf_wrapper = f"{config.python_exe} {config.perf_helper_dir}/perf-helper.py perf "
perf_wrapper = f"{config.python_exe} {config.perf_helper_dir}/perf-helper.py perf"

if clang_bolt_mode == "instrument":
perf_wrapper = ""
clang_binary = config.clang_bolt_name
elif clang_bolt_mode == "lbr":
perf_wrapper += " --lbr -- "
perf_wrapper += " --lbr --"
elif clang_bolt_mode == "perf":
perf_wrapper += " -- "
perf_wrapper += " --"
else:
assert 0, "Unsupported CLANG_BOLT_MODE variable"

config.clang = perf_wrapper + os.path.realpath(
clang_nowrapper = os.path.realpath(
lit.util.which(clang_binary, config.clang_tools_dir)
).replace("\\", "/")
config.clang = f'{perf_wrapper} {clang_nowrapper}'

# We need to limit the number of build jobs with perf in order to avoid this
# error:
#
# | Permission error mapping pages.
# | Consider increasing /proc/sys/kernel/perf_event_mlock_kb,
# | or try again with a smaller value of -m/--mmap_pages.
ninja_args = ""
if clang_bolt_mode != "instrument":
ninja_args = "-j1"

config.name = "Clang Perf Training"
config.suffixes = [
Expand Down Expand Up @@ -52,3 +63,6 @@ config.substitutions.append(("%test_root", config.test_exec_root))
config.substitutions.append(('%cmake_generator', config.cmake_generator))
config.substitutions.append(('%cmake', config.cmake_exe))
config.substitutions.append(('%llvm_src_dir', config.llvm_src_dir))
config.substitutions.append(('%perf_cmake_compiler_launcher', perf_wrapper.replace(' ', ';')))
config.substitutions.append(('%nowrapper_clang', clang_nowrapper))
config.substitutions.append(('%ninja_args', ninja_args))
4 changes: 2 additions & 2 deletions clang/utils/perf-training/llvm-support/build.test
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
RUN: %cmake -G %cmake_generator -B %t -S %llvm_src_dir -DCMAKE_C_COMPILER=%clang -DCMAKE_CXX_COMPILER=%clang -DCMAKE_CXX_FLAGS="--driver-mode=g++" -DCMAKE_BUILD_TYPE=Release
RUN: %cmake --build %t -v --target LLVMSupport
RUN: %cmake -G %cmake_generator -B %t -S %llvm_src_dir -DCMAKE_CXX_COMPILER_LAUNCHER="%perf_cmake_compiler_launcher" -DCMAKE_C_COMPILER="%nowrapper_clang" -DCMAKE_CXX_COMPILER="%nowrapper_clang" -DCMAKE_CXX_FLAGS="--driver-mode=g++" -DCMAKE_BUILD_TYPE=Release
RUN: %cmake --build %t %ninja_args -v --target LLVMSupport
Loading