Skip to content

gh-115999: Add free-threaded specialization for COMPARE_OP - #126410

Merged
Yhg1s merged 5 commits into
python:mainfrom
Yhg1s:compare_op
Jan 7, 2025
Merged

gh-115999: Add free-threaded specialization for COMPARE_OP#126410
Yhg1s merged 5 commits into
python:mainfrom
Yhg1s:compare_op

Conversation

@Yhg1s

@Yhg1sYhg1s commented Nov 4, 2024

Copy link
Copy Markdown
Member

Add free-threaded specialization for COMPARE_OP, and tests for COMPARE_OP specialization in general. This relies on thread-local bytecode and atomic operations to update the counters and bytecode, which are single operations.

@mpagempage left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Please add a short explanation of why the specialized instructions are thread-safe to either the pull request or the commit (when it's merged).

@markshannonmarkshannon left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The approach looks sound, but the test will need moving and should not rely on specific sequences of instructions.

Comment threadLib/test/test_dis.py Outdated
@bedevere-app

Copy link
Copy Markdown

When you're done making the requested changes, leave the comment: I have made the requested changes; please review again.

Comment threadPython/specialize.c
Comment threadPython/specialize.c Outdated

@Yhg1sYhg1s left a comment

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PTAL.

Comment threadPython/specialize.c
Comment threadLib/test/test_dis.py Outdated
@Yhg1s

Copy link
Copy Markdown
MemberAuthor

PTAL.

Sorry, that's Google for:

I have made the requested changes; please review again.

@bedevere-app

Copy link
Copy Markdown

Thanks for making the requested changes!

@markshannon, @mpage: please review the changes made to this pull request.

@mpagempage left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. I queued benchmark runs for both the free-threaded and default builds for this PR. Let's wait until we have the results before merging this.

@mpage

Copy link
Copy Markdown
Contributor

Performance doesn't look like a blocker:

@Yhg1s

Copy link
Copy Markdown
MemberAuthor

@markshannon All your concerns should have been addressed, do you want to take another look?

@corona10corona10 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@corona10

Copy link
Copy Markdown
Member

@mpage, @Yhg1s I think that it's okay to merge this PR at this moment :)

@Yhg1s

Copy link
Copy Markdown
MemberAuthor

@mpage, @Yhg1s I think that it's okay to merge this PR at this moment :)

Well, not according to GitHub's UI :)

image

I want to give Mark the chance to review it again before I merge it, and a week and a half is not a long time when dealing with what is effectively a volunteer workforce :)

@Yhg1s
Yhg1s merged commit 8f93dd8 into python:mainJan 7, 2025
srinivasreddy pushed a commit to srinivasreddy/cpython that referenced this pull request Jan 8, 2025
…hon#126410)
Add free-threaded specialization for COMPARE_OP, and tests for COMPARE_OP specialization in general.
Co-authored-by: Donghee Na <donghee.na92@gmail.com>
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

skip newstopic-free-threadingtype-featureA feature request or enhancement

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants

@Yhg1s@mpage@corona10@markshannon@Eclips4