RFR: 8308817: RISC-V: Support VectorTest node for Vector API
Gui Cao
gcao at openjdk.org
Tue May 30 00:05:56 UTC 2023
On Fri, 26 May 2023 09:40:08 GMT, Fei Yang <fyang at openjdk.org> wrote:
>> Hi,
>>
>> we have added VectorTest node, It was implemented by referring to RVV v1.0 [1]. please take a look and have some reviews. Thanks a lot.
>> We can use the Int256VectorTests.java[2] to print the compilation log, verify and observe the generation of nodes.
>>
>> For example, we can use the following command to print the compilation log of a jtreg test case:
>>
>> /home/zifeihan/jdk-tools/jtreg/bin/jtreg \
>> -v:default \
>> -concurrency:16 -timeout:50 \
>> -javaoption:-XX:+UnlockExperimentalVMOptions \
>> -javaoption:-XX:+UseRVV \
>> -javaoption:-XX:+PrintOptoAssembly \
>> -javaoption:-XX:LogFile=/home/zifeihan/jdk-rvv/Int256VectorTests_PrintOptoAssembly_20230525.log \
>> -jdk:/home/zifeihan/jdk-rvv/build/linux-riscv64-server-fastdebug/jdk \
>> -compilejdk:/home/zifeihan/jdk-rvv/build/linux-x86_64-server-release/images/jdk \
>> /home/zifeihan/jdk/test/jdk/jdk/incubator/vector/Int256VectorTests.java
>>
>>
>> Also here's a more concise test case, VectorTestDemo:
>>
>>
>> import jdk.incubator.vector.ByteVector;
>> import jdk.incubator.vector.VectorMask;
>>
>> public class VectorTestDemo {
>> static boolean[] d = new boolean[]{true, false, false, false, false, false, false, false};
>> static VectorMask<Byte> avmask = VectorMask.fromArray(ByteVector.SPECIES_64, d, 0);
>>
>> public static void main(String[] args) {
>> for (int i = 0; i < 300000; i++) {
>>
>> final boolean alltrue = alltrue();
>> if (alltrue != false) {
>> throw new RuntimeException("alltrue");
>> }
>> final boolean anytrue = anytrue();
>> if (anytrue != true) {
>> throw new RuntimeException("anytrue");
>> }
>> }
>> }
>>
>> public static boolean anytrue() {
>> return avmask.anyTrue();
>> }
>>
>> public static boolean alltrue() {
>> return avmask.allTrue();
>> }
>> }
>>
>>
>> We can compile `VectorTestDemo.java` using `javac --add-modules jdk.incubator.vector VectorTestDemo.java`, and use `./java -XX:-TieredCompilation -XX:+UnlockExperimentalVMOptions -XX:+UseRVV -XX:+PrintOptoAssembly -XX:+LogCompilation -XX:LogFile=compile.log VectorTestDemo > aaa.log` to start the test case, we can observe the specified compilation log `compile.log`, which contains the VectorTest node for the PR implementation.
>> Some of the compilation logs of VectorTestDemo#anytrue method are as follows.
>>
>> 05e lwu R28, [R7, #12] # loadN, compressed ptr, #@loadN ! Field: jdk/i...
>
> Looks good.
@RealFYang @feilongjiang Thanks for the review.
-------------
PR Comment: https://git.openjdk.org/jdk/pull/14138#issuecomment-1567607373
More information about the hotspot-compiler-dev
mailing list