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

Radoslaw Smogura github.com+7535718+rsmogura at openjdk.java.net
Sat Jul 10 15:05:09 UTC 2021


> # Description
> 
> This increase allowed stride size for loop unrolling to almost maximum possible
> value which is around `max_jint /  2 - 2`,
> so the value which will prevent overflow when stride is doubled in C2.
> 
> The motivation of this change is discussion and research about unrolling
> vector (SIMD) loops. In such a case stride size depends on elements size
> and machine size of vector for AVX256 and int stride size is 8,
> and loop unroll happens. However short vectors will not cause loop unroll.
> 
> 
>     for (int i = 0; i < SPECIES.loopBound(longSize); i += SPECIES.length() /* 8 for int, 16 for short */ ) {
>       var v = ShortVector.fromByteBuffer(SPECIES, srcBufferHeap, i << 1, ByteOrder.nativeOrder());
>       v.intoByteBuffer(dstBufferHeap, i << 1, ByteOrder.nativeOrder());
>     }
> 
> 
> # 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 two additional commits since the last revision:

 - Drop whitespace, again.
 - Set maximum stride size to be 1 << 2 or max vector size
   
   Keep overflow test if stride can overflow when doubling
   Drop diagnostic flag

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

Changes:
  - all: https://git.openjdk.java.net/jdk/pull/4658/files
  - new: https://git.openjdk.java.net/jdk/pull/4658/files/01cfea1f..16384c31

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

  Stats: 20 lines in 2 files changed: 0 ins; 12 del; 8 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