runtime icon indicating copy to clipboard operation
runtime copied to clipboard

Some Matrix4x4 tests are failing on OSX in corefx

Open mellinoe opened this issue 10 years ago • 60 comments

We've noticed that a couple of random tests for our System.Numerics.Matrix4x4 structure have started failing in the past week, only on OSX Release builds. I haven't investigated the issues too deeply yet, but I strongly suspect there is some bug introduced recently in the runtime, because:

  • The library and tests haven't changed in a long time
  • The tests pass on all other combinations of frameworks, OS's, etc.
  • They were passing unchanged a couple of weeks ago :smile:

Note that Matrix4x4 is a very large structure (16 floats = 64-bytes wide), and I think there have been some changes to how structures are passed around on other platforms. The issue is only happening on OSX release builds, not Linux or any other configuration. Does anyone recall recent changes that might be causing this issue in that particular configuration? If I had to guess, I would say it's something to do with the fact that it is such a large structure, but again, I haven't investigated deeply yet.

Tests failing:

Matrix4x4CreateFromYawPitchRollTest2

07:00:32    System.Numerics.Tests.Matrix4x4Tests.Matrix4x4CreateFromYawPitchRollTest2 [FAIL]
07:00:32       Yaw:-265 Pitch:155 Roll:-405
07:00:32       Expected: True
07:00:32       Actual:   False
07:00:32       Stack Trace:
07:00:33             at System.Numerics.Tests.Matrix4x4Tests.Matrix4x4CreateFromYawPitchRollTest2()

Source code for CreateFromYawPitchRoll()

Matrix4x4DecomposeTest01

08:54:36    System.Numerics.Tests.Matrix4x4Tests.Matrix4x4DecomposeTest01 [FAIL]
08:54:36       Matrix4x4.Decompose did not return expected value. Expected:<10, 20, 30> actual:<10, 20.19675, 30>.
08:54:36       Expected: True
08:54:36       Actual:   False
08:54:36       Stack Trace:
08:54:36             at System.Numerics.Tests.Matrix4x4Tests.DecomposeTest(Single yaw, Single pitch, Single roll, Vector3 expectedTranslation, Vector3 expectedScales)
08:54:36             at System.Numerics.Tests.Matrix4x4Tests.Matrix4x4DecomposeTest01()

Source code for Decompose()

mellinoe avatar Dec 08 '15 18:12 mellinoe

@RussKeldorph, does this look like it could be related to the JIT?

tzwlai avatar Jan 06 '16 23:01 tzwlai

@tzwlai probably makes sense for us to look. @LLITCHEV @CarolEidt FYI.

RussKeldorph avatar Jan 07 '16 23:01 RussKeldorph

@RussKeldorph - This is an issue on OSX, should we move it to 'future'?

sivarv avatar Jan 08 '16 04:01 sivarv

@sivarv I am not 100% it is issue on the Mac only. (In terms of the Jit there should be no differences on Linux, Mac OS or any other *nix OS.) I this investigating at least will not hurt.

LLITCHEV avatar Jan 08 '16 05:01 LLITCHEV

@mellinoe I could not repro this. There were fixed to the jit that could potentially fixed this. It seems it is passing now on the MacOS CI (at least one of the test is not disabled - the first one.) Please retest and update the bug.

LLITCHEV avatar Jan 10 '16 06:01 LLITCHEV

@mellinoe Please re-open if this is still repro'ing.

RussKeldorph avatar Jan 14 '16 14:01 RussKeldorph

We're still seeing intermittent failures in these tests in our OSX Release test runs in corefx. Note that these tests are deterministic (no random elements), but are only failing intermittently.

mellinoe avatar Jan 19 '16 19:01 mellinoe

I wonder if the failures can be related to the physical hardware the test run ends up running on, in other words if the problem is similar to the issue dotnet/coreclr#2687. @LLITCHEV this is what I have mentioned today.

janvorli avatar Jan 19 '16 23:01 janvorli

