RFR: 8304301: Remove the global option SuperWordMaxVectorSize
Sandhya Viswanathan
sviswanathan at openjdk.org
Tue Mar 21 04:19:44 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
@fg1417 SuperWordMaxVectorSize defines the maximum vector size generated by the auto vectorization.
MaxVectorSize defines the vector width supported by the underlying platform.
For CascadeLake we are setting SuperWordMaxVectorSize=32 and MaxVectorSize=64 by default.
This allows the usage of larger 64 byte width vector instructions in places like Java Vector API and intrinsics.
We would like to keep this behavior for x86.
-------------
PR Comment: https://git.openjdk.org/jdk/pull/13112#issuecomment-1477259831
More information about the hotspot-dev
mailing list