You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Libraries pgo, possibly recent regression in weekend runs (I had clean private runs on Friday, but this is PGO so may not always be testing the exact same codegen)
From the dumps it looks like we are somehow the loop we have identified has a back target in the middle of the loop:
IG40: // loop_head
IG42:
IG46:
branch to IG42
However, when I print the Disasm, I don't see so many IGs in the method which makes sense as why this issue is not reproducing. I think in the repro case, there are things getting inlined (due to DOTNET_JitRandom* variables) and I cannot reproduce it because things are not getting inlined, the way they should be to repro it.
I see this was also opened few months ago in #79986, but I was not able to reproduce it and had to close it. That one could have happened for the same reason.
Either we are missing an align instruction for IG63 and instead have it for IG64 or we should be not aligning IG63 / IG64 at all. It is hard to find out from the dumps. I will probably add some asserts in the code that will help us identify the cause, the next time it fails.
#83286 to print the state if this happens. It might be still hard to understand without a jitdump or a repro, but this should still solve some purpose.
Thanks @jakobbotsch . I will check it out. This is linux-arm64 context? I opened #83286 to print some traces, but this would be helpful in finding the root cause.
I was able to repro it on my local machine with that method context. Thanks once again @jakobbotsch . The problem is while optimizing the layout, we compact a block C into block A, where A is a predecessor block of a loop-block B, which gets the backward jump from block C.
We should disable alignment for such blocks whose header comes before the block that needs alignment. I recall @AndyAyersMS fixed similar issue in #70936, but that would need revision. I will submit a fix later tomorrow.
I recall @AndyAyersMS fixed similar issue in #70936, but that would need revision.
The code does it job except that during compaction, we fail to update the bbNatLoopNum of the block into which we are compacting one of the loop block into. Hence, we do not realize that we are visiting a loop block before the top block and fail to mark the loop as "do not align".
Activity
EgorBo commentedon Mar 6, 2023
Still pops up https://helixre8s23ayyeko0k025g8.blob.core.windows.net/dotnet-runtime-refs-pull-81635-merge-3946e758ed51413b8e/System.Runtime.Serialization.Xml.Tests/1/console.c2486033.log?helixlogtype=result
kunalspathak commentedon Mar 6, 2023
Will take a look.
kunalspathak commentedon Mar 10, 2023
@AndyAyersMS - Seems I am not able to repro this because of some randomness introduced? Is there a reliable way to force the situation to reproduce?
kunalspathak commentedon Mar 10, 2023
From the dumps it looks like we are somehow the loop we have identified has a back target in the middle of the loop:
However, when I print the Disasm, I don't see so many IGs in the method which makes sense as why this issue is not reproducing. I think in the repro case, there are things getting inlined (due to
DOTNET_JitRandom*variables) and I cannot reproduce it because things are not getting inlined, the way they should be to repro it.I see this was also opened few months ago in #79986, but I was not able to reproduce it and had to close it. That one could have happened for the same reason.
6 remaining items
kunalspathak commentedon Mar 10, 2023
Either we are missing an align instruction for
IG63and instead have it forIG64or we should be not aligningIG63/IG64at all. It is hard to find out from the dumps. I will probably add some asserts in the code that will help us identify the cause, the next time it fails.kunalspathak commentedon Mar 10, 2023
#83286 to print the state if this happens. It might be still hard to understand without a jitdump or a repro, but this should still solve some purpose.
kunalspathak commentedon Mar 10, 2023
This issue is not reproducible and consistent. I would remove the
blockinglabel.jakobbotsch commentedon Mar 11, 2023
@kunalspathak this repros for me on my Rpi box -- I can try to grab an SPMI context for you.
jakobbotsch commentedon Mar 11, 2023
Attached the context. Taken on bee217f
repro-24844.zip
kunalspathak commentedon Mar 16, 2023
Thanks @jakobbotsch . I will check it out. This is linux-arm64 context? I opened #83286 to print some traces, but this would be helpful in finding the root cause.
jakobbotsch commentedon Mar 16, 2023
Yep.
kunalspathak commentedon Mar 16, 2023
I was able to repro it on my local machine with that method context. Thanks once again @jakobbotsch . The problem is while optimizing the layout, we compact a block
Cinto blockA, whereAis a predecessor block of a loop-blockB, which gets the backward jump from blockC.After optimizing layout:
We should disable alignment for such blocks whose header comes before the block that needs alignment. I recall @AndyAyersMS fixed similar issue in #70936, but that would need revision. I will submit a fix later tomorrow.
kunalspathak commentedon Mar 16, 2023
The code does it job except that during compaction, we fail to update the
bbNatLoopNumof the block into which we are compacting one of the loop block into. Hence, we do not realize that we are visiting a loop block before the top block and fail to mark the loop as "do not align".kunalspathak commentedon Mar 17, 2023
Updated #83286 with the fix.