Repository navigation
Assertion failed 'nonVarPtrRegs == RBM_NONE' #37223
Copy link
Copy link
Labels
JitStressCLR JIT issues involving JIT internal stress modesCLR JIT issues involving JIT internal stress modesarch-arm32area-CodeGen-coreclrCLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMICLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMIos-windows
Milestone
Description
Failure in libraries System.Threading.Tasks.Dataflow.Tests: release libraries, checked coreclr with:
COMPlus_TieredCompilation=0
COMPlus_JitStress=2
COMPlus_JitStressRegs=4
Windows arm32
E.g.,
build -s libs+libs.tests -runtimeConfiguration checked -c Release -arch arm /p:ArchiveTests=true
(the /p:ArchiveTests=true is required to build the RunTests.cmd wrapper scripts)
c:\bugs\System.Threading.Tasks.Dataflow.Tests\net5.0-Release>call .\RunTests.cmd -r C:\bugs\testhost\net5.0-Windows_NT-Release-arm
----- start Sun 05/31/2020 13:04:02.26 =============== To repro directly: =====================================================
pushd c:\bugs\System.Threading.Tasks.Dataflow.Tests\net5.0-Release\
"C:\bugs\testhost\net5.0-Windows_NT-Release-arm\dotnet.exe" exec --runtimeconfig System.Threading.Tasks.Dataflow.Tests.runtimeconfig.json --depsfile System.Threading.Tasks.Dataflow.Tests.deps.json xunit.console.dll System.Threading.Tasks.Dataflow.Tests.dll -xml testResults.xml -nologo -nocolor -notrait category=IgnoreForCI -notrait category=OuterLoop -notrait category=failing
popd
===========================================================================================================
c:\bugs\System.Threading.Tasks.Dataflow.Tests\net5.0-Release>"C:\bugs\testhost\net5.0-Windows_NT-Release-arm\dotnet.exe" exec --runtimeconfig System.Threading.Tasks.Dataflow.Tests.runtimeconfig.json --depsfile System.Threading.Tasks.Dataflow.Tests.deps.json xunit.console.dll System.Threading.Tasks.Dataflow.Tests.dll -xml testResults.xml -nologo -nocolor -notrait category=IgnoreForCI -notrait category=OuterLoop -notrait category=failing
Discovering: System.Threading.Tasks.Dataflow.Tests (method display = ClassAndMethod, method display options = None)
Discovered: System.Threading.Tasks.Dataflow.Tests (found 290 of 297 test cases)
Starting: System.Threading.Tasks.Dataflow.Tests (parallel test collections = on, max threads = 8)
Regset after BB27 gcr=0001 {r0}, byr=0000 {}, regVars=0004 {r2}
Assert failure(PID 12028 [0x00002efc], Thread: 6680 [0x1a18]): Assertion failed 'nonVarPtrRegs == RBM_NONE' in 'System.Collections.Generic.Dictionary`2[Int64,KeyValuePair`2][System.Int64,System.Collections.Generic.KeyValuePair`2[System.Boolean,System.__Canon]]:Remove(long):bool:this' during 'Generate code' (IL size 356)
File: C:\gh\runtime\src\coreclr\src\jit\codegenlinear.cpp Line: 509
Image: C:\bugs\testhost\net5.0-Windows_NT-Release-arm\dotnet.exe
----- end Sun 05/31/2020 13:04:13.92 ----- exit code -1073740286 ----------------------------------------------------------
category:correctness
theme:elt-hooks
skill-level:intermediate
cost:medium
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
JitStressCLR JIT issues involving JIT internal stress modesCLR JIT issues involving JIT internal stress modesarch-arm32area-CodeGen-coreclrCLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMICLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMIos-windows
Activity
BruceForstall commentedon May 31, 2020
@CarolEidt
BruceForstall commentedon Jul 18, 2020
After #39335, this is back:
https://dev.azure.com/dnceng/public/_build/results?buildId=736732&view=ms.vss-test-web.build-test-results-tab&runId=22818242&resultId=173953&paneView=dotnet-dnceng.dnceng-build-release-tasks.helix-test-information-tab
CarolEidt commentedon Jul 20, 2020
@AndyAyersMS - the failure can be duplicated using the arm altjit on 32-bit Windows. Not all the methods behave nicely with the altjit, but if you set
COMPlus_AltJit=Remove(andCOMPlus_AltJitName=protononjit.dllplus the variables mentioned above), you can duplicate the assert.2 remaining items
AndyAyersMS commentedon Jul 21, 2020
Issue seems to be that R2 is considered live throughout a return block as it holds a kept-alive this. Thus when armarch's
genProfilingLeaveCallbacktries to update R2's GC liveness to be non-gc , the update is ignored bygcMarkRegSetNptas it will not modify live registers to be non-gc. So R2 remains gc live and hence the assert.Seems like the fix is that for arm, we need to make sure kept-alive this intervals interfere with the profiler scratch reg in return blocks, if we're adding a profiler exit hook, so that R2 is not live at the point we want to insert the leave callback, and the this pointer is still properly reported live at that point.
AndyAyersMS commentedon Jul 21, 2020
Relevant part of the jitdump, during codegen, with a bit of extra logging I added. Note after "Moving R0 to R2 around leave profiler callback" there is no GC update for R2, it remains GC live, and that V00 == R2 is live throughout.
AndyAyersMS commentedon Jul 21, 2020
it occurs to me that ensuring R2 was free was what #37679 was after, so I'll take a look at where that went wrong; perhaps it's a similar GC liveness transfer issue...?
AndyAyersMS commentedon Jul 29, 2020
Simple repro:
On linux arm32, run with
CarolEidt commentedon Jul 29, 2020
Yes, that's what I was trying to accomplish, and I was surprised that it went wrong, since I didn't think that codegen paid attention to that killset. Another option to accomplish the same thing might be to allocate an internal register, and force it to use R2. That will cause it to interfere with anything else live at that point. However, I'm still not sure how what was wrong with the kill approach.
AndyAyersMS commentedon Jul 29, 2020
Working on this now ... have restored your change and about to debug into one of the failures it causes.
AndyAyersMS commentedon Jul 30, 2020
With #37679 restored, I can get JIT/Directed/refbyref/ref2iu_il_d/ref2iu_il_d.dll to crash readily under jitstress/gcstress as in the top message here. One method that has issues is MethodInfo.CreateDelegate.
Here's the relevant bit of the codegen dump. It appears
r2gets GC killed too early; it needs to remain gc-live across the call.AndyAyersMS commentedon Jul 30, 2020
Suspect it's because we've added R2 to
RBM_PROFILER_LEAVE_TRASHto avoid having LSRA allocate it across the call, but this also has the side effect of killing the GC ref in R2 when we do gc liveness.So we can either forcefully revive R2 in our custom handling (armarch's
genProfilingLeaveCallback) or else special case this in lsra. Will try the former to see if it works.AndyAyersMS commentedon Jul 30, 2020
Seems like #37679 plus
will do the trick.
For arm32, kill REG_PROFILER_RET_SCRATCH for LSRA but not for GC (#40123
For arm32, kill REG_PROFILER_RET_SCRATCH for LSRA but not for GC (dot…