Skip to content

Conversation

tannergooding
Copy link
Member

This updates Compiler::fgFindJumpTargets to support resolving call tokens when making inline observations for Tier 1.

A test of csc compiling a simple HelloWorld program (csc.dll Program.cs /r:System.Runtime.dll /r:System.Console.dll /r:System.Private.Corelib.dll) with COMPlus_ReadyToRun=0 and COMPlus_TieredCompilation=0 resulted in the following impact:

  • Compiler::fgFindJumpTarget goes from 0.48% to 0.63% of instructions retired (28.5m to 39.25m)
  • CEEInfo::resolveToken goes from 0.32% to 0.34% of instructions retired (19m to 21m)
  • CEEInfo::getCallInfo goes from 0.36% to 0.32% of instructions retired (21.25m to 19.75m)

As per the flame graph (see below), the majority of time is still spent in the backend. There was no measured impact for tier 0 methods.
image

This change will allow us to make potential improvements to inlining for methods that involve many intrinsic calls. Some potential metrics we could use to influence inlining include:

  • How many calls are intrinsic (Named or Otherwise)
  • How many calls are hwintrinsic and therefore are not calls at all, but are effectively "simple ops"
  • How many calls are CSE or constant folding candidates (such as Math calls)
  • How many calls are "constants" like Isa.IsSupported
  • How many calls are potential constants, like string.Length or Type.op_Equality checks

We can place this behind a DOTNET_* (COMPlus_*) switch if there are any remaining concerns around impact.

…argets when in Tier1 making inline observations
…True/False as constants in fgFindJumpTargets
@ghost ghost added the area-CodeGen-coreclr CLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI label Apr 3, 2021
@tannergooding
Copy link
Member Author

This change produced zero PMI diffs for frameworks, benchmarks and tests. #50426 contains more details that led up to this PR.

CC. @jkotas, @AndyAyersMS

@tannergooding
Copy link
Member Author

Any other feedback/changes needed here?

Copy link
Member

@AndyAyersMS AndyAyersMS left a comment

Choose a reason for hiding this comment

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

No -- looks good.

@tannergooding tannergooding merged commit e9e8bc7 into dotnet:main Apr 5, 2021
thaystg added a commit to thaystg/runtime that referenced this pull request Apr 6, 2021
…shim_mono

# By Aaron Robinson (10) and others
# Via GitHub
* upstream/main: (108 commits)
  [mbr] Add Apple sample (dotnet#50740)
  make EstablishProxyTunnelAsync throw on failure status code from proxy (dotnet#50763)
  Improve RGB Min Max evaluation performance by using 2 or 3 comparison… (dotnet#50622)
  [mono] More domain cleanups (dotnet#50479)
  Fix Crossgen2 of PlatformDefaultMemberFunction methods and calls. (dotnet#50754)
  Disable EventSource generator in design-time builds (dotnet#50741)
  Fix X509 test failures on Android (dotnet#50301)
  Do not confuse fgDispBasicBlocks in fgMorphBlocks (dotnet#50703)
  Enforce 64KB event payload size limit on EventPipe  (dotnet#50600)
  Reorganize CoreCLR native build to reduce CMake reconfigures when the build system is untouched (dotnet#49906)
  [mbr] Turn on hot reload for iOS, tvOS and MacCatalyst (dotnet#50458)
  improve connection scavenge logic by doing zero-byte read (dotnet#50545)
  Resolve call mdtokens when making tier 1 inline observations (dotnet#50675)
  Annotate APIs in System.Private.Xml (dotnet#49682)
  Support compiling against OpenSSL 3 headers
  Change Configuration.Json to use a regular Dictionary. (dotnet#50611)
  Remove unused BigNumFromBinary P/Invoke (dotnet#50670)
  Make Ninja the default CMake generator on Windows for the repo (dotnet#49715)
  [AppleAppBuilder] Entitlements to run tests on catalyst using the JIT (dotnet#50637)
  [mono] Fix delegate invokes to dynamic methods in mixed mode. (dotnet#50547)
  ...

# Conflicts:
#	src/mono/dlls/mscordbi/CMakeLists.txt
@JulieLeeMSFT JulieLeeMSFT added this to the 6.0.0 milestone Apr 15, 2021
@ghost ghost locked as resolved and limited conversation to collaborators May 15, 2021
@tannergooding tannergooding deleted the resolve-tokens-inline branch July 1, 2025 14:39
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.

4 participants