RFR: 8353665: RISC-V: IR verification fails in TestSubNodeFloatDoubleNegation.java
Manuel Hässig
duke at openjdk.org
Fri Apr 4 12:16:06 UTC 2025
On Thu, 3 Apr 2025 16:57:19 GMT, Hamlin Li <mli at openjdk.org> wrote:
> Hi,
> Can you help to review this patch?
> The newly added TestSubNodeFloatDoubleNegation.java (in https://github.com/openjdk/jdk/pull/24150) is to check `0 - (0 - x)` is not folded to `x` for float and double.
> I have manually checked the IR and generated assembly code, it's not folded on riscv either, just there is an extra SubF in some code path.
> So, the fix for this test on riscv should be simply make the check as `>= 2` rather than `2`.
>
> Tested on both x86 and riscv64.
>
> Thanks
I ran the test with software emulation of `avx512-fp16` and the test failed the same way as on RISC-V:
$ sde64 -gnr -- jtreg [...] test/hotspot/jtreg/compiler/floatingpoint/TestSubNodeFloatDoubleNegation.java
[...]
Failed IR Rules (1) of Methods (1)
----------------------------------
1) Method "public static jdk.incubator.vector.Float16 compiler.floatingpoint.TestSubNodeFloatDoubleNegation.testHalfFloat(jdk.incubator.vector.Float16)" - [Failed IR rules: 1]:
* @IR rule 1: "@compiler.lib.ir_framework.IR(phase={DEFAULT}, applyIfPlatformAnd={}, applyIfCPUFeatureOr={}, counts={"_#SUB#_", "2"}, failOn={}, applyIfPlatform={}, applyIfPlatformOr={}, applyIfOr={}, applyIfCPUFeatureAnd={}, applyIf={}, applyIfCPUFeature={}, applyIfAnd={}, applyIfNot={})"
> Phase "PrintIdeal":
- counts: Graph contains wrong number of nodes:
* Constraint 1: "(\d+(\s){2}(Sub(I|L|F|D|HF).*)+(\s){2}===.*)"
- Failed comparison: [found] 3 = 2 [given]
- Matched nodes (3):
* 326 SubHF === _ 560 325 [[ 327 479 ]] !orig=[478] !jvms: Float16::valueOf @ bci:5 (line 329) Float16::subtract @ bci:9 (line 1137) TestSubNodeFloatDoubleNegation::testHalfFloat @ bci:9 (line 63)
* 443 SubF === _ 561 442 [[ 607 ]] !jvms: Float16::subtract @ bci:8 (line 1137) TestSubNodeFloatDoubleNegation::testHalfFloat @ bci:12 (line 61)
* 479 SubHF === _ 560 326 [[ 480 ]] !jvms: Float16::valueOf @ bci:5 (line 329) Float16::subtract @ bci:9 (line 1137) TestSubNodeFloatDoubleNegation::testHalfFloat @ bci:12 (line 61)
The ideal graph shows the same "alternative codepath" that your opto assembly shows.
I guess we need to generally predicate the test on native float16 support. But I can do that in a separate issue, where I also investigate ARM.
-------------
PR Comment: https://git.openjdk.org/jdk/pull/24421#issuecomment-2778516111
More information about the hotspot-compiler-dev
mailing list