rfc:jit-ir
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
rfc:jit-ir [2023/10/05 20:13] – Update status dmitry | rfc:jit-ir [2025/01/17 11:22] (current) – Link to correct merge commits, and fix typos/grammar theodorejb | ||
---|---|---|---|
Line 3: | Line 3: | ||
* Date: 2023-09-20 | * Date: 2023-09-20 | ||
* Author: Dmitry Stogov, dmitry@php.net | * Author: Dmitry Stogov, dmitry@php.net | ||
- | * Status: | + | * Status: |
* First Published at: http:// | * First Published at: http:// | ||
===== Introduction ===== | ===== Introduction ===== | ||
- | The first version of JIT for PHP was released in PHP-8.0 (https:// | + | The first version of JIT for PHP was released in PHP-8.0 (https:// |
- | A smarter JIT compiler with some Intermediate Representation was planned a long time. The real work was started in January 2022. | + | A smarter JIT compiler with some Intermediate Representation was planned |
This proposal is the result of these 1.75 years of work. | This proposal is the result of these 1.75 years of work. | ||
Line 29: | Line 29: | ||
At the current state the PR doesn' | At the current state the PR doesn' | ||
- | JIT is a quite complex subsystem. Its first implementation will likely have bugs, but I am confident that these can be addressed. We have more time to fix potential issues, the sooner this proposal passes, and the patch is merged. | + | JIT is a quite complex subsystem. Its first implementation will likely have bugs, but I am confident that these can be addressed. We have more time to fix potential issues the sooner this proposal passes, and the patch is merged. |
- | The main goal of a separate IR Framework development is the collaboration with other compiler experts (sharing expertise, | + | The main goal of a separate IR Framework development is the collaboration with other compiler experts (sharing expertise, |
The necessary part of the IR Framework is embedded into the PHP source tree, and won't introduce any new external dependencies. | The necessary part of the IR Framework is embedded into the PHP source tree, and won't introduce any new external dependencies. | ||
- | The details of the IR framework are complex. This [[https:// | + | The details of the IR framework are complex. This [[https:// |
===== Backward Incompatible Changes ===== | ===== Backward Incompatible Changes ===== | ||
Line 53: | Line 53: | ||
Because the IR Framework provides more optimizations and has a smarter Register Allocator, the JIT produces a bit faster (5-10%) and smaller code. | Because the IR Framework provides more optimizations and has a smarter Register Allocator, the JIT produces a bit faster (5-10%) and smaller code. | ||
- | This is visible with **bench.php** and **micro_bench.php**. The speed of the real-life applications is not affected. | + | This is visible with **bench.php** and **micro_bench.php**. The speed of real-life applications is not affected. |
The compilation speed of the Tracing JIT is almost the same. The compilation speed of the Function JIT is up to 4 times slower (tested on Wordpress). | The compilation speed of the Tracing JIT is almost the same. The compilation speed of the Function JIT is up to 4 times slower (tested on Wordpress). | ||
Line 72: | Line 72: | ||
==== php.ini Defaults ==== | ==== php.ini Defaults ==== | ||
- | The PR does not introduce new php.ini | + | The PR does not introduce new php.ini |
It adds few new IR related JIT debugging capabilities that may be enabled through **opcache.jit_debug** directive bits: | It adds few new IR related JIT debugging capabilities that may be enabled through **opcache.jit_debug** directive bits: | ||
Line 107: | Line 107: | ||
===== Future Scope ===== | ===== Future Scope ===== | ||
- | The usage of IR opens the door for more powerful optimizations. Some of these are going to be PHP independent (e.g.): the planned | + | The usage of IR opens the door for more powerful optimizations. Some of these are going to be PHP independent (e.g. the planned introduction of new loop optimization passes, |
- | introduction of new loop optimization passes, | + | |
The other part is PHP specific (for example, we can extend CPU register usage for more instructions). | The other part is PHP specific (for example, we can extend CPU register usage for more instructions). | ||
Line 120: | Line 119: | ||
Voting opened 2023-10-06 and closes 2023-10-19. | Voting opened 2023-10-06 and closes 2023-10-19. | ||
- | <doodle title=" | + | <doodle title=" |
* Yes | * Yes | ||
* No | * No | ||
Line 128: | Line 127: | ||
Secondary vote: Should we keep the old JIT implementation for a while or remove it right after merge? | Secondary vote: Should we keep the old JIT implementation for a while or remove it right after merge? | ||
- | Note, that old implementation is not going to be tested (by CI) and we can't guarantee its work anyway. | + | Note, that old implementation is not going to be tested (by CI) and we can't guarantee its functionality |
- | <doodle title=" | + | <doodle title=" |
* Yes | * Yes | ||
* No | * No | ||
Line 143: | Line 142: | ||
===== Implementation ===== | ===== Implementation ===== | ||
- | After the project is implemented, | + | - merged into master via https:// |
- | + | | |
- | | + | |
- | | + | |
- | - a link to the PHP manual entry for the feature | + | |
- | | + | |
===== References ===== | ===== References ===== |
rfc/jit-ir.1696536827.txt.gz · Last modified: 2023/10/05 20:13 by dmitry