Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 34k
gh-115999: Add free-threaded specialization for SEND.#127426
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
Uh oh!
There was an error while loading. Please reload this page.
Conversation
nascheme commented Nov 29, 2024 • edited by bedevere-app bot
Loading Uh oh!
There was an error while loading. Please reload this page.
edited by bedevere-app bot
Uh oh!
There was an error while loading. Please reload this page.
No additional thread safety changes are required. Note that sending to a generator that is shared between threads is not safe in the free-threaded build.
ZeroIntensity commented Nov 29, 2024
Related: GH-126371 makes native generators thread safe for free-threading. Once this gets merged, I can finish that one up and add any needed locking for the specialization instruction. |
nascheme commented Nov 30, 2024 • edited
Loading Uh oh!
There was an error while loading. Please reload this page.
edited
Uh oh!
There was an error while loading. Please reload this page.
I didn't test too much but applying GH-126371 on top of this PR makes the |
corona10 left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I try to organize unitest codes for specialized opcodes with more understandable function name :)
See:
cpython/Lib/test/test_opcache.py
Lines 1400 to 1418 in c112de1
| defbinary_subscr_dict(): | |
| for_inrange(100): | |
| a={1: 2, 2: 3} | |
| self.assertEqual(a[1], 2) | |
| self.assertEqual(a[2], 3) | |
| binary_subscr_dict() | |
| self.assert_specialized(binary_subscr_dict, "BINARY_SUBSCR_DICT") | |
| self.assert_no_opcode(binary_subscr_dict, "BINARY_SUBSCR") | |
| defbinary_subscr_str_int(): | |
| for_inrange(100): | |
| a="foobar" | |
| foridx, expectedinenumerate(a): | |
| self.assertEqual(a[idx], expected) | |
| binary_subscr_str_int() | |
| self.assert_specialized(binary_subscr_str_int, "BINARY_SUBSCR_STR_INT") | |
| self.assert_no_opcode(binary_subscr_str_int, "BINARY_SUBSCR") |
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.
mpage left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. I left a small suggestion inline to make the implementation of _Py_Specialize_Send a little more concise, but feel free to ignore it if you prefer the current code structure.
I've kicked off benchmark runs for both the default and free-threaded builds for this change. I'll post the results once they're available, likely tomorrow morning.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
mpage commented Dec 3, 2024
Performance looks neutral on both the default and free-threaded builds. I think it's still worth merging this to stay consistent with the default build. |
276cd66 into python:mainUh oh!
There was an error while loading. Please reload this page.
…h-127426) No additional thread safety changes are required. Note that sending to a generator that is shared between threads is currently not safe in the free-threaded build.
…h-127426) No additional thread safety changes are required. Note that sending to a generator that is shared between threads is currently not safe in the free-threaded build.
No additional thread safety changes are required. Note that sending to a generator that is shared between threads is not safe in the free-threaded build.
--disable-gilbuilds #115999