Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork32k
gh-126902: Strength reduce _CHECK_FUNCTION#126856
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
base:main
Are you sure you want to change the base?
Uh oh!
There was an error while loading.Please reload this page.
Conversation
@markshannon would you prefer this as its own PR, or would you prefer I merge this into the function inlining PR that I will be doing later? |
Sorry I realized this is logically incorrect. |
5fbc47a
to462cf77
Compare462cf77
to115bd0e
CompareI think I've said this before, but please link to an appropriate issue. Why are you doing this? The issue doesn't explain it at all. |
Fidget-Spinner commentedNov 16, 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.
@markshannon the issue is right, just too broad. I've created a smaller issue to further explain why we need this for partial evaluation at#126902 |
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 think it would be better to use the symbol for the function, rather than a reference in the optimizer.
Uh oh!
There was an error while loading.Please reload this page.
@@ -1515,9 +1515,33 @@ def test_jit_error_pops(self): | |||
with self.assertRaises(TypeError): | |||
{item for item in items} | |||
def test_global_guard_strength_reduced_if_possible(self): |
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.
It would be nicer (not necessarily in this PR) if we created tracelets directly, rather than this complex approach.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
When you're done making the requested changes, leave the comment: And if you don't make the requested changes, you will be put in the comfy chair! |
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'd like to replaceNULL
withsym_new_unknown
whenf_funcobj
is not known.
Otherwise, LGTM.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
@@ -4941,6 +4941,12 @@ dummy_func( | |||
DEOPT_IF(func->func_version != func_version); | |||
} | |||
tier2 op(_CHECK_FUNCTION_UNMODIFIED, (func_version/2, callable_p/4 --)) { | |||
assert(PyFunction_Check(callable_p)); | |||
PyFunctionObject *func = (PyFunctionObject *)callable_p; |
markshannonDec 6, 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.
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.
What guarantee is there thatfunc == frame->f_funcobj
?
Fidget-SpinnerDec 8, 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.
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.
It's constant propagated (and frames shouldn't be able to swap out f_funcobj on the fly like that). To be sure I added a runtime assert.
python-cla-botbot commentedApr 18, 2025 • 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.
Uh oh!
There was an error while loading.Please reload this page.
Small PR to strength reduce _CHECK_FUNCTION so it reads from operand instead of reading from the frame struct. This prevents _CHECK_FUNCTION from interfering with the partial evaluation later on. It interferes because once we remove the frame, there is no
frame->func_obj
to check anymore.An added benefit is that the "burned in" version is also cheaper as it doesn't have to read from the frame struct, rather reading from the instruction itself in the JIT.