Workaround an MSVC bug with __libm_sse2_sincos_#98207
Workaround an MSVC bug with __libm_sse2_sincos_#98207tannergooding merged 7 commits intodotnet:mainfrom
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. |
e62ad4a to
2054b91
Compare
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_sin2when it should instead call__vdecl_sincos2. This causes it to returnsinfor both results given a large enough input, which leads to incorrect results.