RFR: 8304301: Remove the global option SuperWordMaxVectorSize

Fei Gao fgao at openjdk.org
Tue Mar 21 02:33:41 UTC 2023


https://github.com/openjdk/jdk/pull/8877 introduced the global option `SuperWordMaxVectorSize` as a temporary solution to fix the performance regression on some x86 machines.

Currently, `SuperWordMaxVectorSize` behaves differently between x86 and other platforms [1]. For example, if the current machine only supports `MaxVectorSize <= 32`, but we set `SuperWordMaxVectorSize = 64`, then `SuperWordMaxVectorSize` will be kept at 64 on other platforms while x86 machine would change `SuperWordMaxVectorSize` to `MaxVectorSize`. Other platforms except x86 miss similar implementations like [2].

Also, `SuperWordMaxVectorSize` limits the max vector size of auto-vectorization as `64`, which is fine for current aarch64 hardware, but SVE architecture supports larger than 512 bits.

The patch is to drop the global option and use an architecture-dependent interface to consult the max vector size for auto-vectorization, fixing the performance issue on x86 and reducing side effects for other platforms. After the patch, auto-vectorization is still limited to 32-byte vectors by default on Cascade Lake and users can override this by either setting
`-XX:UseAVX=3` or `-XX:MaxVectorSize=64` on JVM command line.

So my question is:

Before the patch, we could have a smaller max vector size for auto-vectorization than `MaxVectorSize` on x86. For example, users could have `MaxVectorSize=64` and `SuperWordMaxVectorSize=32`. But after the change, if we set
`-XX:MaxVectorSize=64` explicitly, then the max vector size for auto-vectorization would be `MaxVectorSize`, i.e. 64 bytes, which I believe is more reasonable. @sviswa7 @jatin-bhateja, are you happy about the change?

[1] https://github.com/openjdk/jdk/pull/12350#discussion_r1126106213
[2] https://github.com/openjdk/jdk/blob/33bec207103acd520eb99afb093cfafa44aecfda/src/hotspot/cpu/x86/vm_version_x86.cpp#L1314-L1333

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

Commit messages:
 - 8304301: Remove the global option SuperWordMaxVectorSize

Changes: https://git.openjdk.org/jdk/pull/13112/files
 Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=13112&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8304301
  Stats: 104 lines in 14 files changed: 50 ins; 38 del; 16 mod
  Patch: https://git.openjdk.org/jdk/pull/13112.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/13112/head:pull/13112

PR: https://git.openjdk.org/jdk/pull/13112


More information about the hotspot-dev mailing list