[pypy-dev] Contributing Polyhedral Optimisations in PyPy

Carl Friedrich Bolz-Tereick cfbolz at gmx.de
Tue Jan 19 16:49:38 EST 2021


Hi!

it's a bit hard to know what what to suggest to start with. Would you be
interested in setting up a Zoom call (eg next week, some evening CET) to
discuss a bit your concrete plans and timeline?

(I for one would be somewhat worried whether all that you are describing
is doable in the timing context of a master thesis project, but it may
be best to really discuss it person).

Cheers,

Carl Friedrich

On 19.01.21 01:45, muke101 via pypy-dev wrote:
> Hi, so to update you both I have decided to pursue this project after all, I'm very excited to work on PyPy.
> 
> To reiterate my objective, I'll be trying to formulate a way to augment the JIT optimiser to expose enough information such that more advanced optimisations can be implemented, with Polyhedral compatibility in mind. Of the ideas suggested, I'm currently leaning towards trying to create a second optimisation layer for sufficiently hot code, which can take into account more of the program at once, as this seems similar to what other JIT compilers already employ. This is open to the problem of assumptions being invalidated that Armin bought up (if I understood correctly), but similar implementations like in the paper I referred to below have formulated methods to accommodate for this. I think the key for PyPy would be figuring out how to track the correct metadata from previously seen traces such that the bytecode from relevant control paths can be bought together to work on, and mainly reconstructing entire loops once individual sufficiently hot traces are found. Once this is done then actually any number of optimisations could be preformed. The JIT compiler in the JavaScriptCore engine compiles the hottest bytecode down to LLVM-IR and sends it through the LLVM back end. I had looked into similar possibilities for Python, and it seems only a subset of the language can be compiled to LLVM-IR through Numa though, which is a shame. If focusing on just Polyhedral optimisations though a possibility could be to write a SCoP detector for Python bytecode specifically, raise it to Polyhedral representation and then import it into LLVM's Polly tool, but this is getting ahead a bit.
> 
> I'll be getting to grips with PyPy's codebase soon, after I'm comfortable with the fundamentals of tracing JIT's. Do you have any suggestions on where to begin specifically for what I'm looking to do? I imagine generally all this will be within the JIT optimiser, but if there's anything specific you can think of please let me know.
> 
> Thanks.
> 
> 
> Sent with ProtonMail Secure Email.
> 



More information about the pypy-dev mailing list