-
-
Notifications
You must be signed in to change notification settings - Fork 32.5k
gh-131798: JIT: replace _CHECK_METHOD_VERSION with _CHECK_FUNCTION_VERSION_INLINE #135022
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
Changes from 5 commits
7bc5cf6
baaff8e
4e13d21
68f93b5
cc8ecf1
2841780
41838e9
cc87439
37bac81
9ce01b0
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1370,6 +1370,23 @@ def testfunc(n): | |
# Removed guard | ||
self.assertNotIn("_CHECK_FUNCTION_EXACT_ARGS", uops) | ||
|
||
def test_method_guards_removed_or_reduced(self): | ||
|
||
def testfunc(n): | ||
for i in range(n): | ||
test_bound_method(i) | ||
|
||
|
||
testfunc(TIER2_THRESHOLD) | ||
|
||
ex = get_first_executor(testfunc) | ||
self.assertIsNotNone(ex) | ||
uops = get_opnames(ex) | ||
self.assertIn("_PUSH_FRAME", uops) | ||
# Strength reduced version | ||
self.assertIn("_CHECK_FUNCTION_VERSION_INLINE", uops) | ||
self.assertNotIn("_CHECK_METHOD_VERSION", uops) | ||
|
||
def test_jit_error_pops(self): | ||
""" | ||
Tests that the correct number of pops are inserted into the | ||
|
@@ -2219,6 +2236,13 @@ def f(n): | |
self.assertNotIn("_LOAD_ATTR_METHOD_NO_DICT", uops) | ||
self.assertNotIn("_LOAD_ATTR_METHOD_LAZY_DICT", uops) | ||
|
||
class TestObject: | ||
def test(self, *args, **kwargs): | ||
return args[0] | ||
|
||
test_object = TestObject() | ||
test_bound_method = TestObject.test.__get__(test_object) | ||
|
||
Comment on lines
+2297
to
+2303
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can you move this into Also, I think it can be simplified to something like: class TestObject:
def test(self, arg):
return arg
test_bound_method = TestObject().test There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If I'm correct, Reference the test code here There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
BTW, if I push the test object into the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @Zheaoli is right here. Can you please move this back to global scope? It seems tests are failing as the global method is not being promoted to a constant. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Sure |
||
|
||
def global_identity(x): | ||
return x | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Replace ``_CHECK_METHOD_VERSION`` with ``_CHECK_FUNCTION_VERSION_INLINE`` | ||
Zheaoli marked this conversation as resolved.
Show resolved
Hide resolved
|
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Uh oh!
There was an error while loading. Please reload this page.