You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 0055ffd
Browse filesBrowse the repository at this point in the historyBrowse files
Don't require GDV targets to be inlineable (#132375)
GDV used to bail out when the target wasn't inlineable. A direct call
still beats a virtual one, so keep the candidate and just don't inline
it. `DOTNET_JitGuardedDevirtualizationRequireInlining=1` restores the
old behavior. Class probes only.
I know it doesn't match Andy's numbers, but many things have changed
since then (e.g. CET), also, I assume we never tested it on arm64. So
far it's a pure improvement on most kinds of scenarious (interface,
virtual calls, etc.), see benchmarks below. We still might want to avoid
doing it for virtual calls (esp for large target methods where the cost
of the type check + direct call is a noise anyway) only on CoreCLR, but
I propose we do it for everything and watch dotnet/performance reports.
Should help NativeAOT the most, where `getExactClasses` gives exact
devirtualization but targets often aren't inlineable (if at least one
target of `getExactClasses` wasn't inlineable we used to bail on the
whole thing).
CoreCLR, default env, all targets `[NoInlining]` (so baseline does no
GDV at all). Columns = how often the guessed type hits, ratio =
new/base, lower is better.
| Benchmark | Mono | Hit90 | Hit50 | Hit33 | Hit25 |
|---|---|---|---|---|---|
| `DirectControl` (noise floor) | 1.01 | 0.99 | 1.01 | 1.01 | 1.00 |
| `Interface` | $\color{green}{0.72}$ | $\color{green}{0.48}$ |
$\color{green}{0.45}$ | $\color{green}{0.64}$ | $\color{green}{0.56}$ |
| `InterfaceShared` (`__Canon`) | $\color{green}{0.88}$ |
$\color{green}{0.50}$ | $\color{green}{0.51}$ | $\color{green}{0.62}$ |
$\color{green}{0.59}$ |
| `InterfaceCostlyTarget` | $\color{green}{0.86}$ |
$\color{green}{0.58}$ | $\color{green}{0.55}$ | $\color{green}{0.65}$ |
$\color{green}{0.60}$ |
| `Virtual` | $\color{green}{0.86}$ | $\color{green}{0.78}$ |
$\color{green}{0.63}$ | $\color{green}{0.64}$ | $\color{green}{0.62}$ |
| `VirtualShared` (`__Canon`) | $\color{red}{1.19}$ |
$\color{green}{0.55}$ | $\color{green}{0.55}$ | $\color{green}{0.52}$ |
$\color{green}{0.63}$ |
| `InterfaceHugeTarget` (GDV in both) | 1.10 | 1.10 | 1.03 | 1.01 | 1.00
|
Only regression is monomorphic shared-generic virtual - a well-predicted
vtable call is already as cheap as compare+direct call.
rt-sz report: MichalStrehovsky/rt-sz#246
smoke-test benchmarks:
EgorBot/Benchmarks#489 (comment)
---------
Co-authored-by: Copilot <[email protected]>
Copilot-Session: 38498b8d-c116-4637-b069-d1d275634193
0 commit comments