Skip to content

Assertion failed '(igInLoop->igLoopBackEdge == nullptr) || (igInLoop->igLoopBackEdge == igLoopHeader)' #82729

Closed

Description

@AndyAyersMS

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)

https://dev.azure.com/dnceng-public/public/_build/results?buildId=185788&view=ms.vss-test-web.build-test-results-tab

export DOTNET_TieredCompilation=1
export DOTNET_DbgEnableMiniDump=1
export DOTNET_EnableCrashReport=1
export DOTNET_DbgMiniDumpName=$HELIX_DUMP_FOLDER/coredump.%d.dmp
export DOTNET_ReadyToRun=0
export DOTNET_TC_QuickJitForLoops=1
export DOTNET_TieredPGO=1
export DOTNET_JitRandomGuardedDevirtualization=1
export DOTNET_JitRandomEdgeCounts=1
export DOTNET_JitRandomlyCollect64BitCounts=1

dotnet exec --runtimeconfig System.Runtime.Serialization.Xml.Tests.runtimeconfig.json --depsfile System.Runtime.Serialization.Xml.Tests.deps.json xunit.console.dll System.Runtime.Serialization.Xml.Tests.dll -xml testResults.xml -nologo -nocolor -notrait category=IgnoreForCI -notrait category=OuterLoop -notrait category=failing 
popd
===========================================================================================================
/root/helix/work/workitem/e /root/helix/work/workitem/e
  Discovering: System.Runtime.Serialization.Xml.Tests (method display = ClassAndMethod, method display options = None)
  Discovered:  System.Runtime.Serialization.Xml.Tests (found 278 of 279 test cases)
  Starting:    System.Runtime.Serialization.Xml.Tests (parallel test collections = on, max threads = 2)

Assert failure(PID 27 [0x0000001b], Thread: 33 [0x0021]): Assertion failed '(igInLoop->igLoopBackEdge == nullptr) || (igInLoop->igLoopBackEdge == igLoopHeader)' in 'System.Enum:TryParseByValueOrName[int](System.RuntimeType,System.ReadOnlySpan`1[ushort],bool,bool,byref):bool' during 'Generate code' (IL size 724; hash 0xef12aa33; Tier1)

    File: /__w/1/s/src/coreclr/jit/emit.cpp Line: 5713
    Image: /root/helix/work/correlation/dotnet

Activity

  1. ghost added
    area-CodeGen-coreclr
    on Feb 27, 2023
  2. ghost added
    untriaged
    on Feb 27, 2023
  3. added and removed
    area-CodeGen-coreclr
    untriaged
    on Feb 27, 2023
  4. self-assigned this
    on Feb 27, 2023
  5. added
    area-CodeGen-coreclr
    on Feb 28, 2023
  6. added this to the 8.0.0 milestone on Mar 4, 2023
  7. added
    blocking-clean-ci-optional
    on Mar 4, 2023
  8. kunalspathak commented on Mar 6, 2023

    @kunalspathak
    Contributor

    Will take a look.

  9. kunalspathak commented on Mar 10, 2023

    @kunalspathak
    Contributor

    @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?

    image

  10. kunalspathak commented on Mar 10, 2023

    @kunalspathak
    Contributor

    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.

  11. 6 remaining items

  12. kunalspathak commented on Mar 10, 2023

    @kunalspathak
    Contributor

    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.

  13. kunalspathak commented on Mar 10, 2023

    @kunalspathak
    Contributor

    #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.

  14. kunalspathak commented on Mar 10, 2023

    @kunalspathak
    Contributor

    This issue is not reproducible and consistent. I would remove the blocking label.

  15. removed
    blocking-clean-ci-optional
    on Mar 10, 2023
  16. jakobbotsch commented on Mar 11, 2023

    @jakobbotsch
    Member

    @kunalspathak this repros for me on my Rpi box -- I can try to grab an SPMI context for you.

  17. jakobbotsch commented on Mar 11, 2023

    @jakobbotsch
    Member

    Attached the context. Taken on bee217f

    repro-24844.zip

  18. kunalspathak commented on Mar 16, 2023

    @kunalspathak
    Contributor

    Attached the context. Taken on bee217f

    repro-24844.zip

    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.

  19. jakobbotsch commented on Mar 16, 2023

    @jakobbotsch
    Member

    This is linux-arm64 context?

    Yep.

  20. kunalspathak commented on Mar 16, 2023

    @kunalspathak
    Contributor

    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.

    Block_A:
    
    Block_B:            ; needs alignment
    
    
    Block_C:
    
        branch Block_B
    

    After optimizing layout:

    
    Block_A_C:
    
        FALL_THROUGH
    Block B:                 ; needs alignment
    
    
    Block NEW_BLOCK:
    
       branch Block_A_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.

  21. kunalspathak commented on Mar 16, 2023

    @kunalspathak
    Contributor

    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".

  22. kunalspathak commented on Mar 17, 2023

    @kunalspathak
    Contributor

    Updated #83286 with the fix.

  23. ghost added
    in-pr
    on Mar 17, 2023
  24. ghost removed
    in-pr
    on Mar 20, 2023
  25. ghost locked as resolved and limited conversation to collaborators on Apr 19, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

arch-arm64area-CodeGen-coreclr

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions