-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
Workaround an MSVC bug with __libm_sse2_sincos_ #98207
Conversation
Tagging subscribers to this area: @JulieLeeMSFT, @jakobbotsch Issue DetailsThis resolves #98204 There is currently a bug in MSVCRT where
|
CC. @jkoritzinsky and @jkotas, this will somewhat conflict with #98048. I think it'd be good to get this in first as it likely needs backporting to .NET 8 (unintentional regression not caused by us, in API surface that's existed since .NET 6). |
src/tests/JIT/Regression/JitBlue/Runtime_98204/Runtime_98204.cs
Outdated
Show resolved
Hide resolved
Why was this bug missed by our existing SinCos tests? |
Tagging subscribers to this area: @dotnet/area-system-numerics Issue DetailsThis resolves #98204 There is currently a bug in MSVCRT where
|
I'm not exactly "customer" :) |
It looks like Given that its just calling into SVML and SVML provides a dedicated We missed this because we were testing normal input ranges and not testing anything quite so large, effectively relying on the fact that the underlying |
For reference, I found it because I'd implemented a vectorized TensorPrimitives.SinCos and our tests that validate it against the scalar T.SinCos were failing a bunch of tests where we do exercise a wide range of values. |
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.
Thanks
e62ad4a
to
2054b91
Compare
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.
thanks
This resolves #98204
There is currently a bug in MSVCRT where
__libm_sse2_sincos
(which is used byfp:fast
) is trying to rely on the fact thatsin(x + PI / 2) == cos(x)
and so calls into__vdecl_sin2
when it should instead call__vdecl_sincos2
. This causes it to returnsin
for both results given a large enough input, which leads to incorrect results.