gh-130373: Avoid locking in _LOAD_ATTR_WITH_HINT#130372
Merged
Merged
Conversation
colesbury
reviewed
Feb 20, 2025
6f8b1d7 to
15c28cb
Compare
colesbury
reviewed
Mar 4, 2025
Comment on lines
+2285
to
+2298
| #ifdef Py_GIL_DISABLED | ||
| _PyDict_EnsureSharedOnRead(dict_o); | ||
| #endif |
Contributor
There was a problem hiding this comment.
I think we should de-opt here if the condition doesn't hold. The critical section is escaping so previously validated guards might not hold.
Something like:
EXIT_IF(!_Py_IsOwnedByCurrentThread((PyObject *)dict_o) && !IS_DICT_SHARED(dict_o));
EDIT: EXIT_IF instead of DEOPT_IF
Contributor
Author
There was a problem hiding this comment.
I think we need to do DEOPT_IF because apparently we can't mix and match them. I've updated it to do the ownership check and then mark the dictionary as shared when doing the specialization.
Contributor
|
@DinoV - this lgtm modulo Sam's comment. Can you take a look? |
b666cd0 to
2fbeb0b
Compare
Contributor
|
LGTM. The tail calling check failure should go away if you merge main. Not sure about the other failing check. |
2fbeb0b to
aeb389d
Compare
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.
Adds a lock-free lookup of the hinted location
https://github.com/facebookexperimental/free-threading-benchmarking/tree/main/results/bm-20250219-3.14.0a5+-6a1fe7e-NOGIL