Skip to content
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

Assertion failed 'block->lastNode()->OperGet() == GT_RETFILT' during 'Generate code' (IL size 1480; hash 0x46e9aa75; FullOpts) #85088

Closed
kunalspathak opened this issue Apr 20, 2023 · 6 comments · Fixed by #85420
Assignees
Labels
arch-x86 area-CodeGen-coreclr CLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI os-windows
Milestone

Comments

@kunalspathak
Copy link
Member

Repros on windows x86

Environment:

set COMPlus_JitStress=1

Antigen repro: https://gist.github.com/kunalspathak/13eab94a2e925edd3a39e244d5463a8f

@kunalspathak kunalspathak added arch-x86 os-windows area-CodeGen-coreclr CLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI labels Apr 20, 2023
@ghost ghost added the untriaged New issue has not been triaged by the area owner label Apr 20, 2023
@ghost
Copy link

ghost commented Apr 20, 2023

Tagging subscribers to this area: @JulieLeeMSFT, @jakobbotsch, @kunalspathak
See info in area-owners.md if you want to be subscribed.

Issue Details

Repros on windows x86

Environment:

set COMPlus_JitStress=1

Antigen repro: https://gist.github.com/kunalspathak/13eab94a2e925edd3a39e244d5463a8f

Author: kunalspathak
Assignees: -
Labels:

arch-x86, os-windows, area-CodeGen-coreclr

Milestone: -

@kunalspathak
Copy link
Member Author

@BruceForstall - Can this be related to your recent refactoring work?

@BruceForstall BruceForstall self-assigned this Apr 20, 2023
@BruceForstall BruceForstall added this to the 8.0.0 milestone Apr 20, 2023
@ghost ghost removed the untriaged New issue has not been triaged by the area owner label Apr 20, 2023
@BruceForstall
Copy link
Member

@BruceForstall - Can this be related to your recent refactoring work?

Unknown, but I'll take a look

@BruceForstall
Copy link
Member

This doesn't fail in the current main, but does fail with a tree from several days ago (e.g., 3713168). I'm assuming that some recent JIT change perturbed the IR but didn't actually fix the issue.

@BruceForstall
Copy link
Member

@jakobbotsch This is due to physical promotion. I didn't know physical promotion was part of our usual stress mix at this point; is that appropriate?

On x86, GT_RETFILT must be the last operation of a filter/finally return. But it appears physical promotion inserts a "read back" after the RETFILT node:

*** NYI: Conservatively marked as read-back
STMT00096 ( 0x344[E-] ... 0x344 )
               [000568] -----------                         *  RETFILT   void
Reading back replacement V11.[000..004) -> V98 at the end of BB35

Note; the IR dump after the phase is:

***** BB35
STMT00096 ( 0x344[E-] ... 0x344 )
               [000568] -----------                         *  RETFILT   void

***** BB35
STMT00191 ( ??? ... ??? )
               [001190] -A---------                         *  ASG       int
               [001188] D------N---                         +--*  LCL_VAR   int    V98 tmp78
               [001189] -----------                         \--*  LCL_FLD   int    V11 loc10        [+0]

but the STMT00191 and [001190] and related nodes do not appear in the dump before this location. It would be helpful to dump them when they are created so it's more obvious to see who is creating them and why.

As mentioned above, this doesn't fail in main. Has it been intentionally fixed, or did IR perturbations make it "go away"?

@jakobbotsch
Copy link
Member

@jakobbotsch This is due to physical promotion. I didn't know physical promotion was part of our usual stress mix at this point; is that appropriate?

It is meant to be fully functional (but maybe not profitable), so I'd say so.

On x86, GT_RETFILT must be the last operation of a filter/finally return. But it appears physical promotion inserts a "read back" after the RETFILT node:

*** NYI: Conservatively marked as read-back
STMT00096 ( 0x344[E-] ... 0x344 )
               [000568] -----------                         *  RETFILT   void
Reading back replacement V11.[000..004) -> V98 at the end of BB35

Note; the IR dump after the phase is:

***** BB35
STMT00096 ( 0x344[E-] ... 0x344 )
               [000568] -----------                         *  RETFILT   void

***** BB35
STMT00191 ( ??? ... ??? )
               [001190] -A---------                         *  ASG       int
               [001188] D------N---                         +--*  LCL_VAR   int    V98 tmp78
               [001189] -----------                         \--*  LCL_FLD   int    V11 loc10        [+0]

but the STMT00191 and [001190] and related nodes do not appear in the dump before this location. It would be helpful to dump them when they are created so it's more obvious to see who is creating them and why.

Makes sense, I will make sure to dump these when they are created. FWIW, physical promotion just uses fgInsertStmtNearEnd, so it seems that helper is lacking handling for these blocks. I'll fix it.

As mentioned above, this doesn't fail in main. Has it been intentionally fixed, or did IR perturbations make it "go away"?

#85105 may have altered the IR as a side effect.

jakobbotsch added a commit to jakobbotsch/runtime that referenced this issue Apr 26, 2023
Also add some logging for read backs in physical promotion.

Fix dotnet#85088
@ghost ghost added the in-pr There is an active PR which will close this issue when it is merged label Apr 26, 2023
jakobbotsch added a commit that referenced this issue Apr 27, 2023
Also add some logging for read backs in physical promotion.

Fix #85088
@ghost ghost removed the in-pr There is an active PR which will close this issue when it is merged label Apr 27, 2023
@ghost ghost locked as resolved and limited conversation to collaborators May 27, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
arch-x86 area-CodeGen-coreclr CLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI os-windows
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants