Skip to content
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

System.Numerics.Tensors.Tests.SingleGenericTensorPrimitives.SpanScalarDestination_SpecialValues fails under jitstress on win-x86 #102335

Closed
jakobbotsch opened this issue May 16, 2024 · 27 comments · Fixed by #103680
Assignees
Labels
area-CodeGen-coreclr CLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI blocking-clean-ci-optional Blocking optional rolling runs
Milestone

Comments

@jakobbotsch
Copy link
Member

Example pipeline rune: https://dev.azure.com/dnceng-public/public/_build/results?buildId=677384&view=ms.vss-test-web.build-test-results-tab
Example console log: https://helixre107v0xdcypoyl9e7f.blob.core.windows.net/dotnet-runtime-refs-pull-102261-merge-6809f596adec438f97/System.Numerics.Tensors.Tests/1/console.2b07caea.log?helixlogtype=result

  Starting:    System.Numerics.Tensors.Tests (parallel test collections = on [4 threads], stop on fail = off)
    System.Numerics.Tensors.Tests.SingleGenericTensorPrimitives.SpanScalarDestination_SpecialValues(tensorPrimitivesMethod: SpanScalarDestinationDelegate`3 { Method = Void MinNumber[Single](System.ReadOnlySpan`1[System.Single], Single, System.Span`1[System.Single]), Target = null }, expectedMethod: Func`3 { Method = Single MinNumber(Single, Single), Target = null }, tolerance: null) [FAIL]
      Assert.All() Failure: 240 out of 256 items in the collection did not pass.
      [16]:  Item:  17
             Error: Assert.All() Failure: 24 out of 24 items in the collection did not pass.
                    [0]:  Item:  NaN
                          Error: Assert.Equal() Failure: Values differ
                                 Expected: 0.735287189
                                 Actual:   0.805774391
                    [1]:  Item:  NaN
                          Error: Assert.Equal() Failure: Values differ
                                 Expected: 0.735287189
                                 Actual:   0.805774391
                    [2]:  Item:  NaN
                          Error: Assert.Equal() Failure: Values differ
                                 Expected: 0.735287189
                                 Actual:   NaN

cc @tannergooding

There are also failures in NonGenericSingleTensorPrimitivesTests.CosineSimilarity_AllLengths in this pipeline run for win-x64.

@dotnet-issue-labeler dotnet-issue-labeler bot added the needs-area-label An area label is needed to ensure this gets routed to the appropriate area owners label May 16, 2024
@dotnet-policy-service dotnet-policy-service bot added the untriaged New issue has not been triaged by the area owner label May 16, 2024
@jakobbotsch jakobbotsch added area-CodeGen-coreclr CLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI blocking-clean-ci-optional Blocking optional rolling runs and removed untriaged New issue has not been triaged by the area owner needs-area-label An area label is needed to ensure this gets routed to the appropriate area owners labels May 16, 2024
@jakobbotsch jakobbotsch added this to the 9.0.0 milestone May 16, 2024
Copy link
Contributor

Tagging subscribers to this area: @JulieLeeMSFT, @jakobbotsch
See info in area-owners.md if you want to be subscribed.

@EgorBo
Copy link
Member

EgorBo commented May 17, 2024

@tannergooding
Copy link
Member

It's interesting that either of those are failing for jitstress runs. JitStress shouldn't impact whether or not something is imported as intrinsic by the JIT and so the actual IR at importation should be the same here.

I'm not going to have time to look at this until after next week (due to Microsoft Build being next week), but I wonder if this is exposing some long-existing issue between FusedMultiplyAdd and the register allocator

@v-wenyuxu
Copy link

Failed in: runtime-coreclr libraries-jitstress 20240522.1

Failed tests:

net9.0-linux-Release-x64-jitstress2_tiered-Ubuntu.2204.Amd64.Open
    - System.Numerics.Tensors.Tests.NonGenericSingleTensorPrimitivesTests.CosineSimilarity_AllLengths
net9.0-linux-Release-x64-jitstress1_tiered-Ubuntu.2204.Amd64.Open
    - System.Numerics.Tensors.Tests.NonGenericSingleTensorPrimitivesTests.CosineSimilarity_AllLengths
    - System.Numerics.Tensors.Tests.SingleGenericTensorPrimitives.CosineSimilarity_AllLengths
net9.0-windows-Release-x64-jitstress1_tiered-Windows.10.Amd64.Open
    - System.Numerics.Tensors.Tests.NonGenericSingleTensorPrimitivesTests.CosineSimilarity_AllLengths
    - System.Numerics.Tensors.Tests.SingleGenericTensorPrimitives.CosineSimilarity_AllLengths
    - System.Numerics.Tensors.Tests.SingleGenericTensorPrimitives.CosineSimilarity_AllLengths
    - System.Numerics.Tensors.Tests.NonGenericSingleTensorPrimitivesTests.CosineSimilarity_AllLengths

Error message:

 Assert.All() Failure: 4 out of 256 items in the collection did not pass.
[3]: Item:  4
     Error: Assert.Equal() Failure: Values differ
            Expected: 0.151808769
            Actual:   0.25312683
[4]: Item:  5
     Error: Assert.Equal() Failure: Values differ
            Expected: 0.253379166
            Actual:   0.138663024
[5]: Item:  6
     Error: Assert.Equal() Failure: Values differ
            Expected: -0.344092488
            Actual:   -0.0114496415
[6]: Item:  7
     Error: Assert.Equal() Failure: Values differ
            Expected: -0.410494238
            Actual:   -0.248638168

