Skip to content

matrix4x4createfromaxisangletest failing on NativeAOT #72149

Description

@runfoapp

Frequency - last 30 days as of 8/27:

Note: main branch failures in last 30 days

Runfo report

Build Kind Start Time
1871493 PR 71819 2022-11-07
1871687 Rolling 2022-11-07
1871847 PR 71819 2022-11-07
1872236 PR 71948 2022-11-07
1872339 PR 71943 2022-11-07
1873007 Rolling 2022-11-07
1873836 PR 71988 2022-12-07
1873835 PR 71175 2022-12-07
1874128 PR 71385 2022-12-07
1874181 PR 71187 2022-12-07
1874234 Rolling 2022-12-07
1874881 PR 71971 2022-12-07
1875008 PR 71385 2022-12-07
1877271 PR 72078 2022-13-07
1877160 Rolling 2022-13-07
1877428 Rolling 2022-13-07
1877456 PR 71948 2022-13-07
1878318 PR 72108 2022-13-07
1878499 Rolling 2022-13-07
1878950 PR 71385 2022-13-07
1878990 Rolling 2022-13-07
1880070 Rolling 2022-14-07
1880254 Rolling 2022-14-07
1880316 PR 72167 2022-14-07
1880554 PR 72091 2022-14-07
1880908 PR 72184 2022-14-07
1881247 Rolling 2022-14-07
1881678 Rolling 2022-14-07
1882597 Rolling 2022-15-07
1882765 PR 72145 2022-15-07
1882819 Rolling 2022-15-07
1882810 PR 72252 2022-15-07
1882817 PR 72236 2022-15-07
1884136 Rolling 2022-15-07

