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

Christian Hagedorn chagedorn at openjdk.org
Thu Aug 21 05:58:52 UTC 2025


On Thu, 21 Aug 2025 02:01:55 GMT, Dingli Zhang <dzhang at openjdk.org> wrote:

>> 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?

>From the log you provided, it looks like only these two rules for `badVectorNodeSize()`

    @IR(counts = {IRNode.LOAD_VECTOR_I, "> 0"})
    @IR(counts = {IRNode.LOAD_VECTOR_I, IRNode.VECTOR_SIZE_MAX, "> 0"}) 
``` 
result in a format violation which was not unexpected on other platforms (they expect rule 1-3 to pass):

 - VMInfo: MaxVectorSize is not larger than zero for IR rule 1 at public int[] ir_framework.tests.BadIRAnnotationsAfterTestVM.badVectorNodeSize().
 - VMInfo: MaxVectorSize is not larger than zero for IR rule 2 at public int[] ir_framework.tests.BadIRAnnotationsAfterTestVM.badVectorNodeSize().

It looks like `MaxVectorSize` is 0 when run without RVV on riscv. Can you try and just add

applyIf = {"MaxVectorSize", ">0"}

to both of these rules instead of the platform/CPU specific conditions? That would be less restrictive and also applies for other platforms that have `MaxVectorSize` set to 0 by default.

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

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


More information about the hotspot-compiler-dev mailing list