Skip to content

Commit d3b5877

Browse files
Merge branch 'pr/140973' into tracing_jit_llvm_21
2 parents 3fdda5a + 9778bdd commit d3b5877

5 files changed

Lines changed: 19 additions & 18 deletions

File tree

.github/workflows/jit.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ jobs:
6969
- true
7070
- false
7171
llvm:
72-
- 20
72+
- 21
7373
include:
7474
# To re-enable later when we support these.
7575
# - target: i686-pc-windows-msvc/msvc
@@ -140,7 +140,7 @@ jobs:
140140
fail-fast: false
141141
matrix:
142142
llvm:
143-
- 20
143+
- 21
144144
steps:
145145
- uses: actions/checkout@v4
146146
with:
@@ -168,7 +168,7 @@ jobs:
168168
fail-fast: false
169169
matrix:
170170
llvm:
171-
- 20
171+
- 21
172172
steps:
173173
- uses: actions/checkout@v4
174174
with:
@@ -195,7 +195,7 @@ jobs:
195195
fail-fast: false
196196
matrix:
197197
llvm:
198-
- 20
198+
- 21
199199
steps:
200200
- uses: actions/checkout@v4
201201
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)