-
-
Notifications
You must be signed in to change notification settings - Fork 5.7k
inference: fix precision regression #37365
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
Conversation
While in 1d08d70 we wanted to avoid combining two types, we did not intend to prevent a type from being just a pass-through value.
|
Backporting this doesn't pass the added test https://build.julialang.org/#/builders/71/builds/3148/steps/5/logs/stdio. Should we just not backport it then? |
|
Should rather try to figure out how to make them pass, as they used to on 1.4, so this fixes a real regression. |
|
Help appreciated :P |
|
On 1.5, we're getting a (typea === Union{} || typea === NOT_FOUND) && return typeb
(typeb === Union{} || typeb === NOT_FOUND) && return typeamakes the test pass. But I'm not sure that is valid. I'm also not sure the |
|
Prior to 1d08d70 we had typea === NOT_FOUND && return typeb
typeb === NOT_FOUND && return typea
typea === Union{} && return typeb
typeb === Union{} && return typeaOn master, we seem to no longer see a |
|
Aha, alternatively I guess we could backport this part of dcc0696: --- a/base/compiler/inferencestate.jl
+++ b/base/compiler/inferencestate.jl
@@ -210,7 +210,10 @@ update_valid_age!(edge::InferenceState, sv::InferenceState) = update_valid_age!(
function record_ssa_assign(ssa_id::Int, @nospecialize(new), frame::InferenceState)
old = frame.src.ssavaluetypes[ssa_id]
if old === NOT_FOUND || !(new ⊑ old)
- frame.src.ssavaluetypes[ssa_id] = tmerge(old, new)
+ # typically, we expect that old ⊑ new (that output information only
+ # gets less precise with worse input information), but to actually
+ # guarantee convergence we need to use tmerge here to ensure that is true
+ frame.src.ssavaluetypes[ssa_id] = old === NOT_FOUND ? new : tmerge(old, new)
W = frame.ip
s = frame.stmt_types
for r in frame.ssavalue_uses[ssa_id] |
|
Okay, I backported that part. Let's see how the tests do after that. |
While in 1d08d70 we wanted to avoid combining two types, we did not intend to prevent a type from being just a pass-through value.