Skip to content

Commit d162c42

Browse files
GH-140479: Update JIT builds to use LLVM 21 (#140973)
1 parent 9cd5427 commit d162c42

File tree

5 files changed

+19
-18
lines changed

5 files changed

+19
-18
lines changed

.github/workflows/jit.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ jobs:
6868
- true
6969
- false
7070
llvm:
71-
- 20
71+
- 21
7272
include:
7373
- target: i686-pc-windows-msvc/msvc
7474
architecture: Win32
@@ -138,7 +138,7 @@ jobs:
138138
fail-fast: false
139139
matrix:
140140
llvm:
141-
- 20
141+
- 21
142142
steps:
143143
- uses: actions/checkout@v4
144144
with:
@@ -166,7 +166,7 @@ jobs:
166166
fail-fast: false
167167
matrix:
168168
llvm:
169-
- 20
169+
- 21
170170
steps:
171171
- uses: actions/checkout@v4
172172
with:
@@ -193,7 +193,7 @@ jobs:
193193
fail-fast: false
194194
matrix:
195195
llvm:
196-
- 20
196+
- 21
197197
steps:
198198
- uses: actions/checkout@v4
199199
with:
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Update JIT compilation to use LLVM 21 at build time.

PCbuild/get_externals.bat

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ if NOT "%IncludeLibffi%"=="false" set binaries=%binaries% libffi-3.4.4
8282
if NOT "%IncludeSSL%"=="false" set binaries=%binaries% openssl-bin-3.0.18
8383
if NOT "%IncludeTkinter%"=="false" set binaries=%binaries% tcltk-8.6.15.0
8484
if NOT "%IncludeSSLSrc%"=="false" set binaries=%binaries% nasm-2.11.06
85-
if NOT "%IncludeLLVM%"=="false" set binaries=%binaries% llvm-20.1.8.0
85+
if NOT "%IncludeLLVM%"=="false" set binaries=%binaries% llvm-21.1.4.0
8686

8787
for %%b in (%binaries%) do (
8888
if exist "%EXTERNALS_DIR%\%%b" (
@@ -92,7 +92,7 @@ for %%b in (%binaries%) do (
9292
git clone --depth 1 https://github.com/%ORG%/cpython-bin-deps --branch %%b "%EXTERNALS_DIR%\%%b"
9393
) else (
9494
echo.Fetching %%b...
95-
if "%%b"=="llvm-20.1.8.0" (
95+
if "%%b"=="llvm-21.1.4.0" (
9696
%PYTHON% -E "%PCBUILD%\get_external.py" --release --organization %ORG% --externals-dir "%EXTERNALS_DIR%" %%b
9797
) else (
9898
%PYTHON% -E "%PCBUILD%\get_external.py" --binary --organization %ORG% --externals-dir "%EXTERNALS_DIR%" %%b

Tools/jit/README.md

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -9,32 +9,32 @@ Python 3.11 or newer is required to build the JIT.
99

1010
The JIT compiler does not require end users to install any third-party dependencies, but part of it must be *built* using LLVM[^why-llvm]. You are *not* required to build the rest of CPython using LLVM, or even the same version of LLVM (in fact, this is uncommon).
1111

12-
LLVM version 20 is the officially supported version. You can modify if needed using the `LLVM_VERSION` env var during configure. Both `clang` and `llvm-readobj` need to be installed and discoverable (version suffixes, like `clang-19`, are okay). It's highly recommended that you also have `llvm-objdump` available, since this allows the build script to dump human-readable assembly for the generated code.
12+
LLVM version 21 is the officially supported version. You can modify if needed using the `LLVM_VERSION` env var during configure. Both `clang` and `llvm-readobj` need to be installed and discoverable (version suffixes, like `clang-19`, are okay). It's highly recommended that you also have `llvm-objdump` available, since this allows the build script to dump human-readable assembly for the generated code.
1313

1414
It's easy to install all of the required tools:
1515

1616
### Linux
1717

18-
Install LLVM 20 on Ubuntu/Debian:
18+
Install LLVM 21 on Ubuntu/Debian:
1919

2020
```sh
2121
wget https://apt.llvm.org/llvm.sh
2222
chmod +x llvm.sh
23-
sudo ./llvm.sh 20
23+
sudo ./llvm.sh 21
2424
```
2525

26-
Install LLVM 20 on Fedora Linux 40 or newer:
26+
Install LLVM 21 on Fedora Linux 40 or newer:
2727

2828
```sh
29-
sudo dnf install 'clang(major) = 20' 'llvm(major) = 20'
29+
sudo dnf install 'clang(major) = 21' 'llvm(major) = 21'
3030
```
3131

3232
### macOS
3333

34-
Install LLVM 20 with [Homebrew](https://brew.sh):
34+
Install LLVM 21 with [Homebrew](https://brew.sh):
3535

3636
```sh
37-
brew install llvm@20
37+
brew install llvm@21
3838
```
3939

4040
Homebrew won't add any of the tools to your `$PATH`. That's okay; the build script knows how to find them.
@@ -43,18 +43,18 @@ Homebrew won't add any of the tools to your `$PATH`. That's okay; the build scri
4343

4444
LLVM is downloaded automatically (along with other external binary dependencies) by `PCbuild\build.bat`.
4545

46-
Otherwise, you can install LLVM 20 [by searching for it on LLVM's GitHub releases page](https://github.com/llvm/llvm-project/releases?q=20), clicking on "Assets", downloading the appropriate Windows installer for your platform (likely the file ending with `-win64.exe`), and running it. **When installing, be sure to select the option labeled "Add LLVM to the system PATH".**
46+
Otherwise, you can install LLVM 21 [by searching for it on LLVM's GitHub releases page](https://github.com/llvm/llvm-project/releases?q=21), clicking on "Assets", downloading the appropriate Windows installer for your platform (likely the file ending with `-win64.exe`), and running it. **When installing, be sure to select the option labeled "Add LLVM to the system PATH".**
4747

4848
Alternatively, you can use [chocolatey](https://chocolatey.org):
4949

5050
```sh
51-
choco install llvm --version=20.1.8
51+
choco install llvm --version=21.1.0
5252
```
5353

5454
### Dev Containers
5555

5656
If you are working on CPython in a [Codespaces instance](https://devguide.python.org/getting-started/setup-building/#using-codespaces), there's no
57-
need to install LLVM as the Fedora 42 base image includes LLVM 20 out of the box.
57+
need to install LLVM as the Fedora 43 base image includes LLVM 21 out of the box.
5858

5959
## Building
6060

Tools/jit/_llvm.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@
1111
import _targets
1212

1313

14-
_LLVM_VERSION = "20"
15-
_EXTERNALS_LLVM_TAG = "llvm-20.1.8.0"
14+
_LLVM_VERSION = "21"
15+
_EXTERNALS_LLVM_TAG = "llvm-21.1.4.0"
1616

1717
_P = typing.ParamSpec("_P")
1818
_R = typing.TypeVar("_R")

0 commit comments

Comments
 (0)