JIT: revised fix for fp division issue in profile synthesis#115005
JIT: revised fix for fp division issue in profile synthesis#115005AndyAyersMS merged 1 commit intodotnet:mainfrom
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.
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 |
EgorBo
left a comment
There was a problem hiding this comment.
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.