Memory Layout Dictates Loop Interchange Efficacy

Loop interchange benefits heavily depend on the array's memory layout: C/C++ (row-major) needs the innermost loop to iterate over columns for sequential access, while Fortran (column-major) requires the innermost loop to iterate over rows to achieve optimal spatial locality.

Sources

Open the full topic