Profile avatar
pypyproject.bsky.social
The developers of the PyPy project: a fast, compliant, open source Python interpreter. https://pypy.org/ https://github.com/pypy/pypy
20 posts 154 followers 13 following
Regular Contributor
Conversation Starter
comment in response to post
Adding heap operations to Z3 didn't actually find any bugs in the JIT optimizer for heap operations. Maybe that's not entirely surprising, because miscompilations in that area tend to lead to crashes pretty quickly. In any case, it's good to have that infrastructure for the future.
comment in response to post
We also added limited support for generating random heap operations to our JIT optimizer fuzzer. This extends previous work, which supported only int operations in Z3: pypy.org/posts/2022/1...
comment in response to post
Christoph Jung, another student @cfbolz.bsky.social, added a memory model to our Z3 based translation validation. Now our CI checks whether our optimizer unit tests contain invalid optimizations using Z3.
comment in response to post
Micro-benchmarks for both optimizations look great, but both are hard to see in the performance of bigger programs.
comment in response to post
An unrelated optimization we also merged was to make store-to-load and load-to-load forwarding work for array reads and writes where the index is a variable. This already worked for constant indexes before.
comment in response to post
We've already had type based alias analysis before, but only taking the RPython level types into account. Unfortunately instances of different Python classes get represented as instances of the same RPython type, making the old JIT logic useless for distinguishing them, which is now fixed.
comment in response to post
Interestingly enough PyPy 3.x is mostly smaller than 2.7. E.g. PyPy 3.11 is 58.8 MiB, despite having a bunch more features. I never quite figure out why. Just for comparison, CPython 3.11 is 25.2 MiB.
comment in response to post
This is the size of PyPy 2.7, btw. It doesn't make sense to use the 3.x variant for this, because the size of that changes due to newer Python versions being implemented over time.
comment in response to post
So far this is a rather low-level mechanism, there's no convenient pdb integration yet. We plan to add something like that later, for now you can use a third-party package such as sdb to get an actual remote debugger going: github.com/ryanpetrello...
comment in response to post
The other new feature an implementation of the draft PEP 768, "Safe external debugger interface" (again, Linux only so far). PEP was written by @pablogsal.com et al. It allows you to remotely attach to a running PyPy process and inject Python code into it. doc.pypy.org/en/latest/re...
comment in response to post
We have further features planned for VMProf, including a stochastic memory profiler hopefully coming out later this year.
comment in response to post
Here's a screenshot of the Firefox Profiler UI showing VMProf output. The blue functions are native functions, yellow is Python functions and orange jitted functions (no example of that is in the screenshot).
comment in response to post
It works best by combining it with vmprof-firefox-profile, which converts vmprof output to a format the Firefox Profiler UI can read: github.com/Cskorpion/vm... (We're still working on a PyPI release of this tool.)
comment in response to post
VMProf on PyPy can now sample native functions and symbolify their names (Linux only at the moment). VMProf for CPython has had that feature for a while, we've now ported it to PyPy.