Skip to content

Commit

Permalink
JIT: fix early convergence in profile count solver (dotnet#100552)
Browse files Browse the repository at this point in the history
We have two stopping criteria for the iterative solver: relative and
absolute. The absolute threshold was too high and allowed the solver to
stop with high relative residuals.

Remove the absolute check and just use the relative residual for stopping.

Closes dotnet#100477.
  • Loading branch information
AndyAyersMS authored Apr 3, 2024
1 parent d0023cf commit 5c3bfeb
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/coreclr/jit/fgprofilesynthesis.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1104,7 +1104,6 @@ void ProfileSynthesis::GaussSeidelSolver()
weight_t relResidual = 0;
weight_t oldRelResidual = 0;
weight_t eigenvalue = 0;
weight_t const stopResidual = 0.005;
weight_t const stopRelResidual = 0.002;
BasicBlock* residualBlock = nullptr;
BasicBlock* relResidualBlock = nullptr;
Expand Down Expand Up @@ -1312,9 +1311,9 @@ void ProfileSynthesis::GaussSeidelSolver()
JITDUMP("iteration %u: max rel residual is at " FMT_BB " : " FMT_WT "\n", i, relResidualBlock->bbNum,
relResidual);

// If max residual or relative residual is sufficiently small, then stop.
// If max relative residual is sufficiently small, then stop.
//
if ((residual < stopResidual) || (relResidual < stopRelResidual))
if (relResidual < stopRelResidual)
{
converged = true;
break;
Expand Down

0 comments on commit 5c3bfeb

Please sign in to comment.