summaryrefslogtreecommitdiffstats
path: root/Doc/using
diff options
context:
space:
mode:
authorGregory Szorc <gregory.szorc@gmail.com>2023-05-22 11:45:20 (GMT)
committerGitHub <noreply@github.com>2023-05-22 11:45:20 (GMT)
commit5360cb3d5608ab375de6cd8c0b408459f3fa953a (patch)
treed6256db9d1a0db997b881d26a2ed774f43bd5ff9 /Doc/using
parent729b252241966f464cc46e176fb854dbcc5296cb (diff)
downloadcpython-5360cb3d5608ab375de6cd8c0b408459f3fa953a.zip
cpython-5360cb3d5608ab375de6cd8c0b408459f3fa953a.tar.gz
cpython-5360cb3d5608ab375de6cd8c0b408459f3fa953a.tar.bz2
gh-101282: Apply BOLT optimizations to libpython for shared builds (#104709)
Apply BOLT optimizations to libpython for shared builds. Most of the C code is in libpython so it is critical to apply BOLT there fully realize BOLT benefits. This change also reworks how BOLT instrumentation is applied. It effectively removes the readelf based logic added in gh-101525 and replaces it with a mechanism that saves a copy of the pre-bolt binary and restores that copy when necessary. This allows us to perform BOLT optimizations without having to manually delete the output binary to force a new bolt run. Also: - add a clean-bolt target for purging BOLT files and hook that up to the clean target - .gitignore BOLT related files Before and after this refactor, `make` will no-op after a previous run. Both versions should also share common make DAG deficiencies where targets fail to trigger as often as they need to or can trigger prematurely in certain scenarios. e.g. after this change you may need to `rm profile-bolt-stamp` to force a BOLT run because there aren't appropriate non-phony targets for BOLT's make target to depend on. To make it easier to iterate on custom BOLT settings, the flags to pass to instrumentation and application are now defined in configure and can be overridden by passing BOLT_INSTRUMENT_FLAGS and BOLT_APPLY_FLAGS.
Diffstat (limited to 'Doc/using')
-rw-r--r--Doc/using/configure.rst7
1 files changed, 7 insertions, 0 deletions
diff --git a/Doc/using/configure.rst b/Doc/using/configure.rst
index ce858ab..fbe280d 100644
--- a/Doc/using/configure.rst
+++ b/Doc/using/configure.rst
@@ -314,6 +314,13 @@ also be used to improve performance.
is dependent on a combination of the build environment + the other
optimization configure args + the CPU architecture, and not all combinations
are supported.
+ BOLT versions before LLVM 16 are known to crash BOLT under some scenarios.
+ Use of LLVM 16 or newer for BOLT optimization is strongly encouraged.
+
+ The :envvar:`!BOLT_INSTRUMENT_FLAGS` and :envvar:`!BOLT_APPLY_FLAGS`
+ :program:`configure` variables can be defined to override the default set of
+ arguments for :program:`llvm-bolt` to instrument and apply BOLT data to
+ binaries, respectively.
.. versionadded:: 3.12