Uh oh!
There was an error while loading. Please reload this page.
gh-141594: A free-threaded JIT (Part 1) - #141595
Conversation
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
@sergey-miryanov in the future could you please bundle up your reviews and send them in one review instead of multiple reviews? |
Latest results for macOS FT+JIT are incredibly good: 8-10% faster on pyperformance versus just FT-only. |
tomasr8
left a comment
There was a problem hiding this comment.
Not an expert in this area, but everything looks reasonable. I just have a couple of comments/questions as usual :)
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
| // There's more than one thread. In FT mode, | ||
| // disable the JIT completely for now. |
There was a problem hiding this comment.
Do you think it's feasible to add a test that ensures the JIT is properly disabled and then re-enabled?
There was a problem hiding this comment.
I added a test, thanks!
This PR is stale because it has been open for 30 days with no activity. |
This PR gives the JIT free-threading support. It is only on for single-threaded code, and turns off automatically on multi-threaded code. All JIT features are turned on, including the optimizer. All tests pass on my system, including TSAN as of 527aac1 usng the FT suppression file, except for the usual spurious race conditions already in existing CPython.
Benchmark results are good. Overall speedup of 5% faster on FT+JIT vs just FT for x86-64 https://github.com/facebookexperimental/free-threading-benchmarking/blob/main/results/bm-20260110-3.15.0a3%2B-5d987e8-JIT%2CNOGIL/bm-20260110-vultr-x86_64-Fidget%252dSpinner-jit_ft-3.15.0a3%2B-5d987e8-vs-base.md
9-10% speedup for macOS AArch64 for FT+JIT vs FT https://github.com/facebookexperimental/free-threading-benchmarking/blob/main/results/bm-20260110-3.15.0a3%2B-5d987e8-JIT%2CNOGIL/bm-20260110-macm4pro-arm64-Fidget%252dSpinner-jit_ft-3.15.0a3%2B-5d987e8-vs-base.md
Design:
Creation of >1 threads cause global invalidation of all executors and disables JIT. Once we drop to 1 thread, JIT is re-enabled.
Two versions of stencils are required --- one for max single threaded perf, one for multi-threaded safety. This just implements the first part (max single threaded perf) stencils.
All with FT+PGO+LTO=thin+TC+JIT +
pyperf system tune:This is on a platform where locking/atomics are somewhat slow (i7-12700h). I removed the lock removal code for this PR to reduce the diff.