Skip to content

Commit

Permalink
JIT: change profile slop assert to a jitdump note (#81377)
Browse files Browse the repository at this point in the history
Stop asserting if we see unusually large discrepancies in the outgoing profile
flow from a block. Instead just make a note in the jit dump.

Fixes #77450.
  • Loading branch information
AndyAyersMS authored Feb 2, 2023
1 parent 6aa9f8b commit 6c9190c
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions src/coreclr/jit/fgprofile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4186,11 +4186,24 @@ PhaseStatus Compiler::fgComputeEdgeWeights()
#ifdef DEBUG
// Now edge->flEdgeWeightMin and otherEdge->flEdgeWeightMax) should add up to bSrc->bbWeight
diff = bSrc->bbWeight - (edge->edgeWeightMin() + otherEdge->edgeWeightMax());
assert(((-slop) <= diff) && (diff <= slop));

if (!((-slop) <= diff) && (diff <= slop))
{
JITDUMP("Edge weight discrepancy: " FMT_BB "[" FMT_WT "] -> {" FMT_BB "[min:" FMT_WT
"], " FMT_BB "[max: " FMT_WT "]} diff " FMT_WT " exceeds slop " FMT_WT "\n",
bSrc->bbNum, bSrc->bbWeight, bDst->bbNum, edge->edgeWeightMin(), otherDst->bbNum,
otherEdge->edgeWeightMax(), diff, slop);
}

// Now otherEdge->flEdgeWeightMin and edge->flEdgeWeightMax) should add up to bSrc->bbWeight
diff = bSrc->bbWeight - (otherEdge->edgeWeightMin() + edge->edgeWeightMax());
assert(((-slop) <= diff) && (diff <= slop));
if (!((-slop) <= diff) && (diff <= slop))
{
JITDUMP("Edge weight discrepancy: " FMT_BB "[" FMT_WT "] -> {" FMT_BB "[max:" FMT_WT
"], " FMT_BB "[min: " FMT_WT "]} diff " FMT_WT " exceeds slop " FMT_WT "\n",
bSrc->bbNum, bSrc->bbWeight, bDst->bbNum, edge->edgeWeightMax(), otherDst->bbNum,
otherEdge->edgeWeightMin(), diff, slop);
}
#endif // DEBUG
}
}
Expand Down

0 comments on commit 6c9190c

Please sign in to comment.