RFR: 8365844: RISC-V: TestBadFormat.java fails when running without RVV

Dingli Zhang dzhang at openjdk.org
Thu Aug 21 02:04:52 UTC 2025


On Wed, 20 Aug 2025 13:03:05 GMT, Emanuel Peter <epeter at openjdk.org> wrote:

>> Hi,
>> Can you help to review this patch? Thanks!
>> 
>> We noticed that testlibrary_tests/ir_framework/tests/TestBadFormat.java fails when running tier4 tests on p550.
>> The reason for the error is that the Vector test related to badVectorNodeSize requires RVV on riscv, otherwise the expected passing case will fail and cannot match FailCount.
>> 
>> ### Test (fastdebug)
>> - [x] Run testlibrary_tests/ir_framework/tests/TestBadFormat.java on k1/k230/sg2042
>
> test/hotspot/jtreg/testlibrary_tests/ir_framework/tests/TestBadFormat.java line 43:
> 
>> 41:  * @test
>> 42:  * @requires vm.debug == true & vm.compiler2.enabled & vm.flagless
>> 43:  * @requires (os.arch != "riscv64" | (os.arch == "riscv64" & vm.cpu.features ~= ".*rvv.*"))
> 
> Generally, it would be prefereable to adjust the IR rules. But I'm not sure if that is preferrable here. So I think that this is the right solution.
> 
> @chhagedorn This test may fail on other platforms as well that don't have all the required optimizations, such as vectors and others. Should we accept this solution?

> @eme64 Thanks for the review! I have another method to change the IR matching rules for riscv64 so that other tests can be run without RVV:
> 
> ```diff
> diff --git a/test/hotspot/jtreg/testlibrary_tests/ir_framework/tests/TestBadFormat.java b/test/hotspot/jtreg/testlibrary_tests/ir_framework/tests/TestBadFormat.java
> index ac8867f3985..2bf14bdfa5a 100644
> --- a/test/hotspot/jtreg/testlibrary_tests/ir_framework/tests/TestBadFormat.java
> +++ b/test/hotspot/jtreg/testlibrary_tests/ir_framework/tests/TestBadFormat.java
> @@ -1124,9 +1124,21 @@ public void wrongCountString() {}
>  
>      @Test
>      @FailCount(8)
> -    @IR(counts = {IRNode.LOAD_VECTOR_I, "> 0"})
> -    @IR(counts = {IRNode.LOAD_VECTOR_I, IRNode.VECTOR_SIZE_MAX, "> 0"}) // valid
> -    @IR(counts = {IRNode.LOAD_VECTOR_I, IRNode.VECTOR_SIZE_ANY, "> 0"}) // valid
> +    @IR(counts = {IRNode.LOAD_VECTOR_I, "> 0"},
> +        applyIfPlatform = {"riscv64", "false"})
> +    @IR(counts = {IRNode.LOAD_VECTOR_I, "> 0"},
> +        applyIfPlatform = {"riscv64", "true"},
> +        applyIfCPUFeature = {"rvv", "true"})
> +    @IR(counts = {IRNode.LOAD_VECTOR_I, IRNode.VECTOR_SIZE_MAX, "> 0"},
> +        applyIfPlatform = {"riscv64", "false"}) // valid
> +    @IR(counts = {IRNode.LOAD_VECTOR_I, IRNode.VECTOR_SIZE_MAX, "> 0"},
> +        applyIfPlatform = {"riscv64", "true"},
> +        applyIfCPUFeature = {"rvv", "true"})
> +    @IR(counts = {IRNode.LOAD_VECTOR_I, IRNode.VECTOR_SIZE_ANY, "> 0"},
> +        applyIfPlatform = {"riscv64", "false"}) // valid
> +    @IR(counts = {IRNode.LOAD_VECTOR_I, IRNode.VECTOR_SIZE_ANY, "> 0"},
> +        applyIfPlatform = {"riscv64", "true"},
> +        applyIfCPUFeature = {"rvv", "true"})
>      @IR(counts = {IRNode.LOAD_VECTOR_I, IRNode.VECTOR_SIZE + "", "> 0"})
>      @IR(counts = {IRNode.LOAD_VECTOR_I, IRNode.VECTOR_SIZE + "xxx", "> 0"})
>      @IR(counts = {IRNode.LOAD_VECTOR_I, IRNode.VECTOR_SIZE + "min()", "> 0"})
> ```

Hi @eme64 What do you think?

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/26855#discussion_r2289683141


More information about the hotspot-compiler-dev mailing list