Skip to content

JIT: revise inlinee block numbering, enable synthesis for inlinees #83610

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

Merged
merged 1 commit into from
Mar 20, 2023

Conversation

AndyAyersMS
Copy link
Member

Start numbering inlinee blocks from 1 instead of 1 + the root compiler's max BB num. Update inlinee block bbNums when they are inserted into the root compiler's graph.

Adjust computations in various places that knew about the old approach and looked from inlinee compiler to root compiler for bitset, epochs and the like.

Enable synthesis for inlinees, now that regular bitsets on inlinee compiler instances behave sensibly.

There is still some messiness around inlinees inheriting root compiler EH info which requires special checks. I will clean this up separately.

Fixes #82755.
Contributes to #82964.

enable synthesis for inlinees

Start numbering inlinee blocks from 1 instead of 1 + the root compiler's
max BB num. Update inlinee block bbNums when they are inserted into the
root compiler's graph.

Adjust computations in various places that knew about the old approach
and looked from inlinee compiler to root compiler for bitset, epochs and
the like.

Enable synthesis for inlinees, now that regular bitsets on inlinee compiler
instances behave sensibly.

There is still some messiness around inlinees inheriting root compiler
EH info which requires special checks. I will clean this up separately.

Fixes dotnet#82755.
Contributes to dotnet#82964.

enable synthesis for inlinees
@ghost ghost added the area-CodeGen-coreclr CLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI label Mar 17, 2023
@ghost ghost assigned AndyAyersMS Mar 17, 2023
@ghost
Copy link

ghost commented Mar 17, 2023

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

Issue Details

Start numbering inlinee blocks from 1 instead of 1 + the root compiler's max BB num. Update inlinee block bbNums when they are inserted into the root compiler's graph.

Adjust computations in various places that knew about the old approach and looked from inlinee compiler to root compiler for bitset, epochs and the like.

Enable synthesis for inlinees, now that regular bitsets on inlinee compiler instances behave sensibly.

There is still some messiness around inlinees inheriting root compiler EH info which requires special checks. I will clean this up separately.

Fixes #82755.
Contributes to #82964.

enable synthesis for inlinees

Author: AndyAyersMS
Assignees: -
Labels:

area-CodeGen-coreclr

Milestone: -

@AndyAyersMS
Copy link
Member Author

@jakobbotsch PTAL
cc @dotnet/jit-contrib

Should be no diff with default behavior. There are diffs with synthesis enabled.

@AndyAyersMS
Copy link
Member Author

AndyAyersMS commented Mar 18, 2023

No diffs, but shows a TP win, which is a bit unexpected.

Perhaps better block density in the bbNum space? Or a slower growth in fgBBNumMax (even though we renumber pretty often)?

@AndyAyersMS AndyAyersMS requested a review from jakobbotsch March 18, 2023 14:55
Copy link
Member

@jakobbotsch jakobbotsch left a comment

Choose a reason for hiding this comment

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

LGTM. Maybe run some stress?

@jakobbotsch
Copy link
Member

No diffs, but shows a TP win, which is a bit unexpected.

I was curious so I did a detailed TP run:

Base: 230604816272, Diff: 230161636846, -0.1922%

?compInit@Compiler@@QEAAXPEAVArenaAllocator@@PEAUCORINFO_METHOD_STRUCT_@@PEAVICorJitInfo@@PEAUCORINFO_METHOD_INFO@@PEAUInlineInfo@@@Z : 144304290  : +47.32%  : 18.68% : +0.0626%
?fgInsertInlineeBlocks@Compiler@@AEAAXPEAUInlineInfo@@@Z                                                                              : 15361212   : +5.08%   : 1.99%  : +0.0067%
?GetDescriptorForSwitch@Compiler@@QEAA?AUSwitchUniqueSuccSet@1@PEAUBasicBlock@@@Z                                                     : 4476052    : +5.51%   : 0.58%  : +0.0019%
?impImport@Compiler@@QEAAXXZ                                                                                                          : -2753802   : -0.77%   : 0.36%  : -0.0012%
?WalkSpanningTree@Compiler@@QEAAXPEAVSpanningTreeVisitor@@@Z                                                                          : -7157865   : -6.20%   : 0.93%  : -0.0031%
?fgRenumberBlocks@Compiler@@QEAA_NXZ                                                                                                  : -10770841  : -3.76%   : 1.39%  : -0.0047%
memcpy                                                                                                                                : -15466063  : -9.29%   : 2.00%  : -0.0067%
?allocateMemory@ArenaAllocator@@QEAAPEAX_K@Z                                                                                          : -17243298  : -0.35%   : 2.23%  : -0.0075%
?bbNewBasicBlock@Compiler@@QEAAPEAUBasicBlock@@W4BBjumpKinds@@@Z                                                                      : -26240701  : -7.04%   : 3.40%  : -0.0114%
?EnsureCoversInd@?$JitExpandArray@E@@IEAAXI@Z                                                                                         : -35773458  : -17.74%  : 4.63%  : -0.0155%
memset                                                                                                                                : -109241007 : -5.80%   : 14.14% : -0.0474%
?fgInit@Compiler@@QEAAXXZ                                                                                                             : -176797854 : -100.00% : 22.88% : -0.0767%
?InitializeRange@?$JitExpandArray@E@@IEAAXII@Z                                                                                        : -206210940 : -31.89%  : 26.69% : -0.0894%

The importer sizes impPendingBlockMembers, impSpillCliquePredMembers and impSpillCliqueSuccMembers according to fgBBNumMax so that's probably where it's coming from.

@AndyAyersMS
Copy link
Member Author

/azp run runtime-coreclr jitstress

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@AndyAyersMS AndyAyersMS merged commit de1a204 into dotnet:main Mar 20, 2023
@ghost ghost locked as resolved and limited conversation to collaborators Apr 20, 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.

JIT: it is difficult to do flow analysis on inlinees
2 participants