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 'm_compGenTreeID == m_compiler->compGenTreeID' #48495

Closed
BruceForstall opened this issue Feb 19, 2021 · 3 comments · Fixed by #48516
Closed

Assertion failed 'm_compGenTreeID == m_compiler->compGenTreeID' #48495

BruceForstall opened this issue Feb 19, 2021 · 3 comments · Fixed by #48516
Assignees
Labels
area-CodeGen-coreclr CLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI
Milestone

Comments

@BruceForstall
Copy link
Member

After #48364, spmi replay of libraries.crossgen2.windows.x64.checked.mch fails with:

ERROR: Exception thrown: DebugBreak or AV Exception 123
ERROR: main method 28 of size 134 failed to load and compile correctly.
ERROR: Exception thrown: DebugBreak or AV Exception 123
ERROR: main method 24 of size 134 failed to load and compile correctly.
ISSUE: <ASSERT> D:\workspace\_work\1\s\src\coreclr\jit\phase.cpp (47) - Assertion failed 'm_compGenTreeID == m_compiler->compGenTreeID' in '<System-Collections-Generic-IEnumerable<Microsoft-Diagnostics-Tracing-Analysis-TraceProcess>-GetEnumerator>d__8:MoveNext():bool:this' during 'Optimize layout' (IL size 134)
ISSUE: <ASSERT> D:\workspace\_work\1\s\src\coreclr\jit\phase.cpp (47) - Assertion failed 'm_compGenTreeID == m_compiler->compGenTreeID' in '<System-Collections-IEnumerable-GetEnumerator>d__26:MoveNext():bool:this' during 'Optimize layout' (IL size 134)

Also, due to the same PR, libraries.crossgen.windows.x64.checked.mch has a single new "missing" method (possibly expected?)

MISSING: Method context 32558 failed to replay: SuperPMI assertion 'IsFieldStatic->GetIndex(CastHandle(fhld)) != -1' failed ("Didn't find 00000298B1E294A8")

@AndyAyersMS PTAL
cc @dotnet/jit-contrib

@BruceForstall BruceForstall added the area-CodeGen-coreclr CLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI label Feb 19, 2021
@BruceForstall BruceForstall added this to the 6.0.0 milestone Feb 19, 2021
@dotnet-issue-labeler dotnet-issue-labeler bot added the untriaged New issue has not been triaged by the area owner label Feb 19, 2021
@BruceForstall BruceForstall removed the untriaged New issue has not been triaged by the area owner label Feb 19, 2021
@AndyAyersMS
Copy link
Member

Taking a look.

@AndyAyersMS
Copy link
Member

Caused by operand swapping as a side effect of trying to obtain tree costs

 	clrjit.dll!GenTree::GenTree(genTreeOps oper, var_types type, bool largeNode) Line 942	C++
 	[Inline Frame] clrjit.dll!GenTreeIntConCommon::{ctor}(genTreeOps) Line 2925	C++
 	[Inline Frame] clrjit.dll!GenTreeIntCon::{ctor}(var_types) Line 3021	C++
 	clrjit.dll!GenTree::GetVtableForOper(genTreeOps oper) Line 5881	C++
 	clrjit.dll!GenTree::SetVtableForOper(genTreeOps oper) Line 5895	C++
 	clrjit.dll!GenTree::SetOper(genTreeOps oper, GenTree::ValueNumberUpdate vnUpdate) Line 1424	C++
 	clrjit.dll!Compiler::gtSetEvalOrder(GenTree * tree) Line 4378	C++
 	clrjit.dll!Compiler::gtSetEvalOrder(GenTree * tree) Line 3630	C++
>	clrjit.dll!Compiler::fgOptimizeBranch(BasicBlock * bJump) Line 3377	C++

probably not worth plumbing change detection through all this, so likely will just modify optOptimizeLayout to claim it always makes changes.

@AndyAyersMS
Copy link
Member

The missing query comes from value numbering... method name is Enumerator:MoveNext():bool:this so not easy to pin down what assembly this is.

 	superpmi.exe!MethodContext::repIsFieldStatic(CORINFO_FIELD_STRUCT_ * fhld) Line 6418	C++
 	clrjit.dll!GenTree::IsFieldAddr(Compiler * comp, GenTree * * pObj, GenTree * * pStatic, FieldSeqNode * * pFldSeq) Line 17279	C++
 	clrjit.dll!Compiler::optComputeLoopSideEffectsOfBlock(BasicBlock * blk) Line 7963	C++
>	clrjit.dll!Compiler::optComputeLoopNestSideEffects(unsigned int lnum) Line 7818	C++
 	clrjit.dll!Compiler::optComputeLoopSideEffects() Line 7774	C++
 	clrjit.dll!Compiler::fgValueNumber() Line 6073	C++

However, this method has PGO data, so a behavior diff is not unexpected

fgPgoSchema,10
0x000001db75c1d348 {{Offset=0x0000000000000000 InstrumentationKind=NumRuns (0x00000140) ILOffset=0x00000000 ...}, ...}
    [0x00000000]: {Offset=0x0000000000000000 InstrumentationKind=NumRuns (0x00000140) ILOffset=0x00000000 ...}
    [0x00000001]: {Offset=0x0000000000000004 InstrumentationKind=BasicBlockIntCount (0x00000041) ILOffset=0x00000000 ...}
    [0x00000002]: {Offset=0x000000000000000c InstrumentationKind=BasicBlockIntCount (0x00000041) ILOffset=0x00000005 ...}
    [0x00000003]: {Offset=0x0000000000000014 InstrumentationKind=BasicBlockIntCount (0x00000041) ILOffset=0x00000046 ...}
    [0x00000004]: {Offset=0x000000000000001c InstrumentationKind=BasicBlockIntCount (0x00000041) ILOffset=0x0000006e ...}
    [0x00000005]: {Offset=0x0000000000000024 InstrumentationKind=BasicBlockIntCount (0x00000041) ILOffset=0x00000087 ...}
    [0x00000006]: {Offset=0x000000000000002c InstrumentationKind=BasicBlockIntCount (0x00000041) ILOffset=0x00000092 ...}
    [0x00000007]: {Offset=0x0000000000000034 InstrumentationKind=BasicBlockIntCount (0x00000041) ILOffset=0x000000a3 ...}
    [0x00000008]: {Offset=0x000000000000003c InstrumentationKind=BasicBlockIntCount (0x00000041) ILOffset=0x000000ac ...}
    [0x00000009]: {Offset=0x0000000000000044 InstrumentationKind=BasicBlockIntCount (0x00000041) ILOffset=0x000000d5 ...}

AndyAyersMS added a commit to AndyAyersMS/runtime that referenced this issue Feb 19, 2021
This method costs trees, which can in turn modify the IR by swapping operands.
As a result the bool value returned doesn't properly reflect whether any
changes happened.

This impacts proper reporting phase status by `optOptimizeLayout'. Since phase
status just gates post-phase dumps and checks, we'll just claim this phase
always modifies IR.

Fixes dotnet#48495.
@ghost ghost added the in-pr There is an active PR which will close this issue when it is merged label Feb 19, 2021
AndyAyersMS added a commit that referenced this issue Feb 20, 2021
…48516)

This method costs trees, which can in turn modify the IR by swapping operands.
As a result the bool value returned doesn't properly reflect whether any
changes happened.

This impacts proper reporting phase status by `optOptimizeLayout'. Since phase
status just gates post-phase dumps and checks, we'll just claim this phase
always modifies IR.

Add similar workaround for `optInvertLoops`.

Fixes #48494.
Fixes #48495.
@ghost ghost removed the in-pr There is an active PR which will close this issue when it is merged label Feb 20, 2021
@ghost ghost locked as resolved and limited conversation to collaborators Mar 22, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-CodeGen-coreclr CLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants