On Fri, 26 Feb 2021 02:38:00 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 incrementally with one additional commit > since the last revision: > > Remove -XX:TieredStopAtLevel=3
IMO the fix should be in `src/jdk.incubator.vector/share/classes/jdk/incubator/vector/VectorShape.java`. JVM does the right job when it signals vector support is absent (by returning `-1`). `jdk.incubator.vector` implementation should take that into account and choose a preferred shape for pure Java execution mode. ------------- Changes requested by vlivanov (Reviewer). PR: https://git.openjdk.java.net/jdk/pull/2722