Skip to content

System.Numerics.Tensors.Net8.Tests does not appear to actually run against .NET 8 #101846

@tannergooding

Description

@tannergooding

As per the title, the System.Numerics.Tensors.Net8.Tests do not appear to currently be running against .NET 8 as intended. Instead, they are compiled for .NET 8 and appear to be running on the .NET 9 runtime via the roll forward mechanism.

This can be seen in one of the CI legs for #101800 where the Net8.Tests project has the following failure:

System.Numerics.Tensors.Tests.SingleGenericTensorPrimitives.SpanDestinationFunctions_SpecialValues(tensorPrimitivesMethod: SpanDestinationDelegate { Method = Void ReciprocalSqrtEstimate[Single](System.ReadOnlySpan`1[System.Single], System.Span`1[System.Single]), Target = null }, expectedMethod: Func`2 { Method = Single ReciprocalSqrtEstimate(Single), Target = null }, tolerance: 0.01171875) [FAIL]
      Assert.All() Failure: 253 out of 256 items in the collection did not pass.
      [3]:   Item:  4
             Error: Assert.All() Failure: 9 out of 24 items in the collection did not pass.
                    [12]: Item:  -1.40129846E-45
                          Error: Assert.Equal() Failure: Values differ
                                 Expected: NaN
                                 Actual:   -∞

The actual test is comparing the result of the TensorPrimitives.ReciprocalSqrtEstimate function against the in-box float.ReciprocalSqrtEstimate API. On .NET 8, the float version will call into Sse.ReciprocalSqrtScalar which treats subnormal values as flush-to-zero and therefore does 1 / Sqrt(-0.0f) which returns -∞, however the expected value is NaN indicated that the float version isntead called into Avx512F.Reciprocal14SqrtScalar which handles all non-zero negatives as properly negative and thus is doing 1 / Sqrt(nonZeroNegative) which returns NaN. This highlights that it is actually running against .NET 9 and not testing what we think it should be testing.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions