[jdk16] Integrated: 8258703: Incorrect 512-bit vector registers restore on x86_32

Jie Fu jiefu at openjdk.java.net
Mon Jan 4 23:44:58 UTC 2021


On Wed, 23 Dec 2020 09:06:00 GMT, Jie Fu <jiefu at openjdk.org> wrote:

> Hi all,
> 
> Following tests fail on our AVX512 machines with x86_32:
>   - compiler/runtime/Test7196199.java
>   - compiler/runtime/safepoints/TestRegisterRestoring.java
>   - compiler/vectorization/TestVectorsNotSavedAtSafepoint.java
> 
> The reason is that 512-bit registers (zmm0 ~ zmm7) are restored incorrectly.
> 
> Current restore logic for 512-bit registers includes:
>   1) restore zmm[511..256] [1]
>   2) restore zmm[255..128] [2]  <-- Wrong on AVX512 with avx512vl
> 
> On our AVX512 machine, Assembler::vinsertf128 [3] was called in step 2).
> According to the Intel instruction set reference,  vinsertf128 just copies the lower half of zmm, which lost the upper half of zmm.
>    VINSERTF128 (VEX encoded version)
>    TEMP[255:0] <- SRC1[255:0]
>    CASE (imm8[0]) OF
>    0: TEMP[127:0]   <- SRC2[127:0]
>    1: TEMP[255:128] <- SRC2[127:0]
>    ESAC
>    DEST <- TEMP
> 
> The fix just changes the order of the restore logic for 512-bit registers:
>   1) restore zmm[255..128] 
>   2) restore zmm[511..256] 
> 
> Thanks.
> Best regards,
> Jie
> 
> [1] https://github.com/openjdk/jdk16/blob/master/src/hotspot/cpu/x86/sharedRuntime_x86_32.cpp#L320
> [2] https://github.com/openjdk/jdk16/blob/master/src/hotspot/cpu/x86/sharedRuntime_x86_32.cpp#L326
> [3] https://github.com/openjdk/jdk16/blob/master/src/hotspot/cpu/x86/macroAssembler_x86.hpp#L1463

This pull request has now been integrated.

Changeset: 216c2ec0
Author:    Jie Fu <jiefu at openjdk.org>
URL:       https://git.openjdk.java.net/jdk16/commit/216c2ec0
Stats:     12 lines in 1 file changed: 6 ins; 5 del; 1 mod

8258703: Incorrect 512-bit vector registers restore on x86_32

Reviewed-by: kvn, sviswanathan

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

PR: https://git.openjdk.java.net/jdk16/pull/64


More information about the hotspot-compiler-dev mailing list