Skip to content

Commit d7759a1

Browse files
authored
Set enable-experimental-jit=yes-off on Python 3.13 / Linux (#538)
See #535 This builds the JIT, but disables it by default. Users can opt-in to enable it at runtime. 3.14 and macOS support will follow, there are some hiccups there.
1 parent aa430e2 commit d7759a1

File tree

2 files changed

+28
-0
lines changed

2 files changed

+28
-0
lines changed

cpython-unix/build-cpython.sh

+16
Original file line numberDiff line numberDiff line change
@@ -424,6 +424,22 @@ if [ -n "${CPYTHON_OPTIMIZED}" ]; then
424424
if [[ -n "${PYTHON_MEETS_MINIMUM_VERSION_3_12}" && -n "${BOLT_CAPABLE}" ]]; then
425425
CONFIGURE_FLAGS="${CONFIGURE_FLAGS} --enable-bolt"
426426
fi
427+
428+
# Allow users to enable the experimental JIT on 3.13+
429+
if [[ -n "${PYTHON_MEETS_MINIMUM_VERSION_3_13}" ]]; then
430+
431+
# The JIT build is failing on macOS and 3.14+ due to compiler errors
432+
# Only enable on Linux / 3.13 until that's fixed upstream
433+
if [[ -n "${PYTHON_MEETS_MAXIMUM_VERSION_3_13}" && "${PYBUILD_PLATFORM}" != "macos" ]]; then
434+
CONFIGURE_FLAGS="${CONFIGURE_FLAGS} --enable-experimental-jit=yes-off"
435+
fi
436+
437+
if [[ -n "${PYTHON_MEETS_MAXIMUM_VERSION_3_13}" ]]; then
438+
# On 3.13, LLVM 18 is hard-coded into the configure script. Override it to our toolchain
439+
# version.
440+
patch -p1 -i "${ROOT}/patch-jit-llvm-19.patch"
441+
fi
442+
fi
427443
fi
428444

429445
if [ -n "${CPYTHON_LTO}" ]; then

cpython-unix/patch-jit-llvm-19.patch

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
diff --git a/Tools/jit/_llvm.py b/Tools/jit/_llvm.py
2+
--- a/Tools/jit/_llvm.py
3+
+++ b/Tools/jit/_llvm.py
4+
@@ -8,7 +8,7 @@
5+
import subprocess
6+
import typing
7+
8+
-_LLVM_VERSION = 18
9+
+_LLVM_VERSION = 19
10+
_LLVM_VERSION_PATTERN = re.compile(rf"version\s+{_LLVM_VERSION}\.\d+\.\d+\S*\s+")
11+
12+
_P = typing.ParamSpec("_P")

0 commit comments

Comments
 (0)