Skip to content

Commit

Permalink
downloads: upgrade LLVM 18.0.8 -> 19.1.6
Browse files Browse the repository at this point in the history
As part of this we also modernize the BOLT apply settings to follow
the recommendations at
https://llvm.org/devmtg/2024-03/slides/practical-use-of-bolt.pdf.

This includes enabling support for loading hot code from a huge page
at runtime. This should _just work_ and could result in perf wins via
improved iTLB hit rate, etc.
  • Loading branch information
indygreg committed Jan 1, 2025
1 parent c324093 commit 2c619a5
Show file tree
Hide file tree
Showing 5 changed files with 44 additions and 18 deletions.
5 changes: 4 additions & 1 deletion cpython-unix/build-cpython.sh
Original file line number Diff line number Diff line change
Expand Up @@ -259,9 +259,12 @@ if [ -n "${PYTHON_MEETS_MINIMUM_VERSION_3_11}" ]; then
patch -p1 -i ${ROOT}/patch-pwd-remove-conditional.patch
fi

# Adjust BOLT flags to yield better behavior. See inline details in patch.
if [ -n "${PYTHON_MEETS_MINIMUM_VERSION_3_12}" ]; then
# Adjust BOLT flags to yield better behavior. See inline details in patch.
patch -p1 -i ${ROOT}/patch-configure-bolt-flags.patch

# Adjust BOLT application flags to make use of modern LLVM features.
patch -p1 -i ${ROOT}/patch-configure-bolt-apply-flags.patch
fi

# The optimization make targets are both phony and non-phony. This leads
Expand Down
23 changes: 23 additions & 0 deletions cpython-unix/patch-configure-bolt-apply-flags.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
diff --git a/configure.ac b/configure.ac
index ee034e5a962..f1a69b7d4a7 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2183,8 +2183,9 @@ then
[m4_normalize("
-update-debug-sections
-reorder-blocks=ext-tsp
- -reorder-functions=hfsort+
+ -reorder-functions=cdsort
-split-functions
+ -split-strategy=cdsplit
-icf=1
-inline-all
-split-eh
@@ -2196,6 +2197,7 @@ then
-dyno-stats
-use-gnu-stack
-frame-opt=hot
+ -hugify
")]
)
fi
26 changes: 13 additions & 13 deletions pythonbuild/downloads.py
Original file line number Diff line number Diff line change
Expand Up @@ -185,25 +185,25 @@
"version": "14.0.3+20220508",
},
# Remember to update LLVM_URL in src/release.rs whenever upgrading.
"llvm-18-x86_64-linux": {
"url": "https://github.com/indygreg/toolchain-tools/releases/download/toolchain-bootstrap%2F20240713/llvm-18.0.8+20240713-gnu_only-x86_64-unknown-linux-gnu.tar.zst",
"size": 242840506,
"sha256": "080c233fc7d75031b187bbfef62a4f9abc01188effb0c68fbc7dc4bc7370ee5b",
"version": "18.0.8+20240713",
"llvm-19-x86_64-linux": {
"url": "https://github.com/indygreg/toolchain-tools/releases/download/toolchain-bootstrap%2F20241231/llvm-19.1.6+20241231-gnu_only-x86_64-unknown-linux-gnu.tar.zst",
"size": 251277644,
"sha256": "900bbb464d430e960ea97150e073395ae865332ce403e7c1e8f76640cab5e852",
"version": "19.1.6+20241231",
},
# Remember to update LLVM_URL in src/release.rs whenever upgrading.
"llvm-aarch64-macos": {
"url": "https://github.com/indygreg/toolchain-tools/releases/download/toolchain-bootstrap%2F20240713/llvm-18.0.8+20240713-aarch64-apple-darwin.tar.zst",
"size": 136598617,
"sha256": "320da8d639186e020e7d54cdc35b7a5473b36cef08fdf7b22c03b59a273ba593",
"version": "18.0.8+20240713",
"url": "https://github.com/indygreg/toolchain-tools/releases/download/toolchain-bootstrap%2F20241231/llvm-19.1.6+20241231-aarch64-apple-darwin.tar.zst",
"size": 143884729,
"sha256": "c0252c7ebe0b20125fe592a12d43a693fcab0bfa3bec9def6b96b97087e0f765",
"version": "19.1.6+20241231",
},
# Remember to update LLVM_URL in src/release.rs whenever upgrading.
"llvm-x86_64-macos": {
"url": "https://github.com/indygreg/toolchain-tools/releases/download/toolchain-bootstrap%2F20240713/llvm-18.0.8+20240713-x86_64-apple-darwin.tar.zst",
"size": 136599290,
"sha256": "3032161d1cadb8996b07fe5762444c956842b5a7d798b2fcfe5a04574fdf7549",
"version": "18.0.8+20240713",
"url": "https://github.com/indygreg/toolchain-tools/releases/download/toolchain-bootstrap%2F20241231/llvm-19.1.6+20241231-x86_64-apple-darwin.tar.zst",
"size": 143113277,
"sha256": "e990dea9ff89e4202d358b477a43f2bd128b244926534b7c8bb29feeaada994e",
"version": "19.1.6+20241231",
},
"m4": {
"url": "https://ftp.gnu.org/gnu/m4/m4-1.4.19.tar.xz",
Expand Down
2 changes: 1 addition & 1 deletion pythonbuild/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -426,7 +426,7 @@ def clang_toolchain(host_platform: str, target_triple: str) -> str:
if "musl" in target_triple:
return "llvm-14-x86_64-linux"
else:
return "llvm-18-x86_64-linux"
return "llvm-19-x86_64-linux"
elif host_platform == "macos":
if platform.mac_ver()[2] == "arm64":
return "llvm-aarch64-macos"
Expand Down
6 changes: 3 additions & 3 deletions src/release.rs
Original file line number Diff line number Diff line change
Expand Up @@ -575,14 +575,14 @@ pub fn produce_install_only_stripped(tar_gz_path: &Path, llvm_dir: &Path) -> Res
static LLVM_URL: Lazy<Url> = Lazy::new(|| {
if cfg!(target_os = "macos") {
if std::env::consts::ARCH == "aarch64" {
Url::parse("https://github.com/indygreg/toolchain-tools/releases/download/toolchain-bootstrap%2F20240713/llvm-18.0.8+20240713-aarch64-apple-darwin.tar.zst").unwrap()
Url::parse("https://github.com/indygreg/toolchain-tools/releases/download/toolchain-bootstrap%2F20241231/llvm-19.1.6+20241231-aarch64-apple-darwin.tar.zst").unwrap()
} else if std::env::consts::ARCH == "x86_64" {
Url::parse("https://github.com/indygreg/toolchain-tools/releases/download/toolchain-bootstrap%2F20240713/llvm-18.0.8+20240713-x86_64-apple-darwin.tar.zst").unwrap()
Url::parse("https://github.com/indygreg/toolchain-tools/releases/download/toolchain-bootstrap%2F20241231/llvm-19.1.6+20241231-x86_64-apple-darwin.tar.zst").unwrap()
} else {
panic!("unsupported macOS architecture");
}
} else if cfg!(target_os = "linux") {
Url::parse("https://github.com/indygreg/toolchain-tools/releases/download/toolchain-bootstrap%2F20240713/llvm-18.0.8+20240713-gnu_only-x86_64-unknown-linux-gnu.tar.zst").unwrap()
Url::parse("https://github.com/indygreg/toolchain-tools/releases/download/toolchain-bootstrap%2F20241231/llvm-19.1.6+20241231-gnu_only-x86_64-unknown-linux-gnu.tar.zst").unwrap()
} else {
panic!("unsupported platform");
}
Expand Down

0 comments on commit 2c619a5

Please sign in to comment.