RFR: 8255438: [Vector API] More instructs in x86.ad should use legacy mode for code-gen [v2]

Jie Fu jiefu at openjdk.java.net
Wed Oct 28 09:24:30 UTC 2020


> Hi all,
> 
> Just as @jatin-bhateja pointed out [1], there are more instructs in x86.ad which should use legacy mode.
> 
> It would be better to fix the following cases:
> ------------------------
> 1. instruct mul2L_reg
>    The code-gen logic uses phaddd [2], which requires legacy mode here [3].
>    This bug might be reproduced on AVX512 machines without avx512dq.
> 
> 2. instruct vmul4L_reg_avx
>    The code-gen logic uses vphaddd [4], which requires legacy mode here [5].
>    This bug might be reproduced on AVX512 machines without avx512dq.
> 
> 3. instruct reductionL
>    For MulReductionVL, the code-gen chain can be:  reduceL --> reduce4L --> reduce_operation_128 --> vpmullq [6]
>    vpmullq require legacy mode [7] if avx512dq isn't supported.
>    This bug might be reproduced on AVX512 machines without avx512dq.
> 
> 4. instruct reductionB
>    For MinReductionV, the code-gen chain can be:  reduceB --> reduce32B --> reduce_operation_128 --> pminsb [8]
>    pminsb require legacy mode [9] if avx512bw isn't supported.
>    This bug might be reproduced on AVX512 machines without avx512bw.
> ------------------------
> Bugs in mul2L_reg/vmul4L_reg_avx/reductionL can be only reproduced on AVX512 machines without avx512dq.
> And bug in reductionB can be only reproduced on AVX512 machines without avx512bw.
> 
> Unfortunately, it's impossible for us to create reproducers since our AVX512 platforms support both avx512dq and avx512bw.
> However, it do make sense to fix these unexposed bugs since vector api code will be sure to run on various paltforms (e.g., AVX512 machines without avx512dq/bw) in the future.
> 
> The fix just changes vec to legVec, which is quite safe in theory.
> 
> As for the reduction patterns of Float and Double, I don't see any reason that they should use legacy mode (maybe I've missed something).
> 
> Testing:
>   - jdk/incubator/vector on both AVX512 and AVX256 machines
> 
> Any comments?
> 
> Thanks a lot.
> Best regards,
> Jie
> 
> [1] https://github.com/openjdk/jdk/pull/791#commitcomment-43473733
> [2] https://github.com/openjdk/jdk/blob/master/src/hotspot/cpu/x86/x86.ad#L5472
> [3] https://github.com/openjdk/jdk/blob/master/src/hotspot/cpu/x86/assembler_x86.cpp#L6217
> [4] https://github.com/openjdk/jdk/blob/master/src/hotspot/cpu/x86/x86.ad#L5497
> [5] https://github.com/openjdk/jdk/blob/master/src/hotspot/cpu/x86/assembler_x86.cpp#L6165
> [6] https://github.com/openjdk/jdk/blob/master/src/hotspot/cpu/x86/c2_MacroAssembler_x86.cpp#L1521
> [7] https://github.com/openjdk/jdk/blob/master/src/hotspot/cpu/x86/assembler_x86.cpp#L6428
> [8] https://github.com/openjdk/jdk/blob/master/src/hotspot/cpu/x86/c2_MacroAssembler_x86.cpp#L1482
> [9] https://github.com/openjdk/jdk/blob/master/src/hotspot/cpu/x86/assembler_x86.cpp#L6475

Jie Fu has updated the pull request incrementally with one additional commit since the last revision:

  Add reductionL_avx512dq and reductionB_avx512bw

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

Changes:
  - all: https://git.openjdk.java.net/jdk/pull/874/files
  - new: https://git.openjdk.java.net/jdk/pull/874/files/59ece711..a16bddf2

Webrevs:
 - full: https://webrevs.openjdk.java.net/?repo=jdk&pr=874&range=01
 - incr: https://webrevs.openjdk.java.net/?repo=jdk&pr=874&range=00-01

  Stats: 39 lines in 1 file changed: 37 ins; 0 del; 2 mod
  Patch: https://git.openjdk.java.net/jdk/pull/874.diff
  Fetch: git fetch https://git.openjdk.java.net/jdk pull/874/head:pull/874

PR: https://git.openjdk.java.net/jdk/pull/874


More information about the hotspot-compiler-dev mailing list