-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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
Program throws ArgumentOutOfRangeException in Release #88091
Comments
Deleted the bot comment since it contained the large source code example and was bogging down viewing the bug. |
Still not seeing a really clean fix here.
|
Btw, when I was investigating this I limitted RBO to only run for one specific BB only (the one that cuased problems) and only do Jump-threading-Phi on it to minimze unrelated code movement, but maybe it's what you did here as well |
Diffs from blocking
https://gist.github.com/AndyAyersMS/5f8bd9ce5f68d55e94346da3da76db98 |
If phi-based RBO bypasses a block with a memory PHI, it is possible for CSE to find invalid memory-based CSEs. An example of this is seen in the attached test case. Ideally perhaps CSE would kill availability of these CSEs at the point where memory can change, but that seems difficult to arrange. Instead, we mark the bypased block as one that will not propagate any incoming CSEs, as the failures we know of require CSEs to flow back through this block. Fixes dotnet#88091.
I am going to test out an alternate fix, where if RBO bypasses a block with memory PHI, we mark that block so that it kills off any incoming CSEs. This seems fairly surgical but also a bit harder to justify as a solid fix. The assumption here is that this issue can only arise if there is a path from one CSE instance to another that passes through a memory PHI, so if we block propagation of all CSEs then that second instance will not be a use of the first. Ideally perhaps we'd kill off only the impacted CSEs, but that seems harder to do... |
@AndyAyersMS I am confused by one thing in the memory SSA picture: How does the |
It is a result of the BB10->BB03->BB10 path where the code can (apparently) loop around without modifying memory. |
Note that when we actually value number BB10 we won't have that VN available, but the VN memory phis hold only the SSA numbers, not the value numbers, so after the fact we can't be sure which VNs where there already when building the phi, and which weren't. |
If phi-based RBO bypasses a block with a memory PHI, it is possible for CSE to find invalid memory-based CSEs. An example of this is seen in the attached test case. Ideally perhaps CSE would kill availability of these CSEs at the point where memory can change, but that seems difficult to arrange. Instead, we mark the bypased block as one that will not propagate any incoming CSEs, as the failures we know of require CSEs to flow back through this block. Fixes #88091.
The following program throws
ArgumentOutOfRangeException
in Release and finishes normally in Debug:https://gist.github.com/EgorBo/bdd1c3c2c65a80681e96f840df40cd2a
cc @AndyAyersMS @dotnet/jit-contrib
The text was updated successfully, but these errors were encountered: