Skip to content

Commit

Permalink
JIT: assert if we see schema mismatches with dynamic pgo data
Browse files Browse the repository at this point in the history
When the profile data comes from dynamic PGO, the spanning tree encoded in the
schema produced by an earlier tier should exactly match the spanning tree for
the current jit attempt, since the JIT and method IL are identical.

(This is not the case for static PGO; that schema may have come from a different
JIT and/or different version of IL).

Note in release modes we won't assert; instead, we will silently throw the PGO
data away.

Follow-on change to dotnet#85805 to catch more issues like dotnet#85799.
  • Loading branch information
AndyAyersMS committed May 7, 2023
1 parent 7c75cbf commit b5f3d79
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/coreclr/jit/fgprofile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3297,6 +3297,15 @@ void EfficientEdgeCountReconstructor::Prepare()
//
void EfficientEdgeCountReconstructor::Solve()
{
// If we have dynamic PGO data, we don't expect to see any mismatches,
// since the schema we got from the runtime should have come from the
// exact same JIT and IL, created in an earlier tier.
//
if (m_comp->fgPgoSource == ICorJitInfo::PgoSource::Dynamic)
{
assert(!m_mismatch);
}

// If issues arose earlier, then don't try solving.
//
if (m_badcode || m_mismatch || m_allWeightsZero)
Expand Down

0 comments on commit b5f3d79

Please sign in to comment.