Skip to content

Support profile instrumentation for inlinees #44372

Open
@AndyAyersMS

Description

@AndyAyersMS

The jit and runtime currently do not support instrumenting (BBINSTR) of inlined code. Enabling this may prove useful for a number of reasons -- for example we are currently not be able to observe the behavior of methods marked with aggressive inline attributes.

(This doesn't impact dynamic PGO as it instruments Tier0 code where inlining is disabled).

Outline of how to fix this:

  • update the jit interface so we can pass a method handle to allocMethodBlockCounts (or introduce a new method)
  • update jit interface implementation so that if a method already has a count buffer allocated, it is returned. We will need some way to map from method to profile data.
  • update the jit to pass the BBINSTR flag to inlinees, if the root method has it set.
  • verify the jit does reasonable things in inlinees when the BBINSTR flag is set.

We could consider keeping inlinee counts separate from root method counts to avoid perturbing current IBC computations (collating all counts in one buffer will change which methods are considered hot by IBC). If we do this then count request and retrieval also need to be updated so the jit can indicate if it wants the counts for a root method or the counts for an inlinee. However this may make it hard to persist out the inlinee data as tooling is not expecting two sets of counts for methods.

At the same time we might want to suppress instrumentation for single-block inlinees to reduce the volume and runtime cost of counts.

So initially inlinee counts should be optional behavior until we can assess impact on IBC.

category:cq
theme:inlining

Metadata

Metadata

Assignees

Labels

area-CodeGen-coreclrCLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI

Type

No type

Projects

Status

Team User Stories

Relationships

None yet

Development

No branches or pull requests

Issue actions