-
-
Notifications
You must be signed in to change notification settings - Fork 31.1k
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
Type propagation: just because something is const doesn't mean it automatically matches the type #115859
Comments
Heh, I just ran into this myself. |
As to the approach, the change to I'd say go ahead and fix it. |
Please, please, let's stop hacking at the optimizer until we have proper documentation and tests for the symbols and lattice. The code for |
It put up a PR to turn off the tier 2 redundancy eliminator by default #115860. |
The existing code for |
Reopening — if you enable the optimizer it still has this bug. |
I wonder what explains this crash:
(It's in That sure looks like the redundancy eliminator encountered a situation where I'm guessing we've projected a trace containing That said, I am totally in favor of setting up more rigid testing for the primitives first before we continue tinkering. |
Could it be a situation like this? X = 0.0
def f():
for _ in range(16):
X + X
# Specialize for float:
f()
# Make X an int:
X = 0
# Kick it into tier two.
# We have a float specialization but an int "constant" created from the global load:
f() Probably also possible to do with something like |
Exactly -- specialize T1 for float but invoke T2 with int. I don't think that updating |
This undoes the *temporary* default disabling of the T2 optimizer pass in gh-115860. - Add a new test that reproduces Brandt's example from gh-115859; it indeed crashes before gh-116028 with PYTHONUOPSOPTIMIZE=1 - Re-enable the optimizer pass in T2, stop checking PYTHONUOPSOPTIMIZE - Rename the env var to disable T2 entirely to PYTHON_UOPS_OPTIMIZE (must be explicitly set to 0 to disable) - Fix skipIf conditions on tests in test_opt.py accordingly - Export sym_is_bottom() (for debugging) - Fix various things in the `_BINARY_OP_` specializations in the abstract interpreter: - DECREF(temp) - out-of-space check after sym_new_const() - add sym_matches_type() checks, so even if we somehow reach a binary op with symbolic constants of the wrong type on the stack we won't trigger the type assert
…6079) This should fix the refleaks bots. (See #116062 (comment) .)
This undoes the *temporary* default disabling of the T2 optimizer pass in pythongh-115860. - Add a new test that reproduces Brandt's example from pythongh-115859; it indeed crashes before pythongh-116028 with PYTHONUOPSOPTIMIZE=1 - Re-enable the optimizer pass in T2, stop checking PYTHONUOPSOPTIMIZE - Rename the env var to disable T2 entirely to PYTHON_UOPS_OPTIMIZE (must be explicitly set to 0 to disable) - Fix skipIf conditions on tests in test_opt.py accordingly - Export sym_is_bottom() (for debugging) - Fix various things in the `_BINARY_OP_` specializations in the abstract interpreter: - DECREF(temp) - out-of-space check after sym_new_const() - add sym_matches_type() checks, so even if we somehow reach a binary op with symbolic constants of the wrong type on the stack we won't trigger the type assert
python#116079) This should fix the refleaks bots. (See python#116062 (comment) .)
This undoes the *temporary* default disabling of the T2 optimizer pass in pythongh-115860. - Add a new test that reproduces Brandt's example from pythongh-115859; it indeed crashes before pythongh-116028 with PYTHONUOPSOPTIMIZE=1 - Re-enable the optimizer pass in T2, stop checking PYTHONUOPSOPTIMIZE - Rename the env var to disable T2 entirely to PYTHON_UOPS_OPTIMIZE (must be explicitly set to 0 to disable) - Fix skipIf conditions on tests in test_opt.py accordingly - Export sym_is_bottom() (for debugging) - Fix various things in the `_BINARY_OP_` specializations in the abstract interpreter: - DECREF(temp) - out-of-space check after sym_new_const() - add sym_matches_type() checks, so even if we somehow reach a binary op with symbolic constants of the wrong type on the stack we won't trigger the type assert
python#116079) This should fix the refleaks bots. (See python#116062 (comment) .)
This undoes the *temporary* default disabling of the T2 optimizer pass in pythongh-115860. - Add a new test that reproduces Brandt's example from pythongh-115859; it indeed crashes before pythongh-116028 with PYTHONUOPSOPTIMIZE=1 - Re-enable the optimizer pass in T2, stop checking PYTHONUOPSOPTIMIZE - Rename the env var to disable T2 entirely to PYTHON_UOPS_OPTIMIZE (must be explicitly set to 0 to disable) - Fix skipIf conditions on tests in test_opt.py accordingly - Export sym_is_bottom() (for debugging) - Fix various things in the `_BINARY_OP_` specializations in the abstract interpreter: - DECREF(temp) - out-of-space check after sym_new_const() - add sym_matches_type() checks, so even if we somehow reach a binary op with symbolic constants of the wrong type on the stack we won't trigger the type assert
python#116079) This should fix the refleaks bots. (See python#116062 (comment) .)
Bug report
Bug description:
See log files for failure:
https://github.com/python/cpython/actions/runs/8021737661/job/21914497578
An example failure from my Windows machine:
Just because a constant is present, doesn't mean it's the right type. In such a case, I think we should bail from the abstract interpreter, because it's a guaranteed deopt.
E.g.
should become
While
should become
CPython versions tested on:
CPython main branch
Operating systems tested on:
No response
Linked PRs
The text was updated successfully, but these errors were encountered: