Integrated: 8344130: C2: Avoid excessive hoisting in scheduler due to minuscule differences in block frequency
Daniel Lundén
dlunden at openjdk.org
Tue Jan 14 10:26:52 UTC 2025
On Wed, 18 Dec 2024 13:41:41 GMT, Daniel Lundén <dlunden at openjdk.org> wrote:
> `PhaseCFG::is_cheaper_block` can sometimes excessively hoist instructions through blocks due to minuscule differences in block frequency, even when the differences are likely caused by numerical imprecision in the block frequency computations. We saw an example of where such excessive hoisting stressed the register allocator in [JDK-8331295](https://bugs.openjdk.org/browse/JDK-8331295), but that issue was in fact two issues: one in the matcher (solved in [JDK-8331295](https://bugs.openjdk.org/browse/JDK-8331295)) and one in the scheduler (this issue).
>
> ### Changeset
>
> Add a small delta to the frequency comparison in `PhaseCFG::is_cheaper_block`. Note that a frequency comparison using the delta is already available in the function when making sure a hoist due to latency does not result in a higher (worse) frequency. I cannot see any reason for why we should not use the same delta in the first block frequency comparison.
>
> I do not include a regression test since I have not found a good one specific to this issue. I have verified that this fix is an alternative solution to solve the failure in [JDK-8331295](https://bugs.openjdk.org/browse/JDK-8331295) (for which tests are already present). I also documented the verification steps in the issue description in JBS.
>
> ### Testing
>
> - [GitHub Actions](https://github.com/dlunde/jdk/actions/runs/12181425502)
> - `tier1` to `tier4` (and additional Oracle-internal testing) on Windows x64, Linux x64, Linux aarch64, macOS x64, and macOS aarch64.
> - Performance testing using DaCapo, SPECjbb, and SPECjvm on Windows x64, Linux x64, Linux aarch64, macOS x64, and macOS aarch64. No significant improvements nor regressions.
This pull request has now been integrated.
Changeset: cbb2b847
Author: Daniel Lundén <dlunden at openjdk.org>
URL: https://git.openjdk.org/jdk/commit/cbb2b847e48c970297c2142a0675918b364e7987
Stats: 6 lines in 1 file changed: 3 ins; 1 del; 2 mod
8344130: C2: Avoid excessive hoisting in scheduler due to minuscule differences in block frequency
Reviewed-by: rcastanedalo, kvn
-------------
PR: https://git.openjdk.org/jdk/pull/22810
More information about the hotspot-compiler-dev
mailing list