Activity

  1. ghost added
    untriagedNew issue has not been triaged by the area owner
    on Jul 14, 2022
  2. changed the title [-]system.numerics.tests.matrix4x4tests.matrix4x4createfromaxisangletest[/-] [+]matrix4x4createfromaxisangletest failing on NativeAOT[/+] on Jul 14, 2022
  3. jkotas commented on Jul 14, 2022

    @jkotas
    Member
  4. ghost removed
    untriagedNew issue has not been triaged by the area owner
    on Jul 14, 2022
  5. jtschuster commented on Jul 14, 2022

    @jtschuster
    Member

    Deleted duplicates in runfo, didn't mean to close this

  6. ghost added
    untriagedNew issue has not been triaged by the area owner
    on Jul 14, 2022
  7. LakshanF commented on Jul 14, 2022

    @LakshanF
    Contributor

    #72108 has the RR passing (including the Linux-arm64 platform). Waiting for some checks to complete in the runtime pipeline that seems to be due to service outage

  8. self-assigned this
    on Jul 14, 2022
  9. LakshanF commented on Jul 15, 2022

    @LakshanF
    Contributor

    The NativeAOT rolling runs are passing with #72108

  10. 46 remaining items

  11. tannergooding commented on Aug 28, 2022

    @tannergooding
    Member

    Given this is NAOT only and NAOT must target a lower baseline, its possible there is a bug in the dpps emulation emitted for SSE2 only hardware that isn't correctly accounting for this.

    I'll take a look tomorrow.

  12. MichalStrehovsky commented on Aug 28, 2022

    @MichalStrehovsky
    Member

    Given this is NAOT only and NAOT must target a lower baseline

    If we don't have any other test coverage for the lower baselines, it might be a good quality week topic. With NAOT one at least has a deterministic repro once a bad binary has been produced. Running into this in a JIT configuration would be a lot more difficult to root cause.

    This is not the first issue caused by this test hole - there were #72081 and #72158 just in the past month. NAOT covers the lowest denominator but there's a whole spectrum in between the lowest denominator and whatever machines we run the tests on that can happen in the real world and it looks like we don't test.

  13. tannergooding commented on Aug 28, 2022

    @tannergooding
    Member

    We do test, but only in the outer loop and only for the runtime tests. There has been a longstanding issue to also run the library tests under the various JIT Stress options for ISA enablement

  14. JulieLeeMSFT commented on Aug 29, 2022

    @JulieLeeMSFT
    Member

    Given this is NAOT only and NAOT must target a lower baseline, its possible there is a bug in the dpps emulation emitted for SSE2 only hardware that isn't correctly accounting for this.

    I'll take a look tomorrow.

    Assigning to Tanner.

  15. jkotas commented on Aug 30, 2022

    @jkotas
    Member

    @tannergooding Did you have a chance to take a look?

  16. tannergooding commented on Aug 30, 2022

    @tannergooding
    Member

    Yes. but it doesn't look to be in the Vector3.Dot emulation.

    The relevant logic is here: https://github.com/dotnet/runtime/blob/main/src/coreclr/jit/lowerxarch.cpp#L3350

    We pick Sse.Multiply, Sse3.HorizontalAdd -or- Sse.Shuffle, and Sse.Add and then the very first thing we do is mask things so that the unused component is zero: https://github.com/dotnet/runtime/blob/main/src/coreclr/jit/lowerxarch.cpp#L3418

    • Notably we could do this "more efficiently" now that we have GT_CNS_VEC, but that's an unrelated JIT throughput optimization
  17. tannergooding commented on Aug 30, 2022

    @tannergooding
    Member

    The called Matrix and Quaternion methods aren't accelerated, just the Vector3.Normalize call, the various field accesses, the UnitX/Y/Z property accesses, and the Vector3 constructor call.

    The test doesn't really use any special tricks or code paths either:

    public void Matrix4x4CreateFromAxisAngleTest()

  18. jkotas commented on Aug 31, 2022

    @jkotas
    Member

    Here is codegen for Vector3.Length that I believe is the root cause of the problem:

    [MethodImpl(MethodImplOptions.NoInlining)]
    static float f(Vector3 v)
      => v.Length();
    
    movss   xmm0,dword ptr [rcx+8] ds:00000052`9e6ff828=3f800000
    movsd   xmm1,mmword ptr [rcx]
    shufps  xmm1,xmm0,44h
                     
    // xmm1 has Vector3. The top 4 bytes of xmm1 have undefined value. They happen to be well defined in this specific case, but the JIT assumes the general case where they are undefined.
    
    movups  xmm0,xmmword ptr [xxx!_readonlydata_xxx_Program____Main___g__f_0_0 (00007ff6`59060ee0)] // 0x0000 FFFF FFFF FFFF - mask for the top 4 bytes
    andps   xmm0,xmm1 // xmm0 has properly masked Vector3
    mulps   xmm0,xmm1 // We are multiplying properly masked Vector3 with unmasked Vector3!
    
    movaps  xmm1,xmm0
    shufps  xmm1,xmm0,0B1h
    addps   xmm1,xmm0
    movaps  xmm0,xmm1
    shufps  xmm0,xmm1,4Eh
    addps   xmm0,xmm1
    sqrtss  xmm0,xmm0
    ret
    

    I think mulps xmm0,xmm1 is wrong. It should be mulps xmm0,xmm0 so that we multiply the masked values. The bad code works most of the time (0 multiplied by undefined value is zero) except when the undefined value happens to be NaN that will turn the whole thing into NaN.

    Does this analysis make sense? Can you take it from here?

  19. tannergooding commented on Aug 31, 2022

    @tannergooding
    Member

    Yes, that makes sense. It should definitely be multiplying tmp * tmp, rather than tmp * original.

    I'll see about getting a fix up first thing tomorrow.

  20. ghost added
    in-prThere is an active PR which will close this issue when it is merged
    on Sep 1, 2022
  21. ghost removed
    in-prThere is an active PR which will close this issue when it is merged
    on Sep 2, 2022
  22. ghost locked as resolved and limited conversation to collaborators on Oct 2, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

area-CodeGen-coreclrCLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI

Type

No type

Projects

  • Status
    High Priority

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions