From 85af95adce28e29ecc9c1bc9d90874f60a899167 Mon Sep 17 00:00:00 2001 From: Zanie Blue Date: Mon, 24 Feb 2025 20:15:33 -0600 Subject: [PATCH 1/3] Set `enable-experimental-jit=yes-off` on Python 3.13+ --- cpython-unix/build-cpython.sh | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/cpython-unix/build-cpython.sh b/cpython-unix/build-cpython.sh index 566700e0..64d5a847 100755 --- a/cpython-unix/build-cpython.sh +++ b/cpython-unix/build-cpython.sh @@ -424,6 +424,11 @@ if [ -n "${CPYTHON_OPTIMIZED}" ]; then if [[ -n "${PYTHON_MEETS_MINIMUM_VERSION_3_12}" && -n "${BOLT_CAPABLE}" ]]; then CONFIGURE_FLAGS="${CONFIGURE_FLAGS} --enable-bolt" fi + + # Allow users to enable the experimental JIT on 3.13+ + if [[ -n "${PYTHON_MEETS_MINIMUM_VERSION_3_13}" ]]; then + CONFIGURE_FLAGS="${CONFIGURE_FLAGS} --enable-experimental-jit=yes-off" + fi fi if [ -n "${CPYTHON_LTO}" ]; then From 5664603c82b96c57417a6bfc8543710a848b2458 Mon Sep 17 00:00:00 2001 From: Zanie Blue Date: Wed, 26 Feb 2025 13:04:55 -0600 Subject: [PATCH 2/3] Bump to LLVM 19 on 3.13 --- cpython-unix/build-cpython.sh | 6 ++++++ cpython-unix/patch-jit-llvm-19.patch | 12 ++++++++++++ 2 files changed, 18 insertions(+) create mode 100644 cpython-unix/patch-jit-llvm-19.patch diff --git a/cpython-unix/build-cpython.sh b/cpython-unix/build-cpython.sh index 64d5a847..9fae23e9 100755 --- a/cpython-unix/build-cpython.sh +++ b/cpython-unix/build-cpython.sh @@ -428,6 +428,12 @@ if [ -n "${CPYTHON_OPTIMIZED}" ]; then # Allow users to enable the experimental JIT on 3.13+ if [[ -n "${PYTHON_MEETS_MINIMUM_VERSION_3_13}" ]]; then CONFIGURE_FLAGS="${CONFIGURE_FLAGS} --enable-experimental-jit=yes-off" + + if [[ -n "${PYTHON_MEETS_MAXIMUM_VERSION_3_13}" ]]; then + # On 3.13, LLVM 18 is hard-coded into the configure script. Override it to our toolchain + # version. + patch -p1 -i "${ROOT}/patch-jit-llvm-19.patch" + fi fi fi diff --git a/cpython-unix/patch-jit-llvm-19.patch b/cpython-unix/patch-jit-llvm-19.patch new file mode 100644 index 00000000..1b66f119 --- /dev/null +++ b/cpython-unix/patch-jit-llvm-19.patch @@ -0,0 +1,12 @@ +diff --git a/Tools/jit/_llvm.py b/Tools/jit/_llvm.py +--- a/Tools/jit/_llvm.py ++++ b/Tools/jit/_llvm.py +@@ -8,7 +8,7 @@ + import subprocess + import typing + +-_LLVM_VERSION = 18 ++_LLVM_VERSION = 19 + _LLVM_VERSION_PATTERN = re.compile(rf"version\s+{_LLVM_VERSION}\.\d+\.\d+\S*\s+") + + _P = typing.ParamSpec("_P") From 28c8fd9afe7819f67f59fe599fa7196db881631b Mon Sep 17 00:00:00 2001 From: Zanie Blue Date: Wed, 26 Feb 2025 16:31:19 -0600 Subject: [PATCH 3/3] Limit to 3.13 / Linux --- cpython-unix/build-cpython.sh | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/cpython-unix/build-cpython.sh b/cpython-unix/build-cpython.sh index 9fae23e9..0bba0168 100755 --- a/cpython-unix/build-cpython.sh +++ b/cpython-unix/build-cpython.sh @@ -427,7 +427,12 @@ if [ -n "${CPYTHON_OPTIMIZED}" ]; then # Allow users to enable the experimental JIT on 3.13+ if [[ -n "${PYTHON_MEETS_MINIMUM_VERSION_3_13}" ]]; then - CONFIGURE_FLAGS="${CONFIGURE_FLAGS} --enable-experimental-jit=yes-off" + + # The JIT build is failing on macOS and 3.14+ due to compiler errors + # Only enable on Linux / 3.13 until that's fixed upstream + if [[ -n "${PYTHON_MEETS_MAXIMUM_VERSION_3_13}" && "${PYBUILD_PLATFORM}" != "macos" ]]; then + CONFIGURE_FLAGS="${CONFIGURE_FLAGS} --enable-experimental-jit=yes-off" + fi if [[ -n "${PYTHON_MEETS_MAXIMUM_VERSION_3_13}" ]]; then # On 3.13, LLVM 18 is hard-coded into the configure script. Override it to our toolchain