Abstract
Two-dimensional arrays are generally arranged in memory in row-major order or column-major order. Sophisticated programmers, or occasionally sophisticated compilers, match the loop structure to the language’s storage layout in order to maximise spatial locality. Unsophisticated programmers do not, and the performance loss is often dramatic — up to a factor of 20. With knowledge of how the array will be used, it is often possible to choose between the two layouts in order to maximise spatial locality. In this paper we study the Morton storage layout, which has substantial spatial locality whether traversed in row-major or column-major order. We present results from a suite of simple application kernels which show that, on the AMD Athlon and Pentium III, for arrays larger than 256 × 256, Morton array layout, even implemented with a lookup table with no compiler support, is always within 61% of both row-major and column-major — and is sometimes faster.
Keywords
These keywords were added by machine and not by the authors. This process is experimental and the keywords may be updated as the learning algorithm improves.
Download to read the full chapter text
Chapter PDF
Similar content being viewed by others
References
O. Beckmann and P. H. J. Kelly. Efficient interprocedural data placement optimisation in a parallel library. In LCR98: Languages, Compilers and Run-time Systems for Scalable Computers, number 1511 in LNCS, pages 123–138. Springer-Verlag, May 1998.
S. Chatterjee, V. V. Jain, A. R. Lebeck, S. Mundhra, and M. Thottethodi. Nonlinear array layouts for hierarchical memory systems. In Int. Conf. on Supercomputing, pages 444–453, 1999.
P. J. Hanlon, D. Chung, S. Chatterjee, D. Genius, A. R. Lebeck, and E. Parker. The combinatorics of cache misses during matrix multiplication. JCSS, 63, 2001.
M. T. Kandemir, A. N. Choudhary, J. Ramanujam, N. Shenoy, and P. Banerjee. Enhancing spatial locality via data layout optimizations. In Euro-Par, pages 422–434, 1998.
M. S. Lam, E. E. Rothberg, and M. E. Wolf. The cache performance and optimizations of blocked algorithms. SIGPLAN Notices, 26(4):63–74, 1991.
K. S. McKinley, S. Carr, and C.-W. Tseng. Improving data locality with loop transformations. ACM Transactions on Programming Languages and Systems, 18(4):424–453, July 1996.
D. S. Wise, J. D. Frens, Y. Gu, and G. A. Alexander. Language support for Morton-order matrices. In Proc. 2001 ACM Symp. on Principles and Practice of Parallel Programming, SIGPLAN Not. 36, 7, 2001.
M. E. Wolf and M. S. Lam. A data locality optimizing algorithm. In Proceedings of ACM SIGPLAN’ 91 Conference on Programming Language Design and Implementation, 1991.
Author information
Authors and Affiliations
Editor information
Editors and Affiliations
Rights and permissions
Copyright information
© 2002 Springer-Verlag Berlin Heidelberg
About this paper
Cite this paper
Thiyagalingam, J., Kelly, P.H.J. (2002). Is Morton Layout Competitive for Large Two-Dimensional Arrays?. In: Monien, B., Feldmann, R. (eds) Euro-Par 2002 Parallel Processing. Euro-Par 2002. Lecture Notes in Computer Science, vol 2400. Springer, Berlin, Heidelberg. https://doi.org/10.1007/3-540-45706-2_37
Download citation
DOI: https://doi.org/10.1007/3-540-45706-2_37
Published:
Publisher Name: Springer, Berlin, Heidelberg
Print ISBN: 978-3-540-44049-9
Online ISBN: 978-3-540-45706-0
eBook Packages: Springer Book Archive