PSyclone icon indicating copy to clipboard operation
PSyclone copied to clipboard

Add UnrolledLoop transformation to ArrayAssignment2LoopsTrans: ArrayAssignment2UnrolledLoopsTrans

Open hbrunie opened this issue 1 year ago • 2 comments

@sergisiso @arporter , our Poseidon uplifter works well with simplified Kernel: Perfectly Nested loop with "simple" assignments inside.

Some of FlashX code (and probably other out there like Nemo) use a lot of arrays notations. These notations can be transformed to simple Loop with the PsyIR ArrayAssignment2LoopsTrans, nevertheless, this adds some loops inside of a nice well defined Kernel.

Thus I thought of extending this transformation. This could be a new one just wrapping the first one and unrolling the loop. Indeed in this case we know where this loop comes from and it seems safe to unroll it.

Tell me if such a transformation would be useful elsewhere. Cheers, Hugo

hbrunie avatar Oct 02 '24 11:10 hbrunie

I just ran into a more complex case where the array bounds are not known at compile time. So not sure if this transformation would be useful in many cases ... In FlashX they do: integer, dimension(3), intent(in) :: logc real, dimension(logc(3):,:,logc(1):,logc(2):), intent(inout) :: uin

hbrunie avatar Oct 02 '24 11:10 hbrunie

As @sergisiso suggested, this could be a Transformation on its own. Just applying when bounds are well known.

hbrunie avatar Oct 07 '24 08:10 hbrunie