-
-
Notifications
You must be signed in to change notification settings - Fork 5.7k
Don't look at past partitions when doing inference #59613
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
base: master
Are you sure you want to change the base?
Conversation
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.
Seems like it would fail to compute min world then? I'm confused by this
Yeah, this is probably the wrong fix. Either codegen needs to handle whatever partition structure is causing the problem, or inference can truncate the range in a particular scenario, but needs to be more precise than this. |
It seems quite tricky for codegen to handle this if inference doesn't bound the world age to it's primary world. Because what is happening here is a global that has two partition, one that's visible in the current/world age of the method, and another that isn't. But those partitions have the same RTE (there's a comment there that guard should infer to Union{} but it doesn't), and with the same RTE we merge the partitions expanding the legal world age to the guard validity |
You can extend the rte struct to flag this situation if codegen, can't handle it (although I could of course emit a world age check) but this fix is too aggressive. |
this_rte = query(interp, leaf_binding, leaf_partition) | ||
if @isdefined(rte) | ||
if this_rte === rte | ||
if this_rte === rte && !(is_some_guard(kind) ⊻ is_some_guard(binding_kind(leaf_partition))) # Don't merge from no guard to guard |
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.
The same check should apply to backdated const, which needs to be treated uniformly with guard.
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.
should is_some_guard be true for it?
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.
No, it's not a guard, but there should an is_backdated, which #59735 does add.
We were looking at partitions that could never be reached here, causing odd codegen behaviour.
Fixes some part of #42559