-
Notifications
You must be signed in to change notification settings - Fork 5k
JIT: revised fix for fp division issue in profile synthesis #115005
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
Conversation
The previous fix dotnet#113396 could still leave us trying to evaluate 0.0/0.0, which causes an invalid FP operation exception. Make sure the divisor is non-zero.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR revises the fix for an FP division issue in profile synthesis to ensure that a division by an extremely small value (or zero) is avoided.
- Replaces previous conditional logic with a call to max(oldWeight, 1e-12).
- Simplifies the calculation of blockRelResidual using a lower bound threshold.
Comments suppressed due to low confidence (1)
src/coreclr/jit/fgprofilesynthesis.cpp:1394
- Ensure that the use of max() correctly handles cases where oldWeight might be negative, if such cases are possible, to prevent unintended behavior.
weight_t const blockRelResidual = change / max(oldWeight, 1e-12);
@dotnet/jit-contrib PTAL No diffs. Verified a port of this to 9.0 fixes the issue. |
Tagging subscribers to this area: @JulieLeeMSFT, @jakobbotsch |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
curious if you could use FLT_MIN
from include <float.h>
but looks like it doesn't make much sense
Yeah we don't want to divide by anything super-small, just small. |
/backport to release/9.0-staging |
Started backporting to release/9.0-staging: https://github.com/dotnet/runtime/actions/runs/14653363543 |
The previous fix #113396 could still leave us trying to evaluate 0.0/0.0, which causes an invalid FP operation exception.
Make sure the divisor is non-zero.