python icon indicating copy to clipboard operation
python copied to clipboard

DNM: enable the experimental JIT in 3.13+

Open tianon opened this issue 8 months ago • 5 comments

This is for testing, not for merging.

See:

  • https://docs.python.org/3.13/whatsnew/3.13.html#an-experimental-just-in-time-jit-compiler
  • https://github.com/docker-library/python/issues/947
  • https://github.com/docker-library/python/issues/1009

Test it with something like:

$ docker build --pull https://github.com/docker-library/python.git#refs/pull/1043/merge:3.13/slim-trixie

tianon avatar May 22 '25 20:05 tianon

Oof, there's a lot to unpack with this one.

  • https://docs.python.org/3.13/whatsnew/3.13.html#an-experimental-just-in-time-jit-compiler mentions --experimental-jit-interpreter but it's actually --enable-experimental-jit as noted further down
  • https://github.com/python/cpython/blob/3.13/Tools/jit/README.md has several other requirements, notably Python 3.11+ and LLVM version 18 (specifically and only 18: https://github.com/python/cpython/blob/3.13/Tools/jit/_llvm.py#L11)

That is going to be really limiting in our ability to enable this (for example, LLVM 18 isn't even available in Debian stable - it's currently in testing, but I don't know if it'll survive to release of trixie).

tianon avatar May 22 '25 21:05 tianon

(and to head it off: compiling LLVM from source is very much out-of-the-question unless/until upstream decides this feature is part of a standard recommended install and should be enabled for ~everyone)

tianon avatar May 22 '25 21:05 tianon

Rebased on #1042, applied more hacks; at least the slim-trixie builds here should succeed.

tianon avatar May 22 '25 21:05 tianon

(unsurprisingly, it looks like Alpine is unsupported: build.py: error: argument target: invalid get_target value: 'x86_64-pc-linux-musl')

tianon avatar May 22 '25 21:05 tianon

In the spirit of https://bsky.app/profile/savannah.dev/post/3lskscidafk2e slash https://docs.python.org/3.14/whatsnew/3.14.html#binary-releases-for-the-experimental-just-in-time-compiler, I have updated this to use yes-off, which is clearly considered semi-officially OK for released binaries (as the Windows and macOS official releases are now built with it). Hopefully that's true of 3.13 as well. :see_no_evil:

We do still need to resolve the LLVM version issue ... somehow. (I really wish https://apt.llvm.org/ included releases, not just nightlies :disappointed:)

tianon avatar Jun 27 '25 17:06 tianon