JIT: Use pthread_jit_write_protect_np on macOS #126195
Copy link
Copy link
Open
Labels
OS-macperformancePerformance or resource usagePerformance or resource usagetopic-JITtype-featureA feature request or enhancementA feature request or enhancement
Description
Feature or enhancement
Proposal:
The proposal is an internal implementation of the JIT and it transparent to the user.
Has this already been discussed elsewhere?
I have already discussed this feature proposal on Discourse
Links to previous discussion of this feature:
Not on Discourse, I've had extensive discussion about this with @brandtbucher and created a prototype that we benchmarked using the faster-cpython infrastructure. The full results are here: https://github.com/faster-cpython/benchmarking-public/tree/main/results/bm-20241018-3.14.0a1+-f74cd79-JIT
On macOS on Apple Silicon there is an overall 1.4% speed improvement by replacing the mprotect with pthread_jit_write_protect_np.
Linked PRs
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
OS-macperformancePerformance or resource usagePerformance or resource usagetopic-JITtype-featureA feature request or enhancementA feature request or enhancement
Activity
pythonGH-126195: Use pthread_jit_write_protect_np on macOS
pythongh-126195: Use pthread_jit_write_protect_np on macOS
pythongh-126195: Use pthread_jit_write_protect_np on macOS
GH-126195: Use M1 JIT memory protection APIs (GH-126196)
brandtbucher commentedon Nov 12, 2024
I'll leave this open in case we want to explore the
pthread_jit_write_with_callback_npAPI: https://developer.apple.com/documentation/apple-silicon/porting-just-in-time-compilers-to-apple-siliconpythonGH-126195: Use M1 JIT memory protection APIs (pythonGH-126196)
pythonGH-126195: Use M1 JIT memory protection APIs (pythonGH-126196)