Stack trace:

   at System.Numerics.Tensors.Tests.TensorPrimitivesTests`1.CosineSimilarity_AllLengths() in /_/src/libraries/System.Numerics.Tensors/tests/TensorPrimitivesTests.cs:line 740
   at System.RuntimeMethodHandle.InvokeMethod(Object target, Void** arguments, Signature sig, Boolean isConstructor)
   at System.Reflection.MethodBaseInvoker.InvokeWithNoArgs(Object obj, BindingFlags invokeAttr) in /_/src/libraries/System.Private.CoreLib/src/System/Reflection/MethodBaseInvoker.cs:line 57

@v-wenyuxu
Copy link

Failed in: runtime-coreclr libraries-jitstress 20240523.1

Failed tests:

net9.0-linux-Release-x64-jitstress2_tiered-Ubuntu.2204.Amd64.Open
    - System.Numerics.Tensors.Tests.NonGenericSingleTensorPrimitivesTests.CosineSimilarity_AllLengths
    - System.Numerics.Tensors.Tests.SingleGenericTensorPrimitives.CosineSimilarity_AllLengths
    - System.Numerics.Tensors.Tests.NonGenericSingleTensorPrimitivesTests.CosineSimilarity_AllLengths
net9.0-linux-Release-x64-jitstress1_tiered-Ubuntu.2204.Amd64.Open
    - System.Numerics.Tensors.Tests.NonGenericSingleTensorPrimitivesTests.CosineSimilarity_AllLengths
    - System.Numerics.Tensors.Tests.NonGenericSingleTensorPrimitivesTests.CosineSimilarity_AllLengths
net9.0-windows-Release-x64-jitstress1_tiered-Windows.10.Amd64.Open
    - System.Numerics.Tensors.Tests.SingleGenericTensorPrimitives.CosineSimilarity_AllLengths
    - System.Numerics.Tensors.Tests.NonGenericSingleTensorPrimitivesTests.CosineSimilarity_AllLengths
    - System.Numerics.Tensors.Tests.SingleGenericTensorPrimitives.CosineSimilarity_AllLengths
    - System.Numerics.Tensors.Tests.NonGenericSingleTensorPrimitivesTests.CosineSimilarity_AllLengths

Error message:

 Assert.All() Failure: 4 out of 256 items in the collection did not pass.
[3]: Item:  4
     Error: Assert.Equal() Failure: Values differ
            Expected: 0.151808769
            Actual:   0.25312683
[4]: Item:  5
     Error: Assert.Equal() Failure: Values differ
            Expected: 0.253379166
            Actual:   0.138663024
[5]: Item:  6
     Error: Assert.Equal() Failure: Values differ
            Expected: -0.344092488
            Actual:   -0.0114496415
[6]: Item:  7
     Error: Assert.Equal() Failure: Values differ
            Expected: -0.410494238
            Actual:   -0.248638168

Stack trace:

   at System.Numerics.Tensors.Tests.TensorPrimitivesTests`1.CosineSimilarity_AllLengths() in /_/src/libraries/System.Numerics.Tensors/tests/TensorPrimitivesTests.cs:line 740
   at System.RuntimeMethodHandle.InvokeMethod(Object target, Void** arguments, Signature sig, Boolean isConstructor)
   at System.Reflection.MethodBaseInvoker.InvokeWithNoArgs(Object obj, BindingFlags invokeAttr) in /_/src/libraries/System.Private.CoreLib/src/System/Reflection/MethodBaseInvoker.cs:line 57

@v-wenyuxu
Copy link

Failed in: runtime-coreclr libraries-jitstress 20240526.1

Failed tests:

net9.0-linux-Release-x64-jitstress2_tiered-Ubuntu.2204.Amd64.Open
    - System.Numerics.Tensors.Tests.NonGenericSingleTensorPrimitivesTests.CosineSimilarity_AllLengths
net9.0-linux-Release-x64-jitstress1_tiered-Ubuntu.2204.Amd64.Open
    - System.Numerics.Tensors.Tests.SingleGenericTensorPrimitives.CosineSimilarity_AllLengths
net9.0-windows-Release-x64-jitstress1_tiered-Windows.10.Amd64.Open
    - System.Numerics.Tensors.Tests.SingleGenericTensorPrimitives.CosineSimilarity_AllLengths
    - System.Numerics.Tensors.Tests.NonGenericSingleTensorPrimitivesTests.CosineSimilarity_AllLengths

Error message:

 Assert.All() Failure: 4 out of 256 items in the collection did not pass.
[3]: Item:  4
     Error: Assert.Equal() Failure: Values differ
            Expected: 0.151808769
            Actual:   0.25312683
[4]: Item:  5
     Error: Assert.Equal() Failure: Values differ
            Expected: 0.253379166
            Actual:   0.138663024
[5]: Item:  6
     Error: Assert.Equal() Failure: Values differ
            Expected: -0.344092488
            Actual:   -0.0114496415
[6]: Item:  7
     Error: Assert.Equal() Failure: Values differ
            Expected: -0.410494238
            Actual:   -0.248638168

Stack trace:

   at System.Numerics.Tensors.Tests.TensorPrimitivesTests`1.CosineSimilarity_AllLengths() in /_/src/libraries/System.Numerics.Tensors/tests/TensorPrimitivesTests.cs:line 740
   at System.RuntimeMethodHandle.InvokeMethod(Object target, Void** arguments, Signature sig, Boolean isConstructor)
   at System.Reflection.MethodBaseInvoker.InvokeWithNoArgs(Object obj, BindingFlags invokeAttr) in /_/src/libraries/System.Private.CoreLib/src/System/Reflection/MethodBaseInvoker.cs:line 57

@v-wenyuxu
Copy link

Failed in: runtime-coreclr libraries-jitstress 20240527.1

Failed tests:

net9.0-linux-Release-x64-jitstress2_tiered-Ubuntu.2204.Amd64.Open
    - System.Numerics.Tensors.Tests.SingleGenericTensorPrimitives.CosineSimilarity_AllLengths
    - System.Numerics.Tensors.Tests.SingleGenericTensorPrimitives.CosineSimilarity_AllLengths
net9.0-linux-Release-x64-jitstress1_tiered-Ubuntu.2204.Amd64.Open
    - System.Numerics.Tensors.Tests.NonGenericSingleTensorPrimitivesTests.CosineSimilarity_AllLengths
    - System.Numerics.Tensors.Tests.NonGenericSingleTensorPrimitivesTests.CosineSimilarity_AllLengths
net9.0-windows-Release-x64-jitstress1_tiered-Windows.10.Amd64.Open
    - System.Numerics.Tensors.Tests.SingleGenericTensorPrimitives.CosineSimilarity_AllLengths
    - System.Numerics.Tensors.Tests.NonGenericSingleTensorPrimitivesTests.CosineSimilarity_AllLengths
    - System.Numerics.Tensors.Tests.NonGenericSingleTensorPrimitivesTests.CosineSimilarity_AllLengths
    - System.Numerics.Tensors.Tests.SingleGenericTensorPrimitives.CosineSimilarity_AllLengths

Error message:

 Assert.All() Failure: 4 out of 256 items in the collection did not pass.
[3]: Item:  4
     Error: Assert.Equal() Failure: Values differ
            Expected: 0.151808769
            Actual:   0.25312683
[4]: Item:  5
     Error: Assert.Equal() Failure: Values differ
            Expected: 0.253379166
            Actual:   0.138663024
[5]: Item:  6
     Error: Assert.Equal() Failure: Values differ
            Expected: -0.344092488
            Actual:   -0.0114496415
[6]: Item:  7
     Error: Assert.Equal() Failure: Values differ
            Expected: -0.410494238
            Actual:   -0.248638168

Stack trace:

   at System.Numerics.Tensors.Tests.TensorPrimitivesTests`1.CosineSimilarity_AllLengths() in /_/src/libraries/System.Numerics.Tensors/tests/TensorPrimitivesTests.cs:line 740
   at System.RuntimeMethodHandle.InvokeMethod(Object target, Void** arguments, Signature sig, Boolean isConstructor)
   at System.Reflection.MethodBaseInvoker.InvokeWithNoArgs(Object obj, BindingFlags invokeAttr) in /_/src/libraries/System.Private.CoreLib/src/System/Reflection/MethodBaseInvoker.cs:line 57

@v-wenyuxu
Copy link

Failed in: runtime-coreclr libraries-jitstress 20240528.1

Failed tests:

net9.0-linux-Release-x64-jitstress2_tiered-Ubuntu.2204.Amd64.Open
    - System.Numerics.Tensors.Tests.SingleGenericTensorPrimitives.CosineSimilarity_AllLengths
net9.0-linux-Release-x64-jitstress1_tiered-Ubuntu.2204.Amd64.Open
    - System.Numerics.Tensors.Tests.NonGenericSingleTensorPrimitivesTests.CosineSimilarity_AllLengths
    - System.Numerics.Tensors.Tests.SingleGenericTensorPrimitives.CosineSimilarity_AllLengths
net9.0-windows-Release-x64-jitstress1_tiered-Windows.10.Amd64.Open
    - System.Numerics.Tensors.Tests.NonGenericSingleTensorPrimitivesTests.CosineSimilarity_AllLengths
    - System.Numerics.Tensors.Tests.SingleGenericTensorPrimitives.CosineSimilarity_AllLengths
    - System.Numerics.Tensors.Tests.SingleGenericTensorPrimitives.CosineSimilarity_AllLengths
    - System.Numerics.Tensors.Tests.NonGenericSingleTensorPrimitivesTests.CosineSimilarity_AllLengths

Error message:

 Assert.All() Failure: 4 out of 256 items in the collection did not pass.
[3]: Item:  4
     Error: Assert.Equal() Failure: Values differ
            Expected: 0.151808769
            Actual:   0.25312683
[4]: Item:  5
     Error: Assert.Equal() Failure: Values differ
            Expected: 0.253379166
            Actual:   0.138663024
[5]: Item:  6
     Error: Assert.Equal() Failure: Values differ
            Expected: -0.344092488
            Actual:   -0.0114496415
[6]: Item:  7
     Error: Assert.Equal() Failure: Values differ
            Expected: -0.410494238
            Actual:   -0.248638168

Stack trace:

   at System.Numerics.Tensors.Tests.TensorPrimitivesTests`1.CosineSimilarity_AllLengths() in /_/src/libraries/System.Numerics.Tensors/tests/TensorPrimitivesTests.cs:line 740
   at System.RuntimeMethodHandle.InvokeMethod(Object target, Void** arguments, Signature sig, Boolean isConstructor)
   at System.Reflection.MethodBaseInvoker.InvokeWithNoArgs(Object obj, BindingFlags invokeAttr) in /_/src/libraries/System.Private.CoreLib/src/System/Reflection/MethodBaseInvoker.cs:line 57

@v-wenyuxu
Copy link

Failed in: runtime-coreclr libraries-jitstress 20240602.1

Failed tests:

net9.0-linux-Release-x64-jitstress1_tiered-Ubuntu.2204.Amd64.Open
    - System.Numerics.Tensors.Tests.NonGenericSingleTensorPrimitivesTests.CosineSimilarity_AllLengths
    - System.Numerics.Tensors.Tests.NonGenericSingleTensorPrimitivesTests.CosineSimilarity_AllLengths
net9.0-linux-Release-x64-jitstress2_tiered-Ubuntu.2204.Amd64.Open
    - System.Numerics.Tensors.Tests.SingleGenericTensorPrimitives.CosineSimilarity_AllLengths
    - System.Numerics.Tensors.Tests.SingleGenericTensorPrimitives.CosineSimilarity_AllLengths
net9.0-windows-Release-x64-jitstress1_tiered-Windows.10.Amd64.Open
    - System.Numerics.Tensors.Tests.SingleGenericTensorPrimitives.CosineSimilarity_AllLengths
    - System.Numerics.Tensors.Tests.NonGenericSingleTensorPrimitivesTests.CosineSimilarity_AllLengths
    - System.Numerics.Tensors.Tests.SingleGenericTensorPrimitives.CosineSimilarity_AllLengths
    - System.Numerics.Tensors.Tests.NonGenericSingleTensorPrimitivesTests.CosineSimilarity_AllLengths

Error message:

 Assert.All() Failure: 4 out of 256 items in the collection did not pass.
[3]: Item:  4
     Error: Assert.Equal() Failure: Values differ
            Expected: 0.151808769
            Actual:   0.25312683
[4]: Item:  5
     Error: Assert.Equal() Failure: Values differ
            Expected: 0.253379166
            Actual:   0.138663024
[5]: Item:  6
     Error: Assert.Equal() Failure: Values differ
            Expected: -0.344092488
            Actual:   -0.0114496415
[6]: Item:  7
     Error: Assert.Equal() Failure: Values differ
            Expected: -0.410494238
            Actual:   -0.248638168

Stack trace:

   at System.Numerics.Tensors.Tests.TensorPrimitivesTests`1.CosineSimilarity_AllLengths() in /_/src/libraries/System.Numerics.Tensors/tests/TensorPrimitivesTests.cs:line 740
   at System.RuntimeMethodHandle.InvokeMethod(Object target, Void** arguments, Signature sig, Boolean isConstructor)
   at System.Reflection.MethodBaseInvoker.InvokeWithNoArgs(Object obj, BindingFlags invokeAttr) in /_/src/libraries/System.Private.CoreLib/src/System/Reflection/MethodBaseInvoker.cs:line 57

@v-wenyuxu
Copy link

Failed in: runtime-coreclr libraries-jitstress 20240603.1

Failed tests:

net9.0-linux-Release-x64-jitstress2_tiered-Ubuntu.2204.Amd64.Open
    - System.Numerics.Tensors.Tests.NonGenericSingleTensorPrimitivesTests.CosineSimilarity_AllLengths
    - System.Numerics.Tensors.Tests.NonGenericSingleTensorPrimitivesTests.CosineSimilarity_AllLengths
net9.0-linux-Release-x64-jitstress1_tiered-Ubuntu.2204.Amd64.Open
    - System.Numerics.Tensors.Tests.SingleGenericTensorPrimitives.CosineSimilarity_AllLengths
    - System.Numerics.Tensors.Tests.NonGenericSingleTensorPrimitivesTests.CosineSimilarity_AllLengths
net9.0-windows-Release-x64-jitstress1_tiered-Windows.10.Amd64.Open
    - System.Numerics.Tensors.Tests.SingleGenericTensorPrimitives.CosineSimilarity_AllLengths
    - System.Numerics.Tensors.Tests.NonGenericSingleTensorPrimitivesTests.CosineSimilarity_AllLengths
    - System.Numerics.Tensors.Tests.NonGenericSingleTensorPrimitivesTests.CosineSimilarity_AllLengths
    - System.Numerics.Tensors.Tests.SingleGenericTensorPrimitives.CosineSimilarity_AllLengths

Error message:

 Assert.All() Failure: 4 out of 256 items in the collection did not pass.
[3]: Item:  4
     Error: Assert.Equal() Failure: Values differ
            Expected: 0.151808769
            Actual:   0.25312683
[4]: Item:  5
     Error: Assert.Equal() Failure: Values differ
            Expected: 0.253379166
            Actual:   0.138663024
[5]: Item:  6
     Error: Assert.Equal() Failure: Values differ
            Expected: -0.344092488
            Actual:   -0.0114496415
[6]: Item:  7
     Error: Assert.Equal() Failure: Values differ
            Expected: -0.410494238
            Actual:   -0.248638168

Stack trace:

   at System.Numerics.Tensors.Tests.TensorPrimitivesTests`1.CosineSimilarity_AllLengths() in /_/src/libraries/System.Numerics.Tensors/tests/TensorPrimitivesTests.cs:line 740
   at System.RuntimeMethodHandle.InvokeMethod(Object target, Void** arguments, Signature sig, Boolean isConstructor)
   at System.Reflection.MethodBaseInvoker.InvokeWithNoArgs(Object obj, BindingFlags invokeAttr) in /_/src/libraries/System.Private.CoreLib/src/System/Reflection/MethodBaseInvoker.cs:line 57

@tannergooding
Copy link
Member

@AndyAyersMS this looks to be DPGO related.

The repro involves:

DOTNET_JitStress=2
DOTNET_TieredCompilation=1

and stops reproing if we also set:

DOTNET_TieredPGO=0

Nothing immediately jumped out from the JitDisasm as to why there'd be a difference here. There's a couple more spills and of course the calls to CORINFO_HELP_COUNTPROFILE32, but the overall logic and registers used appears to be consistent.

@AndyAyersMS
Copy link
Member

Ok, let me take a look, hopefully today...

@v-wenyuxu
Copy link

v-wenyuxu commented Jun 6, 2024

Failed in: runtime-coreclr libraries-jitstress 20240605.1

Failed tests:

net9.0-linux-Release-x64-jitstress2_tiered-Ubuntu.2204.Amd64.Open
    - System.Numerics.Tensors.Tests.NonGenericSingleTensorPrimitivesTests.CosineSimilarity_AllLengths
    - System.Numerics.Tensors.Tests.NonGenericSingleTensorPrimitivesTests.CosineSimilarity_AllLengths
net9.0-linux-Release-x64-jitstress1_tiered-Ubuntu.2204.Amd64.Open
    - System.Numerics.Tensors.Tests.NonGenericSingleTensorPrimitivesTests.CosineSimilarity_AllLengths
    - System.Numerics.Tensors.Tests.SingleGenericTensorPrimitives.CosineSimilarity_AllLengths
net9.0-windows-Release-x64-jitstress1_tiered-Windows.10.Amd64.Open
    - System.Numerics.Tensors.Tests.NonGenericSingleTensorPrimitivesTests.CosineSimilarity_AllLengths
    - System.Numerics.Tensors.Tests.SingleGenericTensorPrimitives.CosineSimilarity_AllLengths
    - System.Numerics.Tensors.Tests.NonGenericSingleTensorPrimitivesTests.CosineSimilarity_AllLengths
    - System.Numerics.Tensors.Tests.SingleGenericTensorPrimitives.CosineSimilarity_AllLengths

Error message:

 Assert.All() Failure: 4 out of 256 items in the collection did not pass.
[3]: Item:  4
     Error: Assert.Equal() Failure: Values differ
            Expected: 0.151808769
            Actual:   0.25312683
[4]: Item:  5
     Error: Assert.Equal() Failure: Values differ
            Expected: 0.253379166
            Actual:   0.138663024
[5]: Item:  6
     Error: Assert.Equal() Failure: Values differ
            Expected: -0.344092488
            Actual:   -0.0114496415
[6]: Item:  7
     Error: Assert.Equal() Failure: Values differ
            Expected: -0.410494238
            Actual:   -0.248638168

Stack trace:

   at System.Numerics.Tensors.Tests.TensorPrimitivesTests`1.CosineSimilarity_AllLengths() in /_/src/libraries/System.Numerics.Tensors/tests/TensorPrimitivesTests.cs:line 740
   at System.RuntimeMethodHandle.InvokeMethod(Object target, Void** arguments, Signature sig, Boolean isConstructor)
   at System.Reflection.MethodBaseInvoker.InvokeWithNoArgs(Object obj, BindingFlags invokeAttr) in /_/src/libraries/System.Private.CoreLib/src/System/Reflection/MethodBaseInvoker.cs:line 57

@v-wenyuxu
Copy link

Failed in: runtime-coreclr libraries-jitstress 20240606.1

Failed tests:

net9.0-windows-Release-x64-jitstress2_tiered-Windows.10.Amd64.Open
    - System.Numerics.Tensors.Tests.NonGenericSingleTensorPrimitivesTests.CosineSimilarity_AllLengths
    - System.Numerics.Tensors.Tests.SingleGenericTensorPrimitives.CosineSimilarity_AllLengths

Error message:

 Assert.All() Failure: 253 out of 256 items in the collection did not pass.
[3]:   Item:  4
       Error: Assert.Equal() Failure: Values differ
              Expected: 0.151808769
              Actual:   0.226991788
[4]:   Item:  5
       Error: Assert.Equal() Failure: Values differ
              Expected: 0.253379166
              Actual:   0.307658583
[5]:   Item:  6
       Error: Assert.Equal() Failure: Values differ
              Expected: -0.344092488
              Actual:   -0.51713264
[6]:   Item:  7
       Error: Assert.Equal() Failure: Values differ
              Expected: -0.410494238
              Actual:   -0.449467152
[7]:   Item:  8
       Error: Assert.Equal() Failure: Values differ
              Expected: 0.114995345
              Actual:   0.126174167
[8]:   Item:  9
       Error: Assert.Equal() Failure: Values differ
              Expected: 0.307092249
              Actual:   0.229617983
[9]:   Item:  10
       Error: Assert.Equal() Failure: Values differ
              Expected: 0.0431030653
              Actual:   0.280960917
[10]:  Item:  11
       Error: Assert.Equal() Failure: Values differ
              Expected: -0.565155208
              Actual:   -0.59276706
[11]:  Item:  12
       Error: Assert.Equal() Failure: Values differ
              Expected: 0.120973401
              Actual:   0.171677858
[12]:  Item:  13
       Error: Assert.Equal() Failure: Values differ
              Expected: -0.177610368
              Actual:   -0.289381206
