RFR: JDK-8270147: Increase stride size allowing unrolling more loops [v7]

Radoslaw Smogura github.com+7535718+rsmogura at openjdk.java.net
Wed Jul 14 01:06:45 UTC 2021


> # Description
> 
> Increase allowed stride size for loop unrolling to the maximum vector size on runtime platform. 
> 
> The motivation for this change is discussion and research about unrolling vector (SIMD) loops. For vector usage, stride size depends on vector element type, and platform vector size. For AVX256 and int stride size is 8, and loop unroll happens. However short and byte loops could not get unrolled (stride size 16 & 32):
> 
>     for (int i = 0; i < SPECIES.loopBound(longSize); i += SPECIES.length() /* 8 for int, 16 for short */ ) { 
>       var v = ShortVector.fromByteBuffer(SPECIES, srcBufferHeap, i, ByteOrder.nativeOrder()); 
>       v.intoByteBuffer(dstBufferHeap, i, ByteOrder.nativeOrder()); 
>     } 
> 
> After this change, the maximum stride, which allows loops to unroll, will depend on the maximum bytes size of vectors registers (AVX256 - 32, AVX512 - 64, SVE up to 256)
> 
> # Notes
> Stride size was decreased some time ago https://github.com/openjdk/panama-foreign/commit/2683d5390bd58683ae13bdd8582127c308d8fd04
> 
> The exact reasons for this are not known for me (over unroll of some loops?).
> 
> Original thread https://mail.openjdk.java.net/pipermail/panama-dev/2021-June/014310.html

Radoslaw Smogura has updated the pull request incrementally with one additional commit since the last revision:

  Add copyright headers.

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

Changes:
  - all: https://git.openjdk.java.net/jdk/pull/4658/files
  - new: https://git.openjdk.java.net/jdk/pull/4658/files/e7a94c5b..9fe25c04

Webrevs:
 - full: https://webrevs.openjdk.java.net/?repo=jdk&pr=4658&range=06
 - incr: https://webrevs.openjdk.java.net/?repo=jdk&pr=4658&range=05-06

  Stats: 46 lines in 2 files changed: 46 ins; 0 del; 0 mod
  Patch: https://git.openjdk.java.net/jdk/pull/4658.diff
  Fetch: git fetch https://git.openjdk.java.net/jdk pull/4658/head:pull/4658

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


More information about the hotspot-compiler-dev mailing list