RFR: 8304301: Remove the global option SuperWordMaxVectorSize

Fei Gao fgao at openjdk.org
Fri Mar 24 01:37:38 UTC 2023


On Tue, 21 Mar 2023 04:16:26 GMT, Sandhya Viswanathan <sviswanathan 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.

Thanks for all your review and testing, @sviswa7 @vnkozlov @TobiHartmann.

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

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


More information about the hotspot-dev mailing list