Add basic profiling support for CPython 3.14 free-threaded builds#860
Open
honglei wants to merge 1 commit into
Open
Add basic profiling support for CPython 3.14 free-threaded builds#860honglei wants to merge 1 commit into
honglei wants to merge 1 commit into
Conversation
Add detection for CPython 3.14 free-threaded builds and route stack sampling through a minimal 3.14t interpreter layout. Keep the first slice deliberately narrow: basic stack walking, code names, filenames, and line numbers. Thread names, locals, native stacks, memory profiling, core dumps, subinterpreters, and 3.13t support remain out of scope. Reject --gil explicitly on free-threaded builds because there is no single GIL owner to report. Assisted-by: Codex / GPT-5.5 Refs: benfred#711
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR adds basic stack sampling support for CPython 3.14 free-threaded builds.
It is intentionally scoped as the first step for #711:
libpython3.14tshared libraries_PyRuntime.debug_offsets.free_threaded--gilon free-threaded Python buildsOut of scope for this PR:
Related to #711.
Validation
cargo fmt --checkCARGO_HOME=/home/honglei/bwh/.cargo-py-spy cargo test --libCARGO_HOME=/home/honglei/bwh/.cargo-py-spy cargo test --release/opt/python314t/bin/python3):cargo +stable build --releasecargo +stable test --libpy-spy record -f raw -d 60 -- /opt/python314t/bin/python3 busy_314t.pySamples: 5999 Errors: 0busy_looppy-spy dump -p <pid>containsbusy_looppy-spy record --gil ...fails with--gil is not supported for free-threaded Python buildsrecord -f raw,Samples: 5999 Errors: 0record -f raw,Samples: 5999 Errors: 0record -f raw,Samples: 5999 Errors: 0AI assistance disclosure
This PR was prepared with assistance from Codex / GPT-5.5. The implementation and the validation results above were checked with local and remote test runs before submission.