RFR: 8254317: C2: Resource consumption of ConvI2LNode::Ideal() grows exponentially
Roberto Castañeda Lozano
rcastanedalo at openjdk.java.net
Mon Oct 19 09:21:21 UTC 2020
On Mon, 19 Oct 2020 08:45:28 GMT, Roberto Castañeda Lozano <rcastanedalo at openjdk.org> wrote:
>> In the optimization ConvI2L(AddI(x, y)) -> AddL(ConvI2L(x), ConvI2L(y)) within `ConvI2LNode::Ideal()`, handle the
>> special case x = y by feeding both inputs of AddL from a single ConvI2L node rather than creating two semantically
>> equivalent ConvI2L nodes. This avoids an exponential number of calls to `ConvI2LNode::Ideal()` when dealing with long
>> chains of AddI nodes. Disable the optimization for the pattern ConvI2L(SubI(x, x)), which is simplified to zero during
>> parsing anyway. Add a set of regression tests for the transformation that cover different shapes of AddI subgraphs.
>> Also add a microbenchmark that exercises the special case, for performance regression testing.
>
> Tested on tier1-3 on windows-x64, linux-x64, linux-aarch64, and macosx-x64 in both release and debug mode.
The microbenchmark gives the following results before and after the proposed fix (linux-x86_64-server-release build run
on Intel Core i7-9850H CPU @ 2.60GHz with 32 GB main memory): | Version | Mode | Cnt | Score | Error | Units |
|---|---|---|---|---|---|
| before the fix | ss | 10 | 15402.110 | 171.255 | ms/op |
| after the fix | ss | 10 | 0.976 | 0.069 | ms/op |
"Single-shot" (ss) benchmarking mode is used here because the focus is on measuring C2 execution time.
-------------
PR: https://git.openjdk.java.net/jdk/pull/727
More information about the hotspot-compiler-dev
mailing list