-
-
Notifications
You must be signed in to change notification settings - Fork 34.4k
gh-139038: Add JIT What's New for 3.15 #142845
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
Changes from all commits
26cdf15
a851fe1
cdeaf99
ee16268
52e3566
f133047
59f38a8
b5bb5d9
4a0c773
d396a0e
d56dbda
bb76a0d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -73,6 +73,7 @@ Summary -- Release highlights | |
| <whatsnew315-utf8-default>` | ||
| * :pep:`782`: :ref:`A new PyBytesWriter C API to create a Python bytes object | ||
| <whatsnew315-pep782>` | ||
| * :ref:`The JIT compiler has been significantly upgraded <whatsnew315-jit>` | ||
| * :ref:`Improved error messages <whatsnew315-improved-error-messages>` | ||
|
|
||
|
|
||
|
|
@@ -850,6 +851,91 @@ csv | |
| (Contributed by Maurycy Pawłowski-Wieroński in :gh:`137628`.) | ||
|
|
||
|
|
||
| .. _whatsnew315-jit: | ||
|
|
||
| Upgraded JIT compiler | ||
| ===================== | ||
|
|
||
| Results from the `pyperformance <https://github.com/python/pyperformance>`__ | ||
| benchmark suite report | ||
| `3-4% <https://github.com/facebookexperimental/free-threading-benchmarking/blob/main/results/bm-20251214-3.15.0a2%2B-6cddf04-JIT/bm-20251214-vultr-x86_64-python-6cddf04344a1e8ca9df5-3.15.0a2%2B-6cddf04-vs-base.svg>`__ | ||
| geometric mean performance improvement for the JIT over the standard CPython | ||
| interpreter built with all optimizations enabled. The speedups for JIT | ||
| builds versus no JIT builds range from roughly 20% slowdown to over | ||
| 100% speedup (ignoring the ``unpack_sequence`` microbenchmark) on | ||
| x86-64 Linux and AArch64 macOS systems. | ||
|
|
||
| .. attention:: | ||
| These results are not yet final. | ||
|
|
||
| The major upgrades to the JIT are: | ||
|
|
||
| * LLVM 21 build-time dependency | ||
| * New tracing frontend | ||
| * Basic register allocation in the JIT | ||
| * More JIT optimizations | ||
| * Better machine code generation | ||
|
|
||
| .. rubric:: LLVM 21 build-time dependency | ||
|
|
||
| The JIT compiler now uses LLVM 21 for build-time stencil generation. As | ||
| always, LLVM is only needed when building CPython with the JIT enabled; | ||
| end users running Python do not need LLVM installed. Instructions for | ||
| installing LLVM can be found in the `JIT compiler documentation | ||
| <https://github.com/python/cpython/blob/main/Tools/jit/README.md>`__ | ||
| for all supported platforms. | ||
|
|
||
| (Contributed by Savannah Ostrowski in :gh:`140973`.) | ||
|
|
||
| .. rubric:: A new tracing frontend | ||
|
|
||
| The JIT compiler now supports significantly more bytecode operations and | ||
| control flow than in Python 3.14, enabling speedups on a wider variety of | ||
| code. For example, simple Python object creation is now understood by the | ||
| 3.15 JIT compiler. Overloaded operations and generators are also partially | ||
| supported. This was made possible by an overhauled JIT tracing frontend | ||
| that records actual execution paths through code, rather than estimating | ||
| them as the previous implementation did. | ||
|
|
||
| (Contributed by Ken Jin in :gh:`139109`. Support for Windows added by | ||
| Mark Shannon in :gh:`141703`.) | ||
|
|
||
| .. rubric:: Basic register allocation in the JIT | ||
|
|
||
| A basic form of register allocation has been added to the JIT compiler's | ||
| optimizer. This allows the JIT compiler to avoid certain stack operations | ||
| altogether and instead operate on registers. This allows the JIT to produce | ||
| more efficient traces by avoiding reads and writes to memory. | ||
|
|
||
| (Contributed by Mark Shannon in :gh:`135379`.) | ||
|
|
||
| .. rubric:: More JIT optimizations | ||
|
|
||
| More `constant-propagation <https://en.wikipedia.org/wiki/Constant_folding>`__ | ||
| is now performed. This means when the JIT compiler detects that certain user | ||
| code results in constants, the code can be simplified by the JIT. | ||
|
|
||
| (Contributed by Ken Jin and Savannah Ostrowski in :gh:`132732`.) | ||
|
|
||
| The JIT avoids :term:`reference count`\ s where possible. This generally | ||
| reduces the cost of most operations in Python. | ||
|
|
||
| (Contributed by Ken Jin, Donghee Na, Nadeshiko Manju, Savannah Ostrowski, | ||
|
savannahostrowski marked this conversation as resolved.
|
||
| Noam Cohen, Tomas Roun, PuQing in :gh:`134584`.) | ||
|
|
||
| .. rubric:: Better machine code generation | ||
|
|
||
| The JIT compiler's machine code generator now produces better machine code | ||
| for x86-64 and AArch64 macOS and Linux targets. In general, users should | ||
| experience lower memory usage for generated machine code and more efficient | ||
| machine code versus the old JIT. | ||
|
|
||
| (Contributed by Brandt Bucher in :gh:`136528` and :gh:`136528`. | ||
|
savannahostrowski marked this conversation as resolved.
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I just noticed these are the same PR number. What should the other one be? (And we generally link to issues.)
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think 135905
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks, fixed in #148686. |
||
| Implementation for AArch64 contributed by Mark Shannon in :gh:`139855`. | ||
| Additional optimizations for AArch64 contributed by Mark Shannon and | ||
| Diego Russo in :gh:`140683` and :gh:`142305`.) | ||
|
|
||
|
|
||
| Removed | ||
| ======= | ||
|
|
||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.