Skip to content

[release/9.0-staging] JIT: revised fix for fp division issue in profile synthesis #115026

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

Open
wants to merge 1 commit into
base: release/9.0-staging
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 3 additions & 8 deletions src/coreclr/jit/fgprofilesynthesis.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1413,14 +1413,9 @@ void ProfileSynthesis::GaussSeidelSolver()
// Note we are using a "point" bound here ("infinity norm") rather than say
// computing the L2-norm of the entire residual vector.
//
weight_t const smallFractionOfChange = 1e-9 * change;
weight_t relDivisor = oldWeight;
if (relDivisor < smallFractionOfChange)
{
relDivisor = smallFractionOfChange;
}

weight_t const blockRelResidual = change / relDivisor;
// Avoid dividing by zero if oldWeight is very small.
//
weight_t const blockRelResidual = change / max(oldWeight, 1e-12);

if ((relResidualBlock == nullptr) || (blockRelResidual > relResidual))
{
Expand Down
Loading