[13]:  Item:  14
       Error: Assert.Equal() Failure: Values differ
              Expected: -0.0260503069
              Actual:   -0.210056961
[14]:  Item:  15
       Error: Assert.Equal() Failure: Values differ
              Expected: 0.301667929
              Actual:   0.287703425
[15]:  Item:  16
       Error: Assert.Equal() Failure: Values differ
              Expected: 0.46231854
              Actual:   0.570787907
[16]:  Item:  17
       Error: Assert.Equal() Failure: Values differ
              Expected: 0.156209126
              Actual:   0.198163331
[17]:  Item:  18
       Error: Assert.Equal() Failure: Values differ
              Expected: -7.261461E-05
              Actual:   -8.43763555E-05
[18]:  Item:  19
       Error: Assert.Equal() Failure: Values differ
              Expected: -0.0904619396
              Actual:   -0.0958673432
[19]:  Item:  20
       Error: Assert.Equal() Failure: Values differ
              Expected: -0.106406964
              Actual:   -0.133908242
[20]:  Item:  21
       Error: Assert.Equal() Failure: Values differ
              Expected: -0.232889757
              Actual:   -0.259288758
[21]:  Item:  22
       Error: Assert.Equal() Failure: Values differ
              Expected: -0.0886545852
              Actual:   -0.102738187
[22]:  Item:  23
       Error: Assert.Equal() Failure: Values differ
              Expected: -0.0959805548
              Actual:   -0.117693461
[23]:  Item:  24
       Error: Assert.Equal() Failure: Values differ
              Expected: 0.131370127
              Actual:   0.159029856
[24]:  Item:  25
       Error: Assert.Equal() Failure: Values differ
              Expected: -0.0727393255
              Actual:   -0.0821535066
[25]:  Item:  26
       Error: Assert.Equal() Failure: Values differ
              Expected: -0.00350804674
              Actual:   -0.00434011128
[26]:  Item:  27
       Error: Assert.Equal() Failure: Values differ
              Expected: -0.291483164
              Actual:   -0.353229553
[27]:  Item:  28
       Error: Assert.Equal() Failure: Values differ
              Expected: -0.449836224
              Actual:   -0.480615169
[28]:  Item:  29
       Error: Assert.Equal() Failure: Values differ
              Expected: -0.0294622686
              Actual:   -0.0335214362
[29]:  Item:  30
       Error: Assert.Equal() Failure: Values differ
              Expected: 0.21864678
      

Stack trace:

   at System.Numerics.Tensors.Tests.TensorPrimitivesTests`1.CosineSimilarity_AllLengths() in /_/src/libraries/System.Numerics.Tensors/tests/TensorPrimitivesTests.cs:line 740
   at System.RuntimeMethodHandle.InvokeMethod(Object target, Void** arguments, Signature sig, Boolean isConstructor)
   at System.Reflection.MethodBaseInvoker.InvokeWithNoArgs(Object obj, BindingFlags invokeAttr) in /_/src/libraries/System.Private.CoreLib/src/System/Reflection/MethodBaseInvoker.cs:line 57

@v-wenyuxu
Copy link

Failed in: runtime-coreclr libraries-jitstress 20240610.1

Failed tests:

net9.0-linux-Release-x64-jitstress2_tiered-Ubuntu.2204.Amd64.Open
    - System.Numerics.Tensors.Tests.SingleGenericTensorPrimitives.CosineSimilarity_AllLengths
    - System.Numerics.Tensors.Tests.SingleGenericTensorPrimitives.CosineSimilarity_AllLengths
net9.0-linux-Release-x64-jitstress1_tiered-Ubuntu.2204.Amd64.Open
    - System.Numerics.Tensors.Tests.SingleGenericTensorPrimitives.CosineSimilarity_AllLengths
    - System.Numerics.Tensors.Tests.NonGenericSingleTensorPrimitivesTests.CosineSimilarity_AllLengths
    - System.Numerics.Tensors.Tests.NonGenericSingleTensorPrimitivesTests.CosineSimilarity_AllLengths
net9.0-windows-Release-x64-jitstress1_tiered-Windows.10.Amd64.Open
    - System.Numerics.Tensors.Tests.SingleGenericTensorPrimitives.CosineSimilarity_AllLengths
    - System.Numerics.Tensors.Tests.NonGenericSingleTensorPrimitivesTests.CosineSimilarity_AllLengths
    - System.Numerics.Tensors.Tests.NonGenericSingleTensorPrimitivesTests.CosineSimilarity_AllLengths
    - System.Numerics.Tensors.Tests.SingleGenericTensorPrimitives.CosineSimilarity_AllLengths

Error message:

 Assert.All() Failure: 4 out of 256 items in the collection did not pass.
[3]: Item:  4
     Error: Assert.Equal() Failure: Values differ
            Expected: 0.151808769
            Actual:   0.25312683
[4]: Item:  5
     Error: Assert.Equal() Failure: Values differ
            Expected: 0.253379166
            Actual:   0.138663024
[5]: Item:  6
     Error: Assert.Equal() Failure: Values differ
            Expected: -0.344092488
            Actual:   -0.0114496415
[6]: Item:  7
     Error: Assert.Equal() Failure: Values differ
            Expected: -0.410494238
            Actual:   -0.248638168

Stack trace:

   at System.Numerics.Tensors.Tests.TensorPrimitivesTests`1.CosineSimilarity_AllLengths() in /_/src/libraries/System.Numerics.Tensors/tests/TensorPrimitivesTests.cs:line 740
   at System.RuntimeMethodHandle.InvokeMethod(Object target, Void** arguments, Signature sig, Boolean isConstructor)
   at System.Reflection.MethodBaseInvoker.InvokeWithNoArgs(Object obj, BindingFlags invokeAttr) in /_/src/libraries/System.Private.CoreLib/src/System/Reflection/MethodBaseInvoker.cs:line 57

@v-wenyuxu
Copy link

Failed in: runtime-coreclr libraries-jitstress 20240611.1

Failed tests:

net9.0-linux-Release-x64-jitstress1_tiered-Ubuntu.2204.Amd64.Open
    - System.Numerics.Tensors.Tests.SingleGenericTensorPrimitives.CosineSimilarity_AllLengths
    - System.Numerics.Tensors.Tests.NonGenericSingleTensorPrimitivesTests.CosineSimilarity_AllLengths
net9.0-linux-Release-x64-jitstress2_tiered-Ubuntu.2204.Amd64.Open
    - System.Numerics.Tensors.Tests.NonGenericSingleTensorPrimitivesTests.CosineSimilarity_AllLengths
