Loop unrolling of vector operations by JIT

Chris Hegarty chegar999 at gmail.com
Wed May 15 09:07:40 UTC 2024


Hi,

On 14/05/2024 16:41, Paul Sandoz wrote:
> C2 can unroll loops with explicit vector operations using the Vector API. I don’t know the exact details but I presume if a loop is auto-vectorized the result can then be unrolled similarly as if explicit vector operations are present.
> 
> To compare you can switch off loop unrolling with the HotSpot option -XX:LoopUnrollLimit=0.
> 
> I have found that most of the benefit with explicit unrolling of vector operations is to break data dependencies e.g. when reducing/accumulating.

This is exactly what we observe too, e.g.

https://github.com/apache/lucene/blob/main/lucene/core/src/java21/org/apache/lucene/internal/vectorization/PanamaVectorUtilSupport.java#L124-L128

-Chris.


More information about the panama-dev mailing list