rpython: first steps?

I've managed to write a small rpython interpreter, and the jit seems to be working for both single loops and bridged loop nests. Does anyone have any suggestions for what I should be looking at next? Is attempting to play with the structure of the interpreter worthwhile? Or should I be looking to see which helper defs I can mark with the rpython decorators? Or something else? Thanks -Dave

Hi Dave, Cool! Welcome! Is the code of that interpreter somewhere? I'd be happy to take a look at it and see whether there are obvious points of improvement. The next step is indeed to apply some of the other rpython hints, like promote, elidable, unroll_safe, declaring some instance fields to be immutable. When doing that, it's important to always start from small program examples, inspect the trace that the JIT generates for them, identify sources of slowness in the trace (allocations and calls are good candidates) and then adding hints to improve these. Also, always measure the time these microbenchmarks take, to see whether the new hints actually improved the time. It takes a bit of time to figure out what's the most effective way to apply these hints is. This paper explains some of the hints: https://dl.acm.org/doi/10.1145/2069172.2069181 In this video I do this kind of work (using slightly idiosyncratic tools though): https://youtu.be/fZj3uljJl_k If you want to discuss these problems directly, please feel free to join our #pypy irc channel on libera.chat Cheers, CF On July 4, 2023 11:33:37 PM GMT+02:00, dave.long@bluewin.ch wrote:
I've managed to write a small rpython interpreter, and the jit seems to be working for both single loops and bridged loop nests. Does anyone have any suggestions for what I should be looking at next?
Is attempting to play with the structure of the interpreter worthwhile? Or should I be looking to see which helper defs I can mark with the rpython decorators? Or something else?
Thanks -Dave _______________________________________________ pypy-dev mailing list -- pypy-dev@python.org To unsubscribe send an email to pypy-dev-leave@python.org https://mail.python.org/mailman3/lists/pypy-dev.python.org/ Member address: cfbolz@gmx.de

Hi CF, Thanks for the very useful reply; sorry mine is late. Last night I tried immutable and elidable hints in what I thought were obvious places, but I guess they were already obvious enough as they didn't affect the JIT trace ({jit-log-opt-loop} is what I want to be looking at, right?). Tonight I'll try to skim the video to get some other ideas. (I've also learned that I really ought to implement get_printable_location, which is first priority for tonight) Unfortunately the code isn't uploaded anywhere; I'll mail a copy to you when I get a chance to clean it up slightly (on or before the weekend). Thanks again, -Dave
participants (2)
-
CF Bolz-Tereick
-
dave.long@bluewin.ch