dotnet / runtime

.NET is a cross-platform runtime for cloud, mobile, desktop, and IoT apps.
https://docs.microsoft.com/dotnet/core/
MIT License
15.46k stars 4.76k forks source link

Assertion failed 'markedLastLoop && markedCurrLoop' #107518

Open BruceForstall opened 2 months ago

BruceForstall commented 2 months ago

pipeline: runtime-coreclr jitstress-random job: coreclr windows x86 Checked jitstress_random_1 test: managed/Compilation/Compilation/Compilation.cmd

set DOTNET_TieredCompilation=0
set DOTNET_JitStress=2be
C:\h\w\B8160A1E\p\watchdog.exe" 119 "C:\h\w\B8160A1E\p\corerun.exe" -p "System.Reflection.Metadata.MetadataUpdater.IsSupported=false" -p "System.Runtime.Serialization.EnableUnsafeBinaryFormatterSerialization=true"  Managed.dll 
19:49:13.347 Running test: managed/Compilation/Compilation/Compilation.cmd

Assert failure(PID 5788 [0x0000169c], Thread: 5524 [0x1594]): Assertion failed 'markedLastLoop && markedCurrLoop' in 'Microsoft.CodeAnalysis.CSharp.Symbols.SourceMemberContainerTypeSymbol:ForceComplete(Microsoft.CodeAnalysis.SourceLocation,System.Threading.CancellationToken):this' during 'Generate code' (IL size 877; hash 0xba50a687; FullOpts)

    File: D:\a\_work\1\s\src\coreclr\jit\emit.cpp:6067
    Image: C:\h\w\B8160A1E\p\corerun.exe

https://dev.azure.com/dnceng-public/public/_build/results?buildId=801287&view=ms.vss-test-web.build-test-results-tab

@dotnet/jit-contrib

dotnet-policy-service[bot] commented 2 months ago

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

JulieLeeMSFT commented 2 months ago

@BruceForstall PTAL.

amanasifkhalid commented 2 months ago

@BruceForstall #107371 or #107403 might have exposed this

BruceForstall commented 2 months ago

@BruceForstall #107371 or #107403 might have exposed this

I can repro the failure both before and after these PRs. (I tried 42f3dceae23a5c7acb5d3cb8e0419e1195911956, just before the first of those)

BruceForstall commented 2 months ago

I verified this repros on .NET 9.

amanasifkhalid commented 2 months ago

@BruceForstall I'm not able to repro this using a mainline build or the build from the failing CI run. I'm not sure if this is CPU-sensitive or not, but out of curiosity, what hardware did you repro this on?

BruceForstall commented 2 months ago

@amanasifkhalid Here's my repro:

set DOTNET_TieredCompilation=0
set DOTNET_JitStress=2be
set CORE_ROOT=c:\gh\runtime\artifacts\tests\coreclr\windows.x86.Checked\Tests\Core_Root
c:\gh\runtime\artifacts\tests\coreclr\windows.x86.Checked\Tests\Core_Root\corerun.exe C:\gh\runtime\artifacts\tests\coreclr\windows.x64.Checked\managed\Compilation\Compilation\Compilation.dll

(I only build the tests for x64 Checked, but that shouldn't matter.)

It does NOT fail if you use windows.x86.Debug. I'm testing on an Intel DevBox (AVX-512 capable).

BruceForstall commented 2 months ago

This failure only exists with JitOptRepeat (which is enabled by the stress mode on this test). Setting set DOTNET_JitEnableOptRepeat=0 resolves the failure.

Since OptRepeat is not enabled in .NET 9, this is a .NET 10 issue.

JulieLeeMSFT commented 1 month ago

@kunalspathak, it is related to loop alignment. PTAL.