SuperWordLoopUnrollAnalysis and loop unrolling

Yang Zhang yang.zhang at linaro.org
Fri Apr 14 09:21:30 UTC 2017


Hi Andrew

Now I also investigate the loop unroll mechanism in aarch64/arm64 C2 too.

Take the vectAddInt as an example, my debug information is listed as follow:

Java example:
public static void vectAddInt(
          int[] a,
          int[] b,
          int c) {
    for (int i = 0; i < LENGTH; i++) {
      a[i] = b[i] + c;
    }
  }

For aarch64 C2 with SuperWordLoopUnrollAnalysis=false:
loop unroll is controlled by comparing body_size and LoopUnrollLimit
("Unroll loop bodies with node count less than this") in function
policy_unroll. When loop unroll is 8 times, body_size is big enough
and it stops.

For aarch64 C2 with SuperWordLoopUnrollAnalysis=true:
First loop unroll is controlled by policy_unroll_slp_analysis. When
loop unroll is 4 times, vectorization happens.
Then loop unroll is controlled by comparing body_size and
LoopUnrollLimit. When loop unroll is 32 times, body_size is big enough
and it stops.

My test result is just opposite with your description. Could you
provide your test case?

Regards
Yang

On 13 April 2017 at 01:22, Andrew Haley <aph at redhat.com> wrote:
> If I set SuperWordLoopUnrollAnalysis=true, then AArch64 C2 stops after
> unrolling a simple loop 4 times.  If I set
> SuperWordLoopUnrollAnalysis=false, it stops after unrolling 16 times.
> Why is is that SuperWordLoopUnrollAnalysis limits unrolling in this
> way?
>
> The info says
> "Map number of unrolls for main loop via Superword Level Parallelism
> analysis" but that doesn't help me very much.  Only AArch64 and x86
> set this option.
>
> Thanks,
>
> Andrew.


More information about the hotspot-dev mailing list