Repository navigation
Closed
Labels
JitStressCLR JIT issues involving JIT internal stress modesarea-CodeGen-coreclrCLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMIblocking-clean-ci-optionalBlocking optional rolling runs
Milestone
Description
JitStress=1
pipeline: runtime-coreclr libraries-jitstress
C:\h\w\BA420A2D\w\A633097F\e>set COMPlus
COMPlus_JitStress=1
COMPlus_TieredCompilation=0
C:\h\w\BA420A2D\w\A633097F\e>call RunTests.cmd --runtime-path C:\h\w\BA420A2D\p
----- start Tue 10/04/2022 8:40:39.66 =============== To repro directly: =====================================================
pushd C:\h\w\BA420A2D\w\A633097F\e\
"C:\h\w\BA420A2D\p\dotnet.exe" exec --runtimeconfig System.Xml.Linq.Streaming.Tests.runtimeconfig.json --depsfile System.Xml.Linq.Streaming.Tests.deps.json xunit.console.dll System.Xml.Linq.Streaming.Tests.dll -xml testResults.xml -nologo -nocolor -notrait category=IgnoreForCI -notrait category=OuterLoop -notrait category=failing
popd
===========================================================================================================
C:\h\w\BA420A2D\w\A633097F\e>"C:\h\w\BA420A2D\p\dotnet.exe" exec --runtimeconfig System.Xml.Linq.Streaming.Tests.runtimeconfig.json --depsfile System.Xml.Linq.Streaming.Tests.deps.json xunit.console.dll System.Xml.Linq.Streaming.Tests.dll -xml testResults.xml -nologo -nocolor -notrait category=IgnoreForCI -notrait category=OuterLoop -notrait category=failing
Discovering: System.Xml.Linq.Streaming.Tests (method display = ClassAndMethod, method display options = None)
Discovered: System.Xml.Linq.Streaming.Tests (found 39 test cases)
Starting: System.Xml.Linq.Streaming.Tests (parallel test collections = on, max threads = 4)
XDocumentTests.Streaming.XStreamingElementAPI.NestedXStreamingElementPlusIEnumerable [FAIL]
System.NullReferenceException : Object reference not set to an instance of an object.
Stack Trace:
/_/src/libraries/System.Private.Xml.Linq/tests/Streaming/StreamingOutput.cs(489,0): at XDocumentTests.Streaming.XStreamingElementAPI.NestedXStreamingElementPlusIEnumerable()
at System.RuntimeMethodHandle.InvokeMethod(Object target, Void** arguments, Signature sig, Boolean isConstructor)
/_/src/libraries/System.Private.CoreLib/src/System/Reflection/MethodInvoker.cs(64,0): at System.Reflection.MethodInvoker.Invoke(Object obj, IntPtr* args, BindingFlags invokeAttr)
Finished: System.Xml.Linq.Streaming.Tests
=== TEST EXECUTION SUMMARY ===
Passes without JitStress (or with JitStress=2).
@dotnet/jit-contrib
Metadata
Metadata
Assignees
Labels
JitStressCLR JIT issues involving JIT internal stress modesarea-CodeGen-coreclrCLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMIblocking-clean-ci-optionalBlocking optional rolling runs
Activity
BruceForstall commentedon Oct 4, 2022
Similar failure in
net7.0-windows-Release-arm64-CoreCLR_checked-jitstress2-Windows.10.Arm64v8.Open,System.Text.Json.Nodes.Tests.ParentPathRootTests.GetPathAndRoot:AndyAyersMS commentedon Oct 5, 2022
I'll take a look.
AndyAyersMS commentedon Oct 5, 2022
For the first failure above, on arm64 windows at 144a33a,
JitStressRangeisolates this method:(there are possibly other methods that also lead to failures when stressed).
AndyAyersMS commentedon Oct 5, 2022
Fails with
There is a phi-based RBO. Disabling this opt fixes the problem. Debugging now to see if this transformation is wrong or enables something else downstream to go wrong.
AndyAyersMS commentedon Oct 6, 2022
Optimization seems like it is correct: in
BB06the nullcheck produces$1a1which is a non-null VN,BB08has a null test of that value, which will be false if control comes fromBB06.AndyAyersMS commentedon Oct 6, 2022
Looks like this is an issue where phi-based RBO leaves an invalid SSA graph that trips up assertion prop. Pre RBO we have
VN is able to prove that
V28.2can't be null, and so phi-based RBO is able to prove that if flow follows fromBB06 -> BB08it must then proceed toBB09. Post RBO we have updated the flow but not the SSA graph:Note that
BB09andBB10should now havePHInodes, but don't, and they are reading the wrong SSA defs.Assertion prop comes along and is now able to deduce that
V28.3is not zero inBB08which is not the case.I don't see an easy fix here yet. Phi-based RBO either needs to properly update SSA (which will be tricky given that dominators are now wrong, and we do not track where to find an SSA def's uses) or else avoid making changes in cases where the bypassed PHI value (
V28.03, here) is live outside of the jump threading block (BB08, here). Unfortunately we don't have accurate last-use info; copy prop messes this up.Given this issue and #76507 I am going to disable phi-based RBO for now while I think about whether it can be salvaged somehow.
JIT: disable phi based redundant branch opts
BruceForstall commentedon Oct 6, 2022
Presumably we could re-build SSA/VN after RBO (if necessary)? Also presumably that would be too expensive for JITing, but maybe ok for AOT?
BruceForstall commentedon Oct 6, 2022
Are there any post-phase asserts we could add for the SSA form, especially asserts that might have prevented this issue? E.g., simplistically, can we assert that the PHI arity must match the count of immediate predecessors?
AndyAyersMS commentedon Oct 6, 2022
SSA does not give us one phi arg per pred; it has one phi arg per reaching SSA def (see eg
SsaBuilder::AddPhiArgand callers). So there is no easy local check. This is something we should consider fixing, though there are some pathological cases where the phi arg list can grow very big (note: it can do this already, so the current "add if not found" logic will be quadratic for the right cases, but presumably the opt circuit breakers prevent us from getting burned too badly here).Even nicer perhaps would be to have the phi arg ordering reflect the pred list ordering. But this might be too painful to maintain if/when we decide to support some form of SSA update.
BruceForstall commentedon Oct 6, 2022
It seems like there are at least a few things relating preds and PHI args, though. E.g.,
?
BruceForstall commentedon Oct 6, 2022
I see
AddPhiArgsays:If phi args aren't 1-to-1 with preds then it seems like ordering is less interesting?
AndyAyersMS commentedon Oct 8, 2022
If the phi args name their preds (like they sort of do now) then ordering is not important.
Let me think about what sort of SSA checks we can plausibly do. I suspect we'll find that we very quickly do damage, and it will seem even more incautious to keep leveraging SSA the way we do now.
However perhaps we can track enough to allow a more limited form of the phi-disambiguation to be turned on (if we can show that no SSA update is needed). The main thing we need to know is if all the uses of a phi def are in the same block as the phi def.
JIT: disable phi based redundant branch opts (dotnet#76695)