Skip to content

Set enable-experimental-jit=yes-off on Python 3.13 / Linux #538

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Feb 27, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions cpython-unix/build-cpython.sh
Original file line number Diff line number Diff line change
Expand Up @@ -424,6 +424,22 @@ 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

# 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
# version.
patch -p1 -i "${ROOT}/patch-jit-llvm-19.patch"
fi
fi
fi

if [ -n "${CPYTHON_LTO}" ]; then
Expand Down
12 changes: 12 additions & 0 deletions cpython-unix/patch-jit-llvm-19.patch
Original file line number Diff line number Diff line change
@@ -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")