RFR: 8304301: Remove the global option SuperWordMaxVectorSize

Vladimir Kozlov kvn at openjdk.org
Wed Mar 22 22:00:42 UTC 2023


On Tue, 21 Mar 2023 02:26:55 GMT, Fei Gao <fgao at openjdk.org> wrote:

> 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

I am not sure about this effect of UseAVX setting on command line.
We use UseAVX setting on command line to emulate runs on different platforms. Some our machines are Cascade Lake. Before, even if we use `-XX:UseAVX=3` on command line we still limit superword vector size for CL. With this patch we will not do that. It will not match what happens in production with default setting and we miss testing coverage for CL.

Why you added `FLAG_IS_DEFAULT(UseAVX)` check?

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

PR Comment: https://git.openjdk.org/jdk/pull/13112#issuecomment-1480312729


More information about the hotspot-dev mailing list