PEP 836: JIT Go Brrr: The Path to a Supported JIT Compiler for CPython

While I’m obviously supportive of resuming work on the JIT, I have a few concerns about PEP 836.

Why is changing to a method-based front-end so important that it justifies stalling JIT development for a whole year?

Ruby did much the same switch, changing from a tracing to a method front-end, with the switch from YJIT to ZJIT.
Despite working on ZJIT for over a year now, it is still slower than YJIT, despite YJIT development being largely stalled; one can only speculate how much faster YJIT would be if development on it had continued.

I don’t think should region selection should be in the PEP at all.
No one, outside of those of us working on the JIT, should care about region selection, any more than they need to care about the type lattice, optimization buffer management, or other internals.

As a JIT becomes more advanced, region selection becomes more complex, no longer simply traces vs methods.
In a trace based optimizer, traces can be merged and re-optimized.
In a method based optimizer, calls can be inlined, and stubs generated for cold paths.
Ultimately, the goal of both is to create regions that reflect the execution of the program,and the
final regions produced by either front-end will, to some degree, converge.
Changing to a method front-end doesn’t give us better regions; it just gives us a different starting point to evolve toward good regions.

While I think a tracing front end is better, it isn’t that much better.
If Brandt and Ken Jin can produce a compelling prototype that is easier to maintain and test and doesn’t significantly degrade performance, then it would make sense to switch the front-end. But it doesn’t need to be in the PEP. Having it in the PEP merely limits our options to change the front-end if some alternative or hybrid front-end becomes the best option, or to switch to a method front-end in a year or two, instead of right now.

I should also say, that if we already had a method front-end and a tracing front-end PEP were proposed, I would be oppose that change for much the same reason: it is too disruptive.

Finally, while I think a tracing front-end is superior to a method front-end, both are much better than no JIT at all.

9 Likes