Skip to content
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

JIT: fix count reconstruction problem #100385

Merged
merged 2 commits into from
Mar 28, 2024
Merged
Show file tree
Hide file tree
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: 11 additions & 0 deletions src/coreclr/jit/fgprofilesynthesis.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1289,6 +1289,12 @@ void ProfileSynthesis::GaussSeidelSolver()
residual = change;
residualBlock = block;
}

if (newWeight >= maxCount)
{
JITDUMP("count overflow in " FMT_BB ": " FMT_WT "\n", block->bbNum, newWeight);
m_overflow = true;
}
}

// If there were no improper headers, we will have converged in one pass.
Expand All @@ -1312,6 +1318,11 @@ void ProfileSynthesis::GaussSeidelSolver()
break;
}

if (m_overflow)
{
break;
}

// If we have been iterating for a bit, estimate the dominant GS
// eigenvalue. (we might want to start with Jacobi iterations
// to get the Jacobi eigenvalue instead).
Expand Down
2 changes: 2 additions & 0 deletions src/coreclr/jit/fgprofilesynthesis.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ class ProfileSynthesis
static constexpr weight_t ilNextLikelihood = 0.52;
static constexpr weight_t loopBackLikelihood = 0.9;
static constexpr weight_t loopExitLikelihood = 0.9;
static constexpr weight_t maxCount = 1e12;

void Run(ProfileSynthesisOption option);

Expand Down Expand Up @@ -84,6 +85,7 @@ class ProfileSynthesis
unsigned m_improperLoopHeaders = 0;
unsigned m_cappedCyclicProbabilities = 0;
bool m_approximate = false;
bool m_overflow = false;
};

#endif // !_FGPROFILESYNTHESIS_H_
Loading