-
Notifications
You must be signed in to change notification settings - Fork 0
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
SwiftShader: Infinite Loop #8
Comments
@Jack-Clark, below I've attached the graph: all blocks are structurally reachable. Executing the fleshed, I get this:
In the last line of the amber file, I would have expected to see something like |
The error is very strange: it says that instead of 9 it should be 0 in the last line. And if you replace the last line with: In any case, I haven't experienced hangs as you have.
|
Well, @Jack-Clark, what I discovered is that: if the node in the fleshing path happens to be a switch case and merge block of the swich simultaneously and furthermore the switch is the first node of the path, then we get the error. I proved this by changing the merge block to 11, then 8->11 would trigger the error. Also in #7 where the switch 14 can't be the first node of the path, no error is triggered when PS. This holds for #9, too. |
@vili-1 thanks for digging into this.
I reduced the amber code to remove the output related code in some of the blocks to make a simpler bug report, so I have also removed the corresponding block ids in the EXPECT statement. I can post the full amber code if you want?
One thing I have noticed is that the flesher will not add output related instructions to the blocks that are not on the path, so it could be the case that the path is actually 8->10 or 8->11 but this would still be recorded as 8 0 in the output buffer (to detect this you can try changing the initialisation of the output array to have a different value). These different paths could be taken due to the compiler making some assumption about being able to avoid going into the loop starting at 9. The hanging issue may be related to the SwiftShader driver specifically, but it is interesting that you have had some issues on moltenVK.
Just to be clear, are you concerned that this pattern might make the CFG invalid? Otherwise, is it not the case that the bugs are errors in the driver implementation? I'll report the output mismatch (#10) to SwiftShader because it is not related to the pattern. For the segfault (#9), do you know if the driver is allowed to segfault if the spirv is invalid? |
I loaded the SwiftShader in my Mac and now I get no error; just the two warnings below. Very interesting!
|
@Jack-Clark I took another look at this issue and I realised that there is no issue with MoltenVK - I was mislead by some issue about the environmental variables used to swap between drivers not passed correctly to the python shell. But I do get the hanging issue with SwiftShader LLVM10.0, and this happens only for paths with prefix 8->9 |
Executing
amber -t spv1.3 -v 1.1 reduced-infinite-loop.amber
hangs presumably due to an infinite loop. I can reproduce this on master (commit d15c42482).Here is the reduced amber code:
I can't get rid of the input load and output store in
SH0
or the input load inLH0
.@vili-1
validCFG/Block$0
looks structurally reachable to me. Do you think this is related to the issue mentioned previously?The text was updated successfully, but these errors were encountered: