Skip to content

Commit 1f381a5

Browse files
Add details about JIT build infrastructure and updating dependencies to Tools/jit (python#141167)
1 parent fbcac79 commit 1f381a5

File tree

2 files changed

+31
-0
lines changed

2 files changed

+31
-0
lines changed

Tools/jit/README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,9 @@ Otherwise, just configure and build as you normally would. Cross-compiling "just
6666

6767
The JIT can also be enabled or disabled using the `PYTHON_JIT` environment variable, even on builds where it is enabled or disabled by default. More details about configuring CPython with the JIT and optional values for `--enable-experimental-jit` can be found [here](https://docs.python.org/dev/using/configure.html#cmdoption-enable-experimental-jit).
6868

69+
## Miscellaneous
70+
If you're looking for information on how to update the JIT build dependencies, see [JIT Build Infrastructure](jit_infra.md).
71+
6972
[^pep-744]: [PEP 744](https://peps.python.org/pep-0744/)
7073

7174
[^why-llvm]: Clang is specifically needed because it's the only C compiler with support for guaranteed tail calls (`musttail`), which are required by CPython's continuation-passing-style approach to JIT compilation. Since LLVM also includes other functionalities we need (namely, object file parsing and disassembly), it's convenient to only support one toolchain at this time.

Tools/jit/jit_infra.md

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# JIT Build Infrastructure
2+
3+
This document includes details about the intricacies of the JIT build infrastructure.
4+
5+
## Updating LLVM
6+
7+
When we update LLVM, we need to also update the LLVM release artifact for Windows builds. This is because Windows builds automatically pull prebuilt LLVM binaries in our pipelines (e.g. notice that `.github/workflows/jit.yml` does not explicitly download LLVM or build it from source).
8+
9+
To update the LLVM release artifact for Windows builds, follow these steps:
10+
1. Go to the [LLVM releases page](https://github.com/llvm/llvm-project/releases).
11+
1. Download x86_64 Windows artifact for the desired LLVM version (e.g. `clang+llvm-21.1.4-x86_64-pc-windows-msvc.tar.xz`).
12+
1. Extract and repackage the tarball with the correct directory structure. For example:
13+
```bash
14+
tar -xf clang+llvm-21.1.4-x86_64-pc-windows-msvc.tar.xz
15+
mv clang+llvm-21.1.4-x86_64-pc-windows-msvc llvm-21.1.4.0
16+
tar -cf - llvm-21.1.4.0 | pv | xz > llvm-21.1.4.0.tar.xz
17+
```
18+
The tarball must contain a top-level directory named `llvm-{version}.0/`.
19+
1. Go to [cpython-bin-deps](https://github.com/python/cpython-bin-deps).
20+
1. Create a new release with the updated LLVM artifact.
21+
- Create a new tag to match the LLVM version (e.g. `llvm-21.1.4.0`).
22+
- Specify the release title (e.g. `LLVM 21.1.4 for x86_64 Windows`).
23+
- Upload the asset (you can leave all other fields the same).
24+
25+
### Other notes
26+
- You must make sure that the name of the artifact matches exactly what is expected in `Tools/jit/_llvm.py` and `PCbuild/get_externals.py`.
27+
- We don't need multiple release artifacts for each architecture because LLVM can cross-compile for different architectures on Windows; x86_64 is sufficient.
28+
- You must have permissions to create releases in the `cpython-bin-deps` repository. If you don't have permissions, you should contact one of the organization admins.

0 commit comments

Comments
 (0)