net9.0-windows-Release-x64-jitstress1_tiered-Windows.10.Amd64.Open
    - System.Numerics.Tensors.Tests.NonGenericSingleTensorPrimitivesTests.CosineSimilarity_AllLengths
    - System.Numerics.Tensors.Tests.NonGenericSingleTensorPrimitivesTests.CosineSimilarity_AllLengths
    - System.Numerics.Tensors.Tests.SingleGenericTensorPrimitives.CosineSimilarity_AllLengths

Error message:

 Assert.All() Failure: 4 out of 256 items in the collection did not pass.
[3]: Item:  4
     Error: Assert.Equal() Failure: Values differ
            Expected: 0.151808769
            Actual:   0.25312683
[4]: Item:  5
     Error: Assert.Equal() Failure: Values differ
            Expected: 0.253379166
            Actual:   0.138663024
[5]: Item:  6
     Error: Assert.Equal() Failure: Values differ
            Expected: -0.344092488
            Actual:   -0.0114496415
[6]: Item:  7
     Error: Assert.Equal() Failure: Values differ
            Expected: -0.410494238
            Actual:   -0.248638168

Stack trace:

   at System.Numerics.Tensors.Tests.TensorPrimitivesTests`1.CosineSimilarity_AllLengths() in /_/src/libraries/System.Numerics.Tensors/tests/TensorPrimitivesTests.cs:line 740
   at System.RuntimeMethodHandle.InvokeMethod(Object target, Void** arguments, Signature sig, Boolean isConstructor)
   at System.Reflection.MethodBaseInvoker.InvokeWithNoArgs(Object obj, BindingFlags invokeAttr) in /_/src/libraries/System.Private.CoreLib/src/System/Reflection/MethodBaseInvoker.cs:line 57

@v-wenyuxu
Copy link

Failed in: runtime-coreclr libraries-jitstress 20240612.1

Failed tests:

net9.0-linux-Release-x64-jitstress2_tiered-Ubuntu.2204.Amd64.Open
    - System.Numerics.Tensors.Tests.SingleGenericTensorPrimitives.CosineSimilarity_AllLengths
    - System.Numerics.Tensors.Tests.NonGenericSingleTensorPrimitivesTests.CosineSimilarity_AllLengths
net9.0-linux-Release-x64-jitstress1_tiered-Ubuntu.2204.Amd64.Open
    - System.Numerics.Tensors.Tests.SingleGenericTensorPrimitives.CosineSimilarity_AllLengths
    - System.Numerics.Tensors.Tests.NonGenericSingleTensorPrimitivesTests.CosineSimilarity_AllLengths
net9.0-windows-Release-x64-jitstress2_tiered-Windows.10.Amd64.Open
    - System.Numerics.Tensors.Tests.NonGenericSingleTensorPrimitivesTests.CosineSimilarity_AllLengths
    - System.Numerics.Tensors.Tests.SingleGenericTensorPrimitives.CosineSimilarity_AllLengths

Error message:

 Assert.All() Failure: 4 out of 256 items in the collection did not pass.
[3]: Item:  4
     Error: Assert.Equal() Failure: Values differ
            Expected: 0.151808769
            Actual:   0.25312683
[4]: Item:  5
     Error: Assert.Equal() Failure: Values differ
            Expected: 0.253379166
            Actual:   0.138663024
[5]: Item:  6
     Error: Assert.Equal() Failure: Values differ
            Expected: -0.344092488
            Actual:   -0.0114496415
[6]: Item:  7
     Error: Assert.Equal() Failure: Values differ
            Expected: -0.410494238
            Actual:   -0.248638168

Stack trace:

   at System.Numerics.Tensors.Tests.TensorPrimitivesTests`1.CosineSimilarity_AllLengths() in /_/src/libraries/System.Numerics.Tensors/tests/TensorPrimitivesTests.cs:line 740
   at System.RuntimeMethodHandle.InvokeMethod(Object target, Void** arguments, Signature sig, Boolean isConstructor)
   at System.Reflection.MethodBaseInvoker.InvokeWithNoArgs(Object obj, BindingFlags invokeAttr) in /_/src/libraries/System.Private.CoreLib/src/System/Reflection/MethodBaseInvoker.cs:line 57

@v-wenyuxu
Copy link

Failed in: runtime-coreclr libraries-jitstress 20240613.1

Failed tests:

net9.0-linux-Release-x64-jitstress1_tiered-Ubuntu.2204.Amd64.Open
    - System.Numerics.Tensors.Tests.SingleGenericTensorPrimitives.CosineSimilarity_AllLengths
    - System.Numerics.Tensors.Tests.NonGenericSingleTensorPrimitivesTests.CosineSimilarity_AllLengths

Error message:

 Assert.All() Failure: 8 out of 256 items in the collection did not pass.
[7]:  Item:  8
      Error: Assert.Equal() Failure: Values differ
             Expected: 0.114995345
             Actual:   0.11500933
[8]:  Item:  9
      Error: Assert.Equal() Failure: Values differ
             Expected: 0.307092249
             Actual:   0.330432683
[9]:  Item:  10
      Error: Assert.Equal() Failure: Values differ
             Expected: 0.0431030653
             Actual:   0.0477333367
[10]: Item:  11
      Error: Assert.Equal() Failure: Values differ
             Expected: -0.565155208
             Actual:   -0.597925127
[11]: Item:  12
      Error: Assert.Equal() Failure: Values differ
             Expected: 0.120973401
             Actual:   0.141451269
[12]: Item:  13
      Error: Assert.Equal() Failure: Values differ
             Expected: -0.177610368
             Actual:   -0.196189433
[13]: Item:  14
      Error: Assert.Equal() Failure: Values differ
             Expected: -0.0260503069
             Actual:   -0.0290813595
[14]: Item:  15
      Error: Assert.Equal() Failure: Values differ
             Expected: 0.301667929
             Actual:   0.336596906

