skip to main content
article
Free Access

Forma: A framework for safe automatic array reshaping

Published:01 November 2007Publication History
Skip Abstract Section

Abstract

This article presents Forma, a practical, safe, and automatic data reshaping framework that reorganizes arrays to improve data locality. Forma splits large aggregated data-types into smaller ones to improve data locality. Arrays of these large data types are then replaced by multiple arrays of the smaller types. These new arrays form natural data streams that have smaller memory footprints, better locality, and are more suitable for hardware stream prefetching. Forma consists of a field-sensitive alias analyzer, a data type checker, a portable structure reshaping planner, and an array reshaper. An extensive experimental study compares different data reshaping strategies in two dimensions: (1) how the data structure is split into smaller ones (maximal partition × frequency-based partition × affinity-based partition); and (2) how partitioned arrays are linked to preserve program semantics (address arithmetic-based reshaping × pointer-based reshaping). This study exposes important characteristics of array reshaping. First, a practical data reshaper needs not only an inter-procedural analysis but also a data-type checker to make sure that array reshaping is safe. Second, the performance improvement due to array reshaping can be dramatic: standard benchmarks can run up to 2.1 times faster after array reshaping. Array reshaping may also result in some performance degradation for certain benchmarks. An extensive micro-architecture-level performance study identifies the causes for this degradation. Third, the seemingly naive maximal partition achieves best or close-to-best performance in the benchmarks studied. This article presents an analysis that explains this surprising result. Finally, address-arithmetic-based reshaping always performs better than its pointer-based counterpart.

