-
Notifications
You must be signed in to change notification settings - Fork 116
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
dEQP-VK.graphicsfuzz.complex-nested-loops-and-call #204
Comments
I used a Debug build on dev branch. |
Seems like there is a bug in It happens during the 54th iteration of the inner for loop over machine instructions in
The pass attempts to create a new register and replace the Phi with a new register placed at the end of the block. This is how the machine basic blocks looks at the end of that loop iteration:
After this iteration, the function verifiers complains that the definition doesn't dominate the use. I think that the new value from the MachineSSAUpdater should be placed before the use, instead of at the end of the block, which would require a small modification to the MachineSSAUpdater. I hope that this makes sense and I'd really appreciate some tips/relevant documentation if you have any. I'll resume the investigation tomorrow from this point. |
Hi Jakub I'll pass this on to Matt and Stas (AMD engineers on the compute side), who look like the people most linked with SILowerI1Copies, and see what we get back. |
I haven't been able to do a full analysis on this and will have to take a closer look at the CFG overall. What I can say is that the new value %153 is almost certainly correct where it is (or at least "more correct" than moving it would be). This is because we certainly want a defined value to be used in the V_CNDMASK_B32, since thats what's happens in the original code. That is to say, it seems more likely that the correct fix would be to change the use of %153 into a use of some other newly generated instruction that does dominate. |
This is some confusing shadowing to me; I would assume the second MBB really intended to be the current iterated block, not the predecessor |
Thanks @trenouf! @nhaehnle, @arsenm thank you for looking into this and your insights. |
Fundamentally SILowerI1Copies is a SelectionDAG workaround. In the DAG we don't have the necessary context to know how to treat a boolean value. We use the pseudo register-class VReg_1, and then SILowerI1Copies sorts out when it's appropriate to use a real lane mask for these values. |
Stas said: If it did replace %153 with %584 it should probably also replace its uses with the new %584. I see that COPY left using %153. |
Yes, but the new value %584 does not dominate the use, even if the use gets updated. |
Nicolai said (in reply to Stas's comment): %584 may just be an artefact of how the registers are swapped around in order to erase instructions. |
@kuhar, I've root-caused a first issue to a subtle bug in the MachineSSAUpdater, but there's a follow-on issue that I'm currently looking at. |
@nhaehnle OK. Let me know if you need help with this issue. |
When getValueInMiddleOfBlock happens to be called for a basic block that has no incoming value at all, an IMPLICIT_DEF is inserted in that block via GetValueAtEndOfBlockInternal. This IMPLICIT_DEF must be at the top of its basic block or it will likely not reach the use that the caller intends to insert. TODO: Add a MIR test for SILowerI1Copies Issue: GPUOpen-Drivers/llpc#204
TODO: Add MIR test Issue: GPUOpen-Drivers/llpc#204
@kuhar, the branch here with two simple changes allows the problematic shader to compile: https://github.com/nhaehnle/llvm-project/tree/wip-github-llpc-204 I'm currently travelling and not setup to run amber tests. Could you please check whether those changes fully fix the issue in the dEQP-VK test? |
@nhaehnle Applying the patches seems to fix the issue - MIR verifieas correctly now. |
Summary: When getValueInMiddleOfBlock happens to be called for a basic block that has no incoming value at all, an IMPLICIT_DEF is inserted in that block via GetValueAtEndOfBlockInternal. This IMPLICIT_DEF must be at the top of its basic block or it will likely not reach the use that the caller intends to insert. Issue: GPUOpen-Drivers/llpc#204 Reviewers: arsenm, rampitec Subscribers: jvesely, wdng, hiraditya, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D68183 llvm-svn: 374040
Summary: Issue: GPUOpen-Drivers/llpc#204 Reviewers: arsenm, rampitec Subscribers: kzhuravl, jvesely, wdng, yaxunl, dstuttard, tpr, t-tye, hiraditya, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D68184 llvm-svn: 374041
Summary: When getValueInMiddleOfBlock happens to be called for a basic block that has no incoming value at all, an IMPLICIT_DEF is inserted in that block via GetValueAtEndOfBlockInternal. This IMPLICIT_DEF must be at the top of its basic block or it will likely not reach the use that the caller intends to insert. Issue: GPUOpen-Drivers/llpc#204 Reviewers: arsenm, rampitec Subscribers: jvesely, wdng, hiraditya, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D68183 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@374040 91177308-0d34-0410-b5e6-96231b3b80d8
Summary: Issue: GPUOpen-Drivers/llpc#204 Reviewers: arsenm, rampitec Subscribers: kzhuravl, jvesely, wdng, yaxunl, dstuttard, tpr, t-tye, hiraditya, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D68184 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@374041 91177308-0d34-0410-b5e6-96231b3b80d8
Summary: When getValueInMiddleOfBlock happens to be called for a basic block that has no incoming value at all, an IMPLICIT_DEF is inserted in that block via GetValueAtEndOfBlockInternal. This IMPLICIT_DEF must be at the top of its basic block or it will likely not reach the use that the caller intends to insert. Issue: GPUOpen-Drivers/llpc#204 Reviewers: arsenm, rampitec Subscribers: jvesely, wdng, hiraditya, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D68183 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@374040 91177308-0d34-0410-b5e6-96231b3b80d8
Summary: Issue: GPUOpen-Drivers/llpc#204 Reviewers: arsenm, rampitec Subscribers: kzhuravl, jvesely, wdng, yaxunl, dstuttard, tpr, t-tye, hiraditya, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D68184 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@374041 91177308-0d34-0410-b5e6-96231b3b80d8
@amdrexu @paulthomson @kuhar We should probably close this issue given that the fix has gone into upstream LLVM, but I don't seem to have the rights to actually do that. |
Or we could close it when the LLVM version is updated, possibly adding a "fixed in LLVM" label in the meantime (or something like that). We don't have continuous running of these tests yet, but when we do, the automation could create/re-open issues like this one automatically unless the dev branch is passing. |
This still seems to fail. |
This appears to be fixed. |
Summary: When getValueInMiddleOfBlock happens to be called for a basic block that has no incoming value at all, an IMPLICIT_DEF is inserted in that block via GetValueAtEndOfBlockInternal. This IMPLICIT_DEF must be at the top of its basic block or it will likely not reach the use that the caller intends to insert. Issue: GPUOpen-Drivers/llpc#204 Reviewers: arsenm, rampitec Subscribers: jvesely, wdng, hiraditya, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D68183 llvm-svn: 374040
Summary: Issue: GPUOpen-Drivers/llpc#204 Reviewers: arsenm, rampitec Subscribers: kzhuravl, jvesely, wdng, yaxunl, dstuttard, tpr, t-tye, hiraditya, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D68184 llvm-svn: 374041
This test fails. To reproduce:
amdllpc -gfxip=9.0.0 -verify-ir -o temp.out *.spv
complex-nested-loops-and-call.zip
The text was updated successfully, but these errors were encountered: