RFR: 8307513: C2: intrinsify Math.max(long,long) and Math.min(long,long) [v3]
Galder Zamarreño
galder at openjdk.org
Wed Oct 9 11:07:59 UTC 2024
On Mon, 30 Sep 2024 10:35:35 GMT, Tobias Hartmann <thartmann at openjdk.org> wrote:
> You've probably seen this but the new test is failing IR verification:
>
> ```
> Failed IR Rules (4) of Methods (4)
> ----------------------------------
> 1) Method "private static double compiler.intrinsics.math.TestMinMaxInlining.testDoubleMax(double,double)" - [Failed IR rules: 1]:
> * @IR rule 1: "@compiler.lib.ir_framework.IR(phase={DEFAULT}, applyIfPlatformAnd={}, applyIfCPUFeatureOr={}, counts={"_#MAX_D#_", "1"}, failOn={}, applyIfPlatform={}, applyIfPlatformOr={}, applyIfOr={}, applyIfCPUFeatureAnd={}, applyIf={}, applyIfCPUFeature={}, applyIfAnd={}, applyIfNot={})"
> > Phase "PrintIdeal":
> - counts: Graph contains wrong number of nodes:
> * Constraint 1: "(\\d+(\\s){2}(MaxD.*)+(\\s){2}===.*)"
> - Failed comparison: [found] 0 = 1 [given]
> - No nodes matched!
>
> 2) Method "private static double compiler.intrinsics.math.TestMinMaxInlining.testDoubleMin(double,double)" - [Failed IR rules: 1]:
> * @IR rule 1: "@compiler.lib.ir_framework.IR(phase={DEFAULT}, applyIfPlatformAnd={}, applyIfCPUFeatureOr={}, counts={"_#MIN_D#_", "1"}, failOn={}, applyIfPlatform={}, applyIfPlatformOr={}, applyIfOr={}, applyIfCPUFeatureAnd={}, applyIf={}, applyIfCPUFeature={}, applyIfAnd={}, applyIfNot={})"
> > Phase "PrintIdeal":
> - counts: Graph contains wrong number of nodes:
> * Constraint 1: "(\\d+(\\s){2}(MinD.*)+(\\s){2}===.*)"
> - Failed comparison: [found] 0 = 1 [given]
> - No nodes matched!
>
> 3) Method "private static float compiler.intrinsics.math.TestMinMaxInlining.testFloatMax(float,float)" - [Failed IR rules: 1]:
> * @IR rule 1: "@compiler.lib.ir_framework.IR(phase={DEFAULT}, applyIfPlatformAnd={}, applyIfCPUFeatureOr={}, counts={"_#MAX_F#_", "1"}, failOn={}, applyIfPlatform={}, applyIfPlatformOr={}, applyIfOr={}, applyIfCPUFeatureAnd={}, applyIf={}, applyIfCPUFeature={}, applyIfAnd={}, applyIfNot={})"
> > Phase "PrintIdeal":
> - counts: Graph contains wrong number of nodes:
> * Constraint 1: "(\\d+(\\s){2}(MaxF.*)+(\\s){2}===.*)"
> - Failed comparison: [found] 0 = 1 [given]
> - No nodes matched!
>
> 4) Method "private static float compiler.intrinsics.math.TestMinMaxInlining.testFloatMin(float,float)" - [Failed IR rules: 1]:
> * @IR rule 1: "@compiler.lib.ir_framework.IR(phase={DEFAULT}, applyIfPlatformAnd={}, applyIfCPUFeatureOr={}, counts={"_#MIN_F#_", "1"}, failOn={}, applyIfPlatform={}, applyIfPlatformOr={}, applyIfOr={}, applyIfCPUFeatureAnd={}, applyIf={}, applyIfCPUFeature={}, applyIfAnd={}, applyIfNot={})"
> > Phase "PrintIdeal":
> - counts: Graph contains wrong number of nodes:
> * Constraint 1: "(\\d+(\\s){2}(MinF.*)+(\\s){2}===.*)"
> - Failed comparison: [found] 0 = 1 [given]
> - No nodes matched!
> ```
@TobiHartmann the reason for this failure is that hotspot doesn't check whether max/min[F,D] intrinsics are available for x86. E.g.
case vmIntrinsics::_maxD:
case vmIntrinsics::_maxD_strict:
if (!Matcher::match_rule_supported(Op_MaxD)) return false;
break;
I tried to replicate the test failures with the latest master, but it doesn't build with x86:
* For target buildtools_create_symbols_javac__the.COMPILE_CREATE_SYMBOLS_batch:
#
# A fatal error has been detected by the Java Runtime Environment:
#
# Internal Error (/home/g/1/jdk-intrinsify-max-min-long/src/hotspot/cpu/x86/gc/shared/barrierSetAssembler_x86.cpp:747), pid=319052, tid=319399
# Error: Unimplemented()
#
# JRE version: OpenJDK Runtime Environment (24.0) (fastdebug build 24-internal-adhoc.g.jdk-intrinsify-max-min-long)
# Java VM: OpenJDK Server VM (fastdebug 24-internal-adhoc.g.jdk-intrinsify-max-min-long, mixed mode, tiered, g1 gc, linux-x86)
# Problematic frame:
# V [libjvm.so+0x529eca] BarrierSetAssembler::refine_register(Node const*, int)+0x1a
This build failure is caused by the late barrier expansion work, which is unimplemented for x86:
OptoReg::Name BarrierSetAssembler::refine_register(const Node* node, OptoReg::Name opto_reg) {
Unimplemented(); // This must be implemented to support late barrier expansion.
}
Looking at some other recent PRs, seems like there's no full build of x86 done any more, with only hotspot being build, and there is no testing executed. E.g. https://github.com/rwestrel/jdk/actions/runs/11145151555.
So, if x86 builds are not run, seems like there's no need to fix this? Otherwise there are several ways this can be fixed: disable test for x86, or to check max/min[F,D] intrinsics are available for x86 before adding the nodes to the IR.
-------------
PR Comment: https://git.openjdk.org/jdk/pull/20098#issuecomment-2402013495
More information about the core-libs-dev
mailing list