It is unlikely that issue dotnet/coreclr#2687 could be the cause of this issue because only very recently (1/15) Carol has enabled SSE2 SIMD intrinsics on Linux. AVX support for SIMD intrinsics is not turned on for *nix yet. Also, my understanding is that these tests were failing even before that.

sivarv avatar Jan 19 '16 23:01 sivarv

Yes, the tests have been failing for a little while, longer than the SIMD feature was turned on. Also, these failures are occurring on OSX, which I don't believe has SIMD enabled yet? I think only Linux has been enabled recently.

Another thing to note is that the test failures are in Matrix4x4, which doesn't have any special code-gen as far as I know. It uses Vector3/Vector4 internally in some places which might have special recognition, but I actually don't think the code paths used by the test hit that.

mellinoe avatar Jan 19 '16 23:01 mellinoe

It is my understanding that OSX uses the same codegen as Linux. So, I believe that SIMD is enabled there as well. But, as you say, this was failing before the SIMD feature was enabled.

CarolEidt avatar Jan 19 '16 23:01 CarolEidt

@CarolEidt Yes. There is no any difference in terms of codegen (or in any other way) between Linux and MacOS by the Jit. I wonder if the failures are on the same machine? It is really perplexing that a deterministic test will fail intermittently. And I'd expect for it to fail on Linux too.

LLITCHEV avatar Jan 20 '16 00:01 LLITCHEV

@LLITCHEV was able to run the tests on the same machine that we saw one of the CI failures, and we still weren't able to get a repro, unfortunately. We were also using the same bits that the CI machine used when it failed, taken from the shared Jenkins location. Since this seems to be such an obscure problem, I'm moving to Future but leaving it open for now. Hopefully we can get some better information in the future regarding why this happens.

Main questions that we haven't solved:

  • Why does it only happen on OSX if the code-gen should be identical between Linux/OSX/(others)?
  • Why does it affect the Matrix4x4 tests? (big structure?)
  • Why is it intermittent if the tests are deterministic?

mellinoe avatar Jan 22 '16 19:01 mellinoe

Failed again here: http://dotnet-ci.cloudapp.net/job/dotnet_corefx/job/osx_release_tst/277/console

stephentoub avatar Jan 23 '16 16:01 stephentoub

@LLITCHEV I believe these are all on the same machine, including Stephen's new one today. If I'm reading the Jenkins log correctly, all of the failures are on dci-mac-bld-6. Is that the one that we had tested on? @mmitche do you remember which machine we had pulled to do the test?

mellinoe avatar Jan 23 '16 20:01 mellinoe

@mellinoe The machines that we pulled to try to repro the were 131.107.19.71 and 74.30.245.235. I believe the second was the one that you last repro occurred. After many runs it didn't happen even once. @mmitche Could you please confirm that dci-mac-0bld-6 is the same machine?

LLITCHEV avatar Jan 23 '16 23:01 LLITCHEV

06 is http://131.107.19.118/

mmitche avatar Jan 25 '16 15:01 mmitche

There were a couple more repros that @stephentoub noted in the corefx bug:

http://dotnet-ci.cloudapp.net/job/dotnet_corefx/job/osx_release_tst_prtest/144/console http://dotnet-ci.cloudapp.net/job/dotnet_corefx/job/osx_release_tst_prtest/145/console

Those failures happened on dci-mac-bld-4 and dci-mac-bld-6, so I think we can rule out this being specific to a particular machine. It has happened on 1, 4, and 6 at the very least.

mellinoe avatar Jan 26 '16 20:01 mellinoe

@LLITCHEV Perhaps we can try to repro this by running the full set of tests (from all libraries), same as is done in CI? It may be that this issue only arises under the pressure of running all the tests in succession.

mellinoe avatar Jan 26 '16 20:01 mellinoe

@LLITCHEV look into this again if you can. Intermittent failures on OSX sounds more like some other issues I've heard about than codegen. I wonder if perhaps this has stopped repro'ing by now.

RussKeldorph avatar May 22 '16 04:05 RussKeldorph