Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

Yhg1s
Copy link
Member

@Yhg1s Yhg1s commented Nov 4, 2024

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.

Copy link
Contributor

@mpage mpage left a comment

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).

Copy link
Member

@markshannon markshannon left a comment

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.

Lib/test/test_dis.py Outdated Show resolved Hide resolved
@bedevere-app
Copy link

bedevere-app bot commented Nov 6, 2024

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

Python/specialize.c Show resolved Hide resolved
Python/specialize.c Outdated Show resolved Hide resolved
Copy link
Member Author

@Yhg1s Yhg1s left a comment

Choose a reason for hiding this comment

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

PTAL.

Python/specialize.c Show resolved Hide resolved
Lib/test/test_dis.py Outdated Show resolved Hide resolved
@Yhg1s
Copy link
Member Author

Yhg1s commented Dec 11, 2024

PTAL.

Sorry, that's Google for:

I have made the requested changes; please review again.

@bedevere-app
Copy link

bedevere-app bot commented Dec 11, 2024

Thanks for making the requested changes!

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

@bedevere-app bedevere-app bot requested review from markshannon and mpage December 11, 2024 14:12
Copy link
Contributor

@mpage mpage left a comment

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
Contributor

mpage commented Dec 12, 2024

Performance doesn't look like a blocker:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants