On Fri, Apr 13, 2018 at 3:32 PM, Wilco Dijkstra <wilco.dijks...@arm.com> wrote: > Hi, > > I looked at a few performance anomalies between gfortran and Flang - it > appears array slices > are treated differently. Using -frepack-arrays fixed a performance issue in > gfortran and didn't > cause any regressions. Making input array slices contiguous helps both > locality and enables > more vectorization. > > So I wonder whether it should be made the default (-O3 or just -Ofast)? > Alternatively would I don't know the implementation of the option, so two questions: 1) When the repack is done during compilation? Is new code manipulating data layout added by frontend? If yes, better to do it during optimization thus is can be on demanding? This looks like one case of data layout transformation. Not sure if there is enough information to do that in optimizer. 2) For now, does this option force array repacking unconditionally? I think it won't be too hard to model when such data layout transformation is beneficial by looking at loop (nest) accessing the array and comparing against the overhead.
> it be feasible in Fortran to version functions or loops if all arguments are > contiguous slices? I think a cost model is still needed for function/loop versioning. Thanks, bin > > Wilco