From 6c9190c6e35a939ca8c26189e16fe1ea3b57703e Mon Sep 17 00:00:00 2001 From: Andy Ayers Date: Thu, 2 Feb 2023 07:46:50 -0800 Subject: [PATCH] JIT: change profile slop assert to a jitdump note (#81377) 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. --- src/coreclr/jit/fgprofile.cpp | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/src/coreclr/jit/fgprofile.cpp b/src/coreclr/jit/fgprofile.cpp index 9a719e5..5b8e294 100644 --- a/src/coreclr/jit/fgprofile.cpp +++ b/src/coreclr/jit/fgprofile.cpp @@ -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 } } -- 2.7.4