Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JIT: fix inliner profile consistency computation #109714

Merged
merged 4 commits into from
Nov 13, 2024

Conversation

AndyAyersMS
Copy link
Member

@AndyAyersMS AndyAyersMS commented Nov 12, 2024

It's possible for the JIT to inline a profiled inlinee into an unprofiled context, and then have a subsequent inline fold a profiled branch. If so we may see a case where the folded edges don't have profile information.

Tolerate this.

Fixes #109657

Re-morphing of a statement during early-prop may mistakenly believe it has altered the flow graph and so invalidates DFS. Value numbering is not set up to handle this and crashes. Since this seems like a rare occurrence, have morph detect if it has really changed the flowgraph and avoid invalidating the DFS when it hasn't.

Fixes #109730

It's possible for the JIT to inline a profiled inlinee into an unprofiled
context, and then have a subsequent inline fold a profiled branch. If so
we may see a case where the folded edges don't have profile information.

Tolerate this.
@dotnet-issue-labeler dotnet-issue-labeler bot added the area-CodeGen-coreclr CLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI label Nov 12, 2024
@AndyAyersMS
Copy link
Member Author

cc @dotnet/jit-contrib
@amanasifkhalid PTAL

There is some other libraries jitstress issue, so it still may not run cleanly.

@AndyAyersMS
Copy link
Member Author

/azp run runtime-coreclr libraries-jitstress

Copy link

Azure Pipelines successfully started running 1 pipeline(s).

Copy link
Member

@amanasifkhalid amanasifkhalid left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks!

There is some other libraries jitstress issue, so it still may not run cleanly.

Do you know if there's an issue already tracking this? I'm seeing quite a few tests fail with AVs.

@AndyAyersMS
Copy link
Member Author

LGTM, thanks!

There is some other libraries jitstress issue, so it still may not run cleanly.

Do you know if there's an issue already tracking this? I'm seeing quite a few tests fail with AVs.

I just opened one: #109730

@AndyAyersMS
Copy link
Member Author

Not sure why build analysis is unhappy here...

@amanasifkhalid
Copy link
Member

amanasifkhalid commented Nov 12, 2024

Not sure why build analysis is unhappy here...

I suspect it's because there aren't tracking issues for the timeouts, and opening a meta-issue to capture all timeouts isn't ideal.

Edit: Ah, Build Analysis marked the timeouts as "known" infra issues. Not sure either.

@AndyAyersMS
Copy link
Member Author

AndyAyersMS commented Nov 12, 2024

I added a fix for the AVs, so let's see if libraries jit stress is now happy.

@AndyAyersMS
Copy link
Member Author

/azp run runtime-coreclr libraries-jitstress

Copy link

Azure Pipelines successfully started running 1 pipeline(s).

Copy link
Member

@amanasifkhalid amanasifkhalid left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AV fix LGTM

@AndyAyersMS
Copy link
Member Author

Jitutils build is failing, wonder if 6.0 packages are no longer findable? 6.0 is out of support now.

Determining projects to restore...
/__w/runtime/runtime/jitutils/src/jit-dasm/jit-dasm.csproj : error NU1102: Unable to find package Microsoft.NETCore.App.Runtime.linux-x64 with version (= 6.0.36)
/__w/runtime/runtime/jitutils/src/jit-dasm/jit-dasm.csproj : error NU1102:   - Found 1562 version(s) in dotnet7 [ Nearest version: 7.0.0-alpha.1.21[41](https://github.com/dotnet/runtime/actions/runs/11804422106/job/32884591447?pr=109714#step:5:42)7.28 ]
/__w/runtime/runtime/jitutils/src/jit-dasm/jit-dasm.csproj : error NU1102:   - Found 174 version(s) in dotnet-public [ Nearest version: 7.0.0-preview.1.22076.8 ]
/__w/runtime/runtime/jitutils/src/jit-dasm/jit-dasm.csproj : error NU1102:   - Found 0 version(s) in dotnet-libraries
/__w/runtime/runtime/jitutils/src/jit-dasm/jit-dasm.csproj : error NU1102:   - Found 0 version(s) in myget-legacy
  Failed to restore /__w/runtime/runtime/jitutils/src/jit-dasm/jit-dasm.csproj (in 1.28 sec).

@AndyAyersMS
Copy link
Member Author

libraries-jitstress still not clean:

Assert failure(PID 4116 [0x00001014], Thread: 9356 [0x248c]): Assertion failed 'doesVNMatch' in 'System.Collections.Immutable.Tests.ImmutableArrayTest+<ChangeType>d__192`1[int]:MoveNext():ubyte:this' during 'Assertion prop' (IL size 362; hash 0x08aa2d36; FullOpts)

    File: D:\a\_work\1\s\src\coreclr\jit\assertionprop.cpp:1486
    Image: C:\h\w\A3450896\p\dotnet.exe

Opened #109745

@AndyAyersMS
Copy link
Member Author

handful of Diffs... not sure why yet.

@AndyAyersMS
Copy link
Member Author

Diffs are because fgConvertBBtoThrowBB also makes the block rare. So revising the fix a bit to preserve this behavior.

@AndyAyersMS AndyAyersMS merged commit 714c5a0 into dotnet:main Nov 13, 2024
108 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-CodeGen-coreclr CLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI
Projects
None yet
Development

Successfully merging this pull request may close these issues.

JIT: libraries jitstress AV failures Libraries jitstress: Assertion failed 'target->hasProfileWeight()'
2 participants