Skip to content

[libraries-pgo]: Assertion failed 'fgDominate(head, entry)' in 'System.Text.Encoding:GetByteCount(System.String,int,int):int:this' during 'Hoist loop code' (IL size 109; hash 0x10278d31; Tier1) #70802

Description

@AndyAyersMS

Forking from #70569, see that issue for details.

Activity

  1. ghost added
    area-CodeGen-coreclr
    on Jun 16, 2022
  2. ghost added
    untriaged
    on Jun 16, 2022
  3. self-assigned this
    on Jun 16, 2022
  4. added this to the 7.0.0 milestone on Jun 16, 2022
  5. ghost removed
    untriaged
    on Jun 16, 2022
  6. ghost added
    in-pr
    on Jun 16, 2022
  7. ghost removed
    in-pr
    on Jun 16, 2022
  8. ghost added
    in-pr
    on Jun 16, 2022
  9. added a commit that references this issue on Jun 17, 2022
    e3a2097
  10. ghost removed
    in-pr
    on Jun 17, 2022
  11. jakobbotsch commented on Jun 18, 2022

    @jakobbotsch
    Member

    Still seeing this assert in the latest libraries-pgo run.

    Pipeline run: https://dev.azure.com/dnceng/public/_build/results?buildId=1832440&view=results
    Helix job name: net7.0-Linux-Release-arm64-CoreCLR_checked-fullpgo_random_edge
    Work item: System.Text.Encoding.Tests
    Console log: https://helixre107v0xdeko0k025g8.blob.core.windows.net/dotnet-runtime-refs-heads-main-d09ca73c69e646cfbe/System.Text.Encoding.Tests/1/console.ef9d5662.log?helixlogtype=result

  12. AndyAyersMS commented on Jun 18, 2022

    @AndyAyersMS
    MemberAuthor

    Hmm, ok. Will investigate.

  13. AndyAyersMS commented on Jun 19, 2022

    @AndyAyersMS
    MemberAuthor

    We decide to clone this fairly complex loop because

    Loop L00 has invariant type test [000577] on V17 ...  passed profile screening
    

    image

    However, we don't get this right, and after cloning there is now a path from cloning conditions to the slow loop (on the left) over to the fast loop. The edge from BB71->BB72 is problematic; it looks like we didn't clone this subgroup of blocks but instead shared it.

    Because of this the fast loop entry BB37 is not dominated by its header BB17, hence the assert.

    image

  14. AndyAyersMS commented on Jun 19, 2022

    @AndyAyersMS
    MemberAuthor
    Hmm, seems fairly clear where things go off the rails.
    L00: couldn't find init/test/incr; not LPFLG_ITER loop
    Recorded loop L00, from BB15 to BB40 (Head=BB14, Entry=BB34, Exit=BB40)
    

    At left is a simplified linear view, where it is a bit easier to see what's going wrong. We see a middle-entry BB34, top BB15, bottom BB40.

    So L00 has some non-loop backedges incident on its entry, and we don't canonicalize that case (we only canonicalize for top).

    If we did, we'd produce something like the graph at right, where BB34_A is the block added by canonicalizing BB34 to hoist out the non-loop backedges. Then we could safely clone.

  15. added a commit that references this issue on Jun 19, 2022
    a061cfa
  16. ghost added
    in-pr
    on Jun 19, 2022
  17. added a commit that references this issue on Jun 21, 2022
    925e26e
  18. ghost removed
    in-pr
    on Jun 21, 2022
  19. added a commit that references this issue on Jun 23, 2022
  20. ghost locked as resolved and limited conversation to collaborators on Jul 22, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

area-CodeGen-coreclr

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions