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: Reorder physical promotion and forward sub #87265

Merged
merged 2 commits into from
Jun 9, 2023

Conversation

jakobbotsch
Copy link
Member

Physical promotion breaks more forward sub opportunities than it introduces, so reorder these phases. Then teach physical promotion to recognize when it creates new opportunities and selectively reinvoke forward sub for just those cases.

Physical promotion breaks more forward sub opportunities than it
introduces, so reorder these phases. Then teach physical promotion to
recognize when it creates new opportunities and selectively reinvoke
forward sub for just those cases.
@ghost ghost assigned jakobbotsch Jun 8, 2023
@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 Jun 8, 2023
@ghost
Copy link

ghost commented Jun 8, 2023

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

Issue Details

Physical promotion breaks more forward sub opportunities than it introduces, so reorder these phases. Then teach physical promotion to recognize when it creates new opportunities and selectively reinvoke forward sub for just those cases.

Author: jakobbotsch
Assignees: jakobbotsch
Labels:

area-CodeGen-coreclr

Milestone: -

@jakobbotsch
Copy link
Member Author

Many of the regressions seem to be because the new forward subs sometimes mean we stop physically promoting in some beneficial cases. Often because the candidate struct became a call arg.

@jakobbotsch jakobbotsch mentioned this pull request Jun 8, 2023
40 tasks
@jakobbotsch
Copy link
Member Author

/azp run runtime-coreclr jitstress, runtime-coreclr libraries-jitstress, runtime-jit-experimental

@azure-pipelines
Copy link

Azure Pipelines successfully started running 3 pipeline(s).

@jakobbotsch jakobbotsch marked this pull request as ready for review June 8, 2023 19:04
@jakobbotsch
Copy link
Member Author

jakobbotsch commented Jun 8, 2023

Pending CI runs are linux ones that I expect will time out due to the current CI issues. The jitstress failures are #84006, #84911.

cc @dotnet/jit-contrib PTAL @AndyAyersMS

Quite good diffs. With physical promotion.. Without old promotion.

As mentioned above, many of the regressions are because of cases where we now no longer physically promote, often because we forward sub a struct use into an argument position, and that makes it more expensive to promote in the eyes of physical promotion. Other cases are more usual ones that come from more forward sub.

@jakobbotsch
Copy link
Member Author

CI is hitting an assert in some tier0-FullOpts code that I need to investigate.

jakobbotsch added a commit to jakobbotsch/runtime that referenced this pull request Jun 9, 2023
gtGetClassHandle has comments about "Tunnel through commas", yet several
of the cases then do not actually use the effective value, resulting in
possible asserts when this function is passed a comma.

Fixes an issue I saw in dotnet#87265 when morph invokes gtFoldTypeCompare for
the following IR:

```
fgMorphTree BB19, STMT00013 (before)
               [000045] -ACXG------                         *  JTRUE     void
               [000044] -ACXG------                         \--*  NE        int
               [000623] -ACXG------                            +--*  COMMA     ref
               [000622] DA---------                            |  +--*  STORE_LCL_VAR ref    V29 tmp18
               [000621] -----------                            |  |  \--*  LCL_FLD   ref    V07 loc3         [+0]
               [000041] -ACXG------                            |  \--*  CALL nullcheck ref    Microsoft.Extensions.Configuration.Test.ConfigurationProviderTestBase+TestKeyValue:get_AsArray():System.String[]:this
               [000620] -A--------- this                       |     \--*  COMMA     ref
               [000619] DA---------                            |        +--*  STORE_LCL_VAR ref    V30 tmp19
               [000618] -----------                            |        |  \--*  LCL_FLD   ref    V07 loc3         [+8]
               [000617] -----------                            |        \--*  LCL_VAR   ref    V30 tmp19
               [000043] -----------                            \--*  CNS_INT   ref    null
```
jakobbotsch added a commit that referenced this pull request Jun 9, 2023
gtGetClassHandle has comments about "Tunnel through commas", yet several
of the cases then do not actually use the effective value, resulting in
possible asserts when this function is passed a comma.

Fixes an issue I saw in #87265 when morph invokes gtFoldTypeCompare for
the following IR:

```
fgMorphTree BB19, STMT00013 (before)
               [000045] -ACXG------                         *  JTRUE     void
               [000044] -ACXG------                         \--*  NE        int
               [000623] -ACXG------                            +--*  COMMA     ref
               [000622] DA---------                            |  +--*  STORE_LCL_VAR ref    V29 tmp18
               [000621] -----------                            |  |  \--*  LCL_FLD   ref    V07 loc3         [+0]
               [000041] -ACXG------                            |  \--*  CALL nullcheck ref    Microsoft.Extensions.Configuration.Test.ConfigurationProviderTestBase+TestKeyValue:get_AsArray():System.String[]:this
               [000620] -A--------- this                       |     \--*  COMMA     ref
               [000619] DA---------                            |        +--*  STORE_LCL_VAR ref    V30 tmp19
               [000618] -----------                            |        |  \--*  LCL_FLD   ref    V07 loc3         [+8]
               [000617] -----------                            |        \--*  LCL_VAR   ref    V30 tmp19
               [000043] -----------                            \--*  CNS_INT   ref    null
```
@jakobbotsch
Copy link
Member Author

/azp run runtime-coreclr libraries-jitstress

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@jakobbotsch jakobbotsch merged commit 8f6af6e into dotnet:main Jun 9, 2023
@jakobbotsch jakobbotsch deleted the physical-promotion-forwardsub branch June 9, 2023 20:53
@ghost ghost locked as resolved and limited conversation to collaborators Jul 10, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
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.

2 participants