RFR: 8272873: C2: Inlining should not depend on absolute call site counts
Igor Veresov
iveresov at openjdk.java.net
Tue Aug 24 17:07:30 UTC 2021
On Tue, 24 Aug 2021 17:00:39 GMT, Vladimir Kozlov <kvn at openjdk.org> wrote:
>> C2 considers absolute call site counts in its inlining decisions, which seems very wrong considering the asynchronous nature of profiling and background compilation (See InlineTree::should_inline()). It causes substantial over-inlining, which in presence of a depth-first inlining can lead to an early cut off. It also is inherently unstable. C2 already uses call frequency as an additional factor and it's better to consider only that in the inlining heuristic. I did extensive benchmarking it yielded almost no losses and single-digit wins (up to 5%) on some benchmarks. I think it's safe to remove/deprecate InlineFrequencyCount and continue using InlineFrequencyRatio instead. I found that converting the frequency computation to FP and setting InlineFrequencyRatio=0.25 (inline a method that is called a least 25% of the time) works best.
>
> src/hotspot/share/runtime/globals.hpp line 1407:
>
>> 1405: range(0, max_jint) \
>> 1406: \
>> 1407: product_pd(intx, InlineFrequencyCount, DIAGNOSTIC, \
>
> You need to file CSR to remove product flag.
It's a diagnostic flag, so it doesn't need a CSR.
> test/lib-test/jdk/test/whitebox/vm_flags/IntxTest.java line 39:
>
>> 37: public class IntxTest {
>> 38: private static final String FLAG_NAME = "OnStackReplacePercentage";
>> 39: private static final String FLAG_DEBUG_NAME = "BciProfileWidth";
>
> Why this addition for `BciProfileWidth`?
This test requires any diagnostic intx flag. I just found the first available.
-------------
PR: https://git.openjdk.java.net/jdk/pull/5238
More information about the hotspot-compiler-dev
mailing list