This is an attempt to replicate similar fearture already available to clang. The changes in this patch were made with an intent to reuse as much of existing infrastructure as possible. Namely, two-stage build arrangement, perf-helper.py script and the means for building of the instrumented binaries have all been incorporated into this approach. It was deliberately chosen to optimize clang along with flang as they are mostly working together in the final toolchain. See the `llvm/docs/AdvancedBuilds.rst` documentation for more details. Note that the attempt to optimize flang has exceeded one of the BOLT limitations. The size of one of the statically allocated buffers needed to be extended in this patch.
31 lines
790 B
Python
31 lines
790 B
Python
# -*- Python -*-
|
|
|
|
# Configuration used for performance training when optimizing flang with BOLT
|
|
|
|
import os
|
|
|
|
import lit.util
|
|
|
|
flang_bolt_mode = config.flang_bolt_mode.lower()
|
|
flang_binary = "flang"
|
|
perf_wrapper = f"{sys.executable} {config.perf_helper_dir}/perf-helper.py perf "
|
|
|
|
if flang_bolt_mode == "instrument":
|
|
perf_wrapper = ""
|
|
flang_binary = config.flang_bolt_name
|
|
elif flang_bolt_mode == "lbr":
|
|
perf_wrapper += " --lbr -- "
|
|
elif flang_bolt_mode == "perf":
|
|
perf_wrapper += " -- "
|
|
else:
|
|
assert 0, "Unsupported flang bolt mode"
|
|
|
|
flang_nowrapper = os.path.realpath(
|
|
lit.util.which(flang_binary, config.flang_opt_tools_dir)
|
|
).replace("\\", "/")
|
|
|
|
config.name = "Flang BOLT Training"
|
|
|
|
config.flang_exe = perf_wrapper + flang_nowrapper
|
|
|
|
config.llvm_profile_file = ''
|