RFR: 8351950: C2: AVX512 vector assembler routines causing SIGFPE / no valid evex tuple_table entry [v3]

Sandhya Viswanathan sviswanathan at openjdk.org
Tue May 20 20:33:53 UTC 2025


On Tue, 20 May 2025 19:12:43 GMT, Jatin Bhateja <jbhateja at openjdk.org> wrote:

>> PR adds missing EVEX compressed displacement attributes used for computing the scale factor (N) of compressed displacement.
>> AVX512 memory operand instructions use compressed disp8 encoding if the displacement is a multiple of scale (N), which depends on Vector Length, embedded broadcasting, and lane size.  Please refer to section 2.7.5 of Intel SDM for more details.
>> 
>> e.g., Consider two instructions, one with displacement 0x10203040 and the other with displacement 0x40, instruction operates over full 64-byte vector hence scale N = 64. Displacement of latter instruction is a multiple of scale, thus can be represented by 1 byte displacement encoding, while the former requires 4 bytes to represent displacement in instruction encoding.
>> 
>> 
>> 1) vpternlogq $0xff,0x10203040(%r20,%r21,8),%zmm23,%zmm24
>>     EVEX        OP   MR   SIB       DISP       IMM
>> --------------|----|----|----|---------------|-----|
>> 62 6b c1 40     25   84   ec     40 30 20 10     ff
>> 
>> 2) vpternlogq $0xff,0x40(%r20,%r21,8),%zmm23,%zmm24
>> For full vector width operation, scalar matches with vector size, hence scale N = 64
>> effective displacement / compressed DISP8 = OFFSET(64) / 64 = 0x1 
>>     EVEX       OP   MR SIB    DISP     IMM
>> -------------|----|---|---|-----------|---|
>> 62 6b c1 40    25  44   ec      01     ff 
>> 
>> 
>> Kindly review and share your feedback.
>> 
>> Best Regards,
>> Jatin
>
> Jatin Bhateja has updated the pull request incrementally with one additional commit since the last revision:
> 
>   Review comments resolutions

Thanks for the update. It looks like you missed changing the input_size_in_bits to EVEX_64bit for  evgatherdpd.

src/hotspot/cpu/x86/assembler_x86.cpp line 5355:

> 5353:   assert(dst != xnoreg, "sanity");
> 5354:   InstructionAttr attributes(vector_len, /* rex_w */ false, /* legacy_mode */ _legacy_mode_bw, /* no_mask_reg */ true, /* uses_vl */ true);
> 5355:   attributes.set_address_attributes(/* tuple_type */ EVEX_QVM, /* input_size_in_bits */ EVEX_NObit);

This should have remained as EVEX_HVM.

src/hotspot/cpu/x86/assembler_x86.cpp line 5384:

> 5382:   InstructionMark im(this);
> 5383:   InstructionAttr attributes(vector_len, /* rex_w */ false, /* legacy_mode */ _legacy_mode_bw, /* no_mask_reg */ false, /* uses_vl */ true);
> 5384:   attributes.set_address_attributes(/* tuple_type */ EVEX_QVM, /* input_size_in_bits */ EVEX_NObit);

This should have remained as EVEX_HVM.

src/hotspot/cpu/x86/assembler_x86.cpp line 6089:

> 6087:   InstructionMark im(this);
> 6088:   InstructionAttr attributes(AVX_128bit, /* rex_w */ false, /* legacy_mode */ _legacy_mode_vlbw, /* no_mask_reg */ true, /* uses_vl */ true);
> 6089:   attributes.set_address_attributes(/* tuple_type */ EVEX_FV, /* input_size_in_bits */ EVEX_NObit);

This should have remained as EVEX_FVM.

src/hotspot/cpu/x86/assembler_x86.cpp line 11395:

> 11393:   assert(VM_Version::supports_avx512bw() && (vector_len == AVX_512bit || VM_Version::supports_avx512vl()), "");
> 11394:   InstructionAttr attributes(vector_len, /* vex_w */ false,/* legacy_mode */ false, /* no_mask_reg */ false,/* uses_vl */ true);
> 11395:   attributes.set_address_attributes(/* tuple_type */ EVEX_FV,/* input_size_in_bits */ EVEX_NObit);

This should have remained as EVEX_FVM.

src/hotspot/cpu/x86/assembler_x86.cpp line 11423:

> 11421:   assert(VM_Version::supports_avx512bw() && (vector_len == AVX_512bit || VM_Version::supports_avx512vl()), "");
> 11422:   InstructionAttr attributes(vector_len, /* vex_w */ false,/* legacy_mode */ false, /* no_mask_reg */ false,/* uses_vl */ true);
> 11423:   attributes.set_address_attributes(/* tuple_type */ EVEX_FV,/* input_size_in_bits */ EVEX_NObit);

This should have remained as EVEX_FVM.

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

PR Comment: https://git.openjdk.org/jdk/pull/25021#issuecomment-2895758593
PR Review Comment: https://git.openjdk.org/jdk/pull/25021#discussion_r2098798618
PR Review Comment: https://git.openjdk.org/jdk/pull/25021#discussion_r2098801371
PR Review Comment: https://git.openjdk.org/jdk/pull/25021#discussion_r2098809418
PR Review Comment: https://git.openjdk.org/jdk/pull/25021#discussion_r2098815794
PR Review Comment: https://git.openjdk.org/jdk/pull/25021#discussion_r2098815336


More information about the hotspot-compiler-dev mailing list