References

  1. Al-Sukhni, H., Bratt, I., and Connors, D. A. 2003. Compiler-directed content-aware prefetching for dynamic data structures. In Proceedings of the 12th International Conference on Parallel Architectures and Compilation Techniques (PACT) (New Orleans, LA). 91--100. Google ScholarGoogle ScholarDigital LibraryDigital Library
  2. Allen, J. R. and Kennedy, K. 1984. Automatic loop interchange. In Proceedings of the SIGPLAN Symposium on Compiler Construction (Montreal, QC, Canada). ACM, New York, 233--246. Google ScholarGoogle ScholarDigital LibraryDigital Library
  3. Anderson, J. M., Amarasinghe, S. P., and Lam, M. S. 1995. Data and computation transformations for multiprocessors. In Proceedings of the Symposium of Principles and Practice of Parallel Programming (PPoPP) (Santa Barbara, CA). 166--178. Google ScholarGoogle ScholarDigital LibraryDigital Library
  4. Badawy, A.-H., Aggarwal, A., Yeung, D., and Tseng, C.-W. 2001. Evaluating the impact of memory system performance on software prefetching and locality optimizations. In Proceedings of the 2001 International Conference on Supercomputing (ICS'01) (Sorrento, Italy). 486--500. Google ScholarGoogle ScholarDigital LibraryDigital Library
  5. Chase, D. R., Wegman, M., and Zadeck, F. K. 1990. Analysis of pointers and structures. In Proceedings of the Programming Language Design and Implementation (PLDI) (White Plains, NY). ACM, New York, 296--310. Google ScholarGoogle ScholarDigital LibraryDigital Library
  6. Chilimbi, T. M., Davidson, B., and Laurus, J. R. 1999. Cache-conscious structure definition. In Proceedings of the Programming Language Design and Implementation (PLDI) (Atlanta, GA). ACM, New York, 13--24. Google ScholarGoogle ScholarDigital LibraryDigital Library
  7. Condit, J., Harren, M., McPeak, S., Necula, G. C., and Weimer, W. 2003. Cured in the real world. In Proceedings of the Programming Language Design and Implementation (PLDI) (San Diego, CA). ACM, New York, 232--244. Google ScholarGoogle ScholarDigital LibraryDigital Library
  8. Ding, C. and Kennedy, K. 1999. Improving cache performance in dynamic applications through data and computation reorganization at run time. In Proceedings of the Programming Language Design and Implementation (PLDI) (Atlanta, GA). ACM, New York, 229--241. Google ScholarGoogle ScholarDigital LibraryDigital Library
  9. Franz, M. and Kistler, T. 1998. Splitting data objects to increase cache utilization. Tech. Report ICS-TR-98-34, Dept. of Information and Computer Science, Univ. of California, Irvine, Irvine, CA, Oct.Google ScholarGoogle Scholar
  10. Hind, M. and Pioli, A. 2000. Which pointer analysis should I use? In Proceedings of the International Symposium on Software Testing and Analysis (Portland, OR). 113--123. Google ScholarGoogle ScholarDigital LibraryDigital Library
  11. Holte, R. C., Mkadmi, T., Zimmer, R. M., and MacDonald, A. J. 1996. Speeding up problem solving by abstraction: A graph oriented approach. Artif. Intell. 85, 1--2, 321--361. Google ScholarGoogle ScholarDigital LibraryDigital Library
  12. Hsu, C. and Kremer, U. 2000. A stable and efficient loop tiling algorithm. In Proceedings of the Mid-Atlantic Student Workshop on Programming Languages and Systems (Newark, DE).Google ScholarGoogle Scholar
  13. IBM. 2001. The Power4® Processor Introduction and Tuning Guide. IBM Corp. International Technical Support Organization, http://www.redbooks.ibm.com/.Google ScholarGoogle Scholar
  14. Intel. 2002. Intel® Itanium® Architecture Software Developer's Manual. Intel Corporation.Google ScholarGoogle Scholar
  15. Ishizaka, K., Obata, M., and Kasahara, H. 2003. Cache optimization for coarse grain task parallel processing using inter-array padding. In Proceedings of the Workshop on Languages and Compilers for Parallel Computing (LCPC) (College Station, TX). 64--76.Google ScholarGoogle Scholar
  16. ISO/IEC. 1990. Programming Languages - C. 1st Edition. International Standard ISO/IEC 9899.Google ScholarGoogle Scholar
  17. Karlsson, M., Dahlgren, F., and Stenstrom, P. 2000. A prefetching technique for irregular accesses to linked data structures. In Proceedings of the 6th International Symposium on High-Performance Computer Architecture (Toulouse, France). 206--217.Google ScholarGoogle Scholar
  18. Kennedy, K. 2000. Fast greedy weighted fusion. In Proceedings of the 14th International Conference on Supercomputing. Santa Fe, NM, 131--140. Google ScholarGoogle ScholarDigital LibraryDigital Library
  19. Kodukula, I., Ahmed, N., and Pingali, K. 1997. Data-centric multi-level blocking. In Proceedings of the Programming Language Design and Implementation (PLDI) (Las Vegas, NV). ACM, New York, 346--357. Google ScholarGoogle ScholarDigital LibraryDigital Library
  20. Lattner, C., and Adve, V. 2002. Automatic pool allocation for disjoint data structures. In ACM SIGPLAN Workshop on Memory System Performance (Berlin, Germany). ACM, New York, 13--24. Google ScholarGoogle ScholarDigital LibraryDigital Library
  21. Luk, C. K. 2000. Optimizing the cache performance of non-numeric applications. Ph.D. dissertation, Dept. of Computer Science, Univ. of Toronto, Toronto, Ont., Canada. Google ScholarGoogle ScholarDigital LibraryDigital Library
  22. Luk, C.-K. and Mowry, T. C. 1996. Compiler-based prefetching for recursive data structures. In Proceedings of the International Conference on Architectural Support for Programming Languages and Operating Systems (ASPLOS) (Cambridge, MA). ACM, New York, 222--233. Google ScholarGoogle ScholarDigital LibraryDigital Library
  23. McKinley, K. S., Carr, S., and Tseng, C.-W. 1996. Improving data locality with loop transformations. ACM Trans. Prog. Lang. Syst. 18, 4 (July), 424--453. Google ScholarGoogle ScholarDigital LibraryDigital Library
  24. Necula, G. C., McPeak, S., and Weimer, W. 2002. CCured: Type-safe retrofitting of legacy code. In Proceedings of the Principles of Programming Languages (POPL) (Portland, OR). ACM, New York, 128--139. Google ScholarGoogle ScholarDigital LibraryDigital Library
  25. Niewiadomski, R., Amaral, J. N., and Holte, R. 2003. Crafting data structures: A study of reference locality in refinement-based path finding. In Proceedings of the International Conference on High Performance Computing (Hyderabad, India). Springer-Verlag, New York, 438--448.Google ScholarGoogle Scholar
  26. Niewiadomski, R., Amaral, J. N., and Holte, R. C. 2004. A performance study of data layout techniques for improving data locality in refinement-based pathfinding. ACM J. Exper. Algor. 9, 1.4, 1--28. Google ScholarGoogle ScholarDigital LibraryDigital Library
  27. Palem, S., Rabbah, R., Mooney V. J., Korkmaz, P., and Puttaswamy, K. 2000. Design space optimization of embedded memory systems via data remapping. In Proceedings of the 2002 Joint Conference on Languages, Compilers, and Tools for Embedded Systems & Software and Compilers for Embedded Systems (LCTES'02-SCOPES'02) (Berlin, Germany). ACM, New York, 28--37. Google ScholarGoogle ScholarDigital LibraryDigital Library
  28. Rabbah, R., and Palem, S. 2003. Data remapping for design space optimization of embedded memory systems. ACM Trans. Embed. Comput. Syst. 2, 2, 186--218. Google ScholarGoogle ScholarDigital LibraryDigital Library
  29. Rivera, G. and Tseng, C.-W. 1998. Data transformations for eliminating conflict misses. In Proceedings of the Programming Language Design and Implementation (PLDI) (Montreal, Que., Canada). ACM, New York, 38--49. Google ScholarGoogle ScholarDigital LibraryDigital Library
  30. Rivera, G. and Tseng, C.-W. 1999. A comparison of compiler tiling algorithms. In Proceedings of the 8th International Conference on Compiler Construction (Amsterdam, Netherlands). Springer-Verlag, New York, 168--182. Google ScholarGoogle ScholarDigital LibraryDigital Library
  31. Roth, A., Moshovos, A., and Sohi, G. S. 1998. Dependence based prefetching for linked data structures. ACM SIG-PLAN Notices 33, 11, 115--126.Google ScholarGoogle ScholarDigital LibraryDigital Library
  32. Ryder, B. G. 2003. Dimensions of precision in reference analysis of object-oriented programming languages. In Proceedings of the International Conference on Compiler Construction (Warsaw, Poland). Springer-Verlag, New York, 168--179.Google ScholarGoogle ScholarCross RefCross Ref
  33. Singhai, S. and McKinley, K. 1996. Loop fusion for data locality and parallelism. In Proceedings of the Mid-Atlantic Student Workshop on Programming Languages and Systems (New Paltz, NY).Google ScholarGoogle Scholar
  34. Singhai, S., and McKinley, K. S. 1997. A parameterized loop fusion algorithm for improving parallelism and cache locality. Compute. J. 40, 6, 340--355.Google ScholarGoogle Scholar
  35. Steensgaard, B. 1996a. Points-to analysis by type inference of programs with structures and unions. In Proceedings of the 6th International Conference on Compiler Construction (Linkoping, Sweden). Springer-Verlag, New York, 136--150. Google ScholarGoogle ScholarDigital LibraryDigital Library
  36. Steensgaard, B. 1996b. Points-to analysis in almost linear time. In Proceedings of the Principles of Programming Languages (POPL) (St. Petersburg, FL). ACM, New York, 32--41. Google ScholarGoogle ScholarDigital LibraryDigital Library
  37. Stoutchinin, A., Amaral, J. N., Gao, G. R., Dehnert, J., Jain, S., and Douillet, A. 2001. Speculative prefetching of induction pointers. In Proceedings of the International Conference on Compiler Construction 2001 (Genova, Italy). Springer-Verlag, New York, 289--303. Google ScholarGoogle ScholarDigital LibraryDigital Library
  38. Strout, M. M., Carter, L., and Ferrante, J. 2003. Compile-time composition of run-time data and iteration reorderings. In Proceedings of the Symposium Programming Language Design and Implementation (PLDI) (San Diego, CA). ACM, New York, 91--102. Google ScholarGoogle ScholarDigital LibraryDigital Library
  39. VanderWiel, S. P. and Lilja, D. J. 2000. Data prefetch mechanisms. ACM Comput. Sur. 32, 2, 174--199. Google ScholarGoogle ScholarDigital LibraryDigital Library
  40. Wolfe, M. 1987. Iteration space tiling for memory hierarchies. In Proceedings of the 3rd Annual SIAM Conference on Parallel Processing for Scientific Computing (Reno, NV). SIAM, 357--361. Google ScholarGoogle ScholarDigital LibraryDigital Library
  41. Wolfe, M. J. 1996. High Performance Compilers for Parallel Computing. Addison-Wesley, Reading, MA. Google ScholarGoogle ScholarDigital LibraryDigital Library
  42. Yong, S. H., Horwitz, S., and Reps, T. 1999. Pointer analysis for programs with structures and casting. In Proceedings of the Symposium on Programming Language Design and Implementation (PLDI) (Atlanta, GA). ACM, New York, 91--103. Google ScholarGoogle ScholarDigital LibraryDigital Library
  43. Zhong, Y., Orlovich, M., Shen, X., and Ding, C. 2004. Array regrouping and structure splitting using whole-program reference affinity. In Proceedings of the Symposium on Programming Language Design and Implementation (PLDI) (Washington, DC). ACM, New York, 255--266. Google ScholarGoogle ScholarDigital LibraryDigital Library

Index Terms

  1. Forma: A framework for safe automatic array reshaping

              Recommendations

              Comments

              Login options

              Check if you have access through your login credentials or your institution to get full access on this article.

              Sign in

              Full Access

              • Published in

                cover image ACM Transactions on Programming Languages and Systems
                ACM Transactions on Programming Languages and Systems  Volume 30, Issue 1
                November 2007
                241 pages
                ISSN:0164-0925
                EISSN:1558-4593
                DOI:10.1145/1290520
                Issue’s Table of Contents

                Copyright © 2007 ACM

                Publisher

                Association for Computing Machinery

                New York, NY, United States

                Publication History

                • Published: 1 November 2007
                Published in toplas Volume 30, Issue 1

                Permissions

                Request permissions about this article.

                Request Permissions

                Check for updates

                Qualifiers

                • article

              PDF Format

              View or Download as a PDF file.

              PDF

              eReader

              View online with eReader.

              eReader
              About Cookies On This Site

              We use cookies to ensure that we give you the best experience on our website.

              Learn more

              Got it!