On Sat, 27 Feb 2021 03:23:12 GMT, Jie Fu <ji...@openjdk.org> wrote: >> Hi all, >> >> Vector API fails to work when: >> - case 1: MaxVectorSize is set to <=8, or >> - case 2: C2 is disabled >> >> The reason is that {max/preferred} VectorShape initialization fails in both >> cases. >> And the root cause is that VectorSupport_GetMaxLaneCount [1] returns >> unreasonable values (0 for case 1 and -1 for case 2). >> >> Vector API should not depend on C2 to run. >> It should work even there is no JIT compiler since it's a Java-level api. >> So let's fix it. >> >> Testing: >> - jdk/incubator/vector with -XX:MaxVectorSize=default/8 on Linux/x64 >> >> Thanks. >> Best regards, >> Jie >> >> [1] >> https://github.com/openjdk/jdk/blob/master/src/hotspot/share/prims/vectorSupport.cpp#L364 > > Jie Fu has updated the pull request with a new target base due to a merge or > a rebase. The incremental webrev excludes the unrelated changes brought in by > the merge/rebase. The pull request contains seven additional commits since > the last revision: > > - Fix in jdk/incubator/vector/VectorShape.java > - Merge branch 'master' into JDK-8262096 > - Revert changes > - Remove -XX:TieredStopAtLevel=3 > - Update the jtreg test > - The numerator should be 8 (byte) > - 8262096: Vector API fails to work due to VectorShape initialization > exception
> For the updated fix, the {max/preferred} shape will be initialized as > shape-64-bit if hotspot doesn't support vectorization. Sounds reasonable. test/jdk/jdk/incubator/vector/PreferredSpeciesTest.java line 42: > 40: * @modules jdk.incubator.vector java.base/jdk.internal.vm.vector > 41: * @run testng/othervm -XX:MaxVectorSize=8 PreferredSpeciesTest > 42: * @run testng/othervm -XX:MaxVectorSize=4 PreferredSpeciesTest `-XX:MaxVectorSize` is C2-specific. It's better to specify either `-XX:-IgnoreUnrecognizedVMOptions` or `@requires vm.compiler2.enabled`. ------------- Marked as reviewed by vlivanov (Reviewer). PR: https://git.openjdk.java.net/jdk/pull/2722