Stack trace:

   at System.Numerics.Tensors.Tests.TensorPrimitivesTests`1.CosineSimilarity_AllLengths() in /_/src/libraries/System.Numerics.Tensors/tests/TensorPrimitivesTests.cs:line 740
   at System.RuntimeMethodHandle.InvokeMethod(Object target, Void** arguments, Signature sig, Boolean isConstructor)
   at System.Reflection.MethodBaseInvoker.InvokeWithNoArgs(Object obj, BindingFlags invokeAttr) in /_/src/libraries/System.Private.CoreLib/src/System/Reflection/MethodBaseInvoker.cs:line 57

@v-wenyuxu
Copy link

Failed in: runtime-coreclr libraries-jitstress 20240616.1

Failed tests:

net9.0-linux-Release-x64-jitstress2_tiered-Ubuntu.2204.Amd64.Open
    - System.Numerics.Tensors.Tests.NonGenericSingleTensorPrimitivesTests.CosineSimilarity_AllLengths
    - System.Numerics.Tensors.Tests.NonGenericSingleTensorPrimitivesTests.CosineSimilarity_AllLengths
net9.0-linux-Release-x64-jitstress1_tiered-Ubuntu.2204.Amd64.Open
    - System.Numerics.Tensors.Tests.SingleGenericTensorPrimitives.CosineSimilarity_AllLengths
    - System.Numerics.Tensors.Tests.SingleGenericTensorPrimitives.CosineSimilarity_AllLengths
net9.0-windows-Release-x64-jitstress1_tiered-Windows.10.Amd64.Open
    - System.Numerics.Tensors.Tests.SingleGenericTensorPrimitives.CosineSimilarity_AllLengths
    - System.Numerics.Tensors.Tests.NonGenericSingleTensorPrimitivesTests.CosineSimilarity_AllLengths
    - System.Numerics.Tensors.Tests.NonGenericSingleTensorPrimitivesTests.CosineSimilarity_AllLengths
    - System.Numerics.Tensors.Tests.SingleGenericTensorPrimitives.CosineSimilarity_AllLengths

Error message:

 Assert.All() Failure: 4 out of 256 items in the collection did not pass.
[3]: Item:  4
     Error: Assert.Equal() Failure: Values differ
            Expected: 0.151808769
            Actual:   0.25312683
[4]: Item:  5
     Error: Assert.Equal() Failure: Values differ
            Expected: 0.253379166
            Actual:   0.138663024
[5]: Item:  6
     Error: Assert.Equal() Failure: Values differ
            Expected: -0.344092488
            Actual:   -0.0114496415
[6]: Item:  7
     Error: Assert.Equal() Failure: Values differ
            Expected: -0.410494238
            Actual:   -0.248638168

Stack trace:

   at System.Numerics.Tensors.Tests.TensorPrimitivesTests`1.CosineSimilarity_AllLengths() in /_/src/libraries/System.Numerics.Tensors/tests/TensorPrimitivesTests.cs:line 740
   at System.RuntimeMethodHandle.InvokeMethod(Object target, Void** arguments, Signature sig, Boolean isConstructor)
   at System.Reflection.MethodBaseInvoker.InvokeWithNoArgs(Object obj, BindingFlags invokeAttr) in /_/src/libraries/System.Private.CoreLib/src/System/Reflection/MethodBaseInvoker.cs:line 57

@v-wenyuxu
Copy link

Failed in: runtime-coreclr libraries-jitstress 20240617.1

Failed tests:

net9.0-linux-Release-x64-jitstress2_tiered-Ubuntu.2204.Amd64.Open
    - System.Numerics.Tensors.Tests.NonGenericSingleTensorPrimitivesTests.CosineSimilarity_AllLengths
    - System.Numerics.Tensors.Tests.NonGenericSingleTensorPrimitivesTests.CosineSimilarity_AllLengths
net9.0-linux-Release-x64-jitstress1_tiered-Ubuntu.2204.Amd64.Open
    - System.Numerics.Tensors.Tests.SingleGenericTensorPrimitives.CosineSimilarity_AllLengths
    - System.Numerics.Tensors.Tests.NonGenericSingleTensorPrimitivesTests.CosineSimilarity_AllLengths
    - System.Numerics.Tensors.Tests.SingleGenericTensorPrimitives.CosineSimilarity_AllLengths
net9.0-windows-Release-x64-jitstress1_tiered-Windows.10.Amd64.Open
    - System.Numerics.Tensors.Tests.SingleGenericTensorPrimitives.CosineSimilarity_AllLengths
    - System.Numerics.Tensors.Tests.NonGenericSingleTensorPrimitivesTests.CosineSimilarity_AllLengths
    - System.Numerics.Tensors.Tests.NonGenericSingleTensorPrimitivesTests.CosineSimilarity_AllLengths
    - System.Numerics.Tensors.Tests.SingleGenericTensorPrimitives.CosineSimilarity_AllLengths

Error message:

 Assert.All() Failure: 4 out of 256 items in the collection did not pass.
[3]: Item:  4
     Error: Assert.Equal() Failure: Values differ
            Expected: 0.151808769
            Actual:   0.25312683
[4]: Item:  5
     Error: Assert.Equal() Failure: Values differ
            Expected: 0.253379166
            Actual:   0.138663024
[5]: Item:  6
     Error: Assert.Equal() Failure: Values differ
            Expected: -0.344092488
            Actual:   -0.0114496415
[6]: Item:  7
     Error: Assert.Equal() Failure: Values differ
            Expected: -0.410494238
            Actual:   -0.248638168

Stack trace:

   at System.Numerics.Tensors.Tests.TensorPrimitivesTests`1.CosineSimilarity_AllLengths() in /_/src/libraries/System.Numerics.Tensors/tests/TensorPrimitivesTests.cs:line 740
   at System.RuntimeMethodHandle.InvokeMethod(Object target, Void** arguments, Signature sig, Boolean isConstructor)
   at System.Reflection.MethodBaseInvoker.InvokeWithNoArgs(Object obj, BindingFlags invokeAttr) in /_/src/libraries/System.Private.CoreLib/src/System/Reflection/MethodBaseInvoker.cs:line 57

@stephentoub
Copy link
Member

Ok, let me take a look, hopefully today...

Any luck, @AndyAyersMS?

@AndyAyersMS
Copy link
Member

Ok, let me take a look, hopefully today...

Any luck, @AndyAyersMS?

Ooops, forgot about this one. I will look at it today for sure.

@AndyAyersMS
Copy link
Member

System.Numerics.Tensors.TensorPrimitives:CosineSimilarityCore[float](System.ReadOnlySpan`1[float],System.ReadOnlySpan`1[float]):float (MethodHash=9d7a95bf)

has bad codegen when stressed via

STRESS_SPLIT_TREES_RANDOMLY,STRESS_UNSAFE_BUFFER_CHECKS

Haven't drilled in further yet.

@v-wenyuxu
Copy link

Failed in: runtime-coreclr libraries-jitstress 20240618.1

Failed tests:

net9.0-linux-Release-x64-jitstress2_tiered-Ubuntu.2204.Amd64.Open
    - System.Numerics.Tensors.Tests.SingleGenericTensorPrimitives.CosineSimilarity_AllLengths
    - System.Numerics.Tensors.Tests.NonGenericSingleTensorPrimitivesTests.CosineSimilarity_AllLengths
net9.0-linux-Release-x64-jitstress1_tiered-Ubuntu.2204.Amd64.Open
    - System.Numerics.Tensors.Tests.NonGenericSingleTensorPrimitivesTests.CosineSimilarity_AllLengths
    - System.Numerics.Tensors.Tests.SingleGenericTensorPrimitives.CosineSimilarity_AllLengths
net9.0-windows-Release-x64-jitstress1_tiered-Windows.10.Amd64.Open
    - System.Numerics.Tensors.Tests.SingleGenericTensorPrimitives.CosineSimilarity_AllLengths
    - System.Numerics.Tensors.Tests.NonGenericSingleTensorPrimitivesTests.CosineSimilarity_AllLengths
    - System.Numerics.Tensors.Tests.NonGenericSingleTensorPrimitivesTests.CosineSimilarity_AllLengths
    - System.Numerics.Tensors.Tests.SingleGenericTensorPrimitives.CosineSimilarity_AllLengths

Error message:

 Assert.All() Failure: 4 out of 256 items in the collection did not pass.
[3]: Item:  4
     Error: Assert.Equal() Failure: Values differ
            Expected: 0.151808769
            Actual:   0.25312683
[4]: Item:  5
     Error: Assert.Equal() Failure: Values differ
            Expected: 0.253379166
            Actual:   0.138663024
[5]: Item:  6
     Error: Assert.Equal() Failure: Values differ
            Expected: -0.344092488
            Actual:   -0.0114496415
[6]: Item:  7
     Error: Assert.Equal() Failure: Values differ
            Expected: -0.410494238
            Actual:   -0.248638168

Stack trace:

   at System.Numerics.Tensors.Tests.TensorPrimitivesTests`1.CosineSimilarity_AllLengths() in /_/src/libraries/System.Numerics.Tensors/tests/TensorPrimitivesTests.cs:line 740
   at System.RuntimeMethodHandle.InvokeMethod(Object target, Void** arguments, Signature sig, Boolean isConstructor)
   at System.Reflection.MethodBaseInvoker.InvokeWithNoArgs(Object obj, BindingFlags invokeAttr) in /_/src/libraries/System.Private.CoreLib/src/System/Reflection/MethodBaseInvoker.cs:line 57

@AndyAyersMS
Copy link
Member

Guessing the bug is that we have the wrong type on a permute node [000236]. The 33rd split tree in the method is

STMT00029 ( 0x40A[E-] ... 0x44B )
N014 ( 27, 26) [000275] DA--G------                         *  STORE_LCL_VAR float  V42 tmp6         
N013 ( 23, 21) [000245] -A--G------                         \--*  HWINTRINSIC float  float ToScalar
N012 ( 22, 20) [000244] -A--G------                            \--*  HWINTRINSIC simd16 float Add
N010 ( 18, 17) [000243] -A--G------                               +--*  HWINTRINSIC float  float Permute
N008 ( 16, 15) [000240] -A--G------                               |  +--*  COMMA     simd16
N006 ( 13, 13) [000238] DA--G------                               |  |  +--*  STORE_LCL_VAR simd16 V39 tmp3         
N005 (  9, 10) [000237] ----G------                               |  |  |  \--*  HWINTRINSIC simd16 float Add
N003 (  5,  7) [000236] ----G------                               |  |  |     +--*  HWINTRINSIC float  float Permute
N001 (  3,  2) [000233] ----G------                               |  |  |     |  +--*  LCL_VAR   simd16<System.Runtime.Intrinsics.Vector128`1>(AX) V27 loc25        
N002 (  1,  4) [000235] -------N---                               |  |  |     |  \--*  CNS_INT   int    177
N004 (  3,  2) [000234] ----G------                               |  |  |     \--*  LCL_VAR   simd16<System.Runtime.Intrinsics.Vector128`1>(AX) V27 loc25        
N007 (  3,  2) [000239] -----------                               |  |  \--*  LCL_VAR   simd16 V39 tmp3         
N009 (  1,  1) [000242] -------N---                               |  \--*  CNS_INT   int    78
N011 (  3,  2) [000241] -----------                               \--*  LCL_VAR   simd16 V39 tmp3         

which becomes

***** BB28 [0027]
STMT00139 ( 0x40A[E-] ... ??? )
N004 (  9, 12) [000896] DA--G------                         *  STORE_LCL_VAR float  V142 tmp106      
N003 (  5,  7) [000236] ----G------                         \--*  HWINTRINSIC float  float Permute
N001 (  3,  2) [000233] ----G------                            +--*  LCL_VAR   simd16<System.Runtime.Intrinsics.Vector128`1>(AX) V27 loc25        
N002 (  1,  4) [000235] -------N---                            \--*  CNS_INT   int    177

***** BB28 [0027]
STMT00140 ( 0x40A[E-] ... ??? )
N002 (  7,  5) [000898] DA--G------                         *  STORE_LCL_VAR simd16 V143 tmp107      
N001 (  3,  2) [000234] ----G------                         \--*  LCL_VAR   simd16<System.Runtime.Intrinsics.Vector128`1>(AX) V27 loc25        

***** BB28 [0027]
STMT00029 ( 0x40A[E-] ... 0x44B )
N012 ( 25, 23) [000275] DA--G------                         *  STORE_LCL_VAR float  V42 tmp6         
N011 ( 21, 18) [000245] -A--G------                         \--*  HWINTRINSIC float  float ToScalar
N010 ( 20, 17) [000244] -A--G------                            \--*  HWINTRINSIC simd16 float Add
N008 ( 16, 14) [000243] -A--G------                               +--*  HWINTRINSIC float  float Permute
N006 ( 14, 12) [000240] -A--G------                               |  +--*  COMMA     simd16
N004 ( 11, 10) [000238] DA--G------                               |  |  +--*  STORE_LCL_VAR simd16 V39 tmp3         
N003 (  7,  7) [000237] ----G------                               |  |  |  \--*  HWINTRINSIC simd16 float Add
N001 (  3,  4) [000897] -----------                               |  |  |     +--*  LCL_VAR   float  V142 tmp106      
N002 (  3,  2) [000899] -----------                               |  |  |     \--*  LCL_VAR   simd16 V143 tmp107      
N005 (  3,  2) [000239] -----------                               |  |  \--*  LCL_VAR   simd16 V39 tmp3         
N007 (  1,  1) [000242] -------N---                               |  \--*  CNS_INT   int    78
N009 (  3,  2) [000241] -----------                               \--*  LCL_VAR   simd16 V39 tmp3         

But I suspect V142 should be simd16, not float.

AndyAyersMS added a commit to AndyAyersMS/runtime that referenced this issue Jun 19, 2024
In `gtNewSimdSumNode` we need to type permute nodes as `simd16`, not the sum's type.
If we split the tree at the permute we spill to the wrong typed temp.

Also provide the ability to halt stress tree splitting after some number of splits.

Fixes dotnet#102335.
@AndyAyersMS
Copy link
Member

Fixing that seems to do the trick.

@stephentoub
Copy link
Member

Thanks!

@github-actions github-actions bot locked and limited conversation to collaborators Jul 20, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-CodeGen-coreclr CLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI blocking-clean-ci-optional Blocking optional rolling runs
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants