Shape cliques

We introduce shape cliques, a simple way to organize a subset of the arrays appearing in an array-language-based application into sets of identically shaped arrays - shape cliques - and show how a compiler can analyze an application to infer membership in those cliques. We describe an algorithm for performing shape clique inference (SCI), and demonstrate that shape cliques can improve the performance of generated code, by permitting extension of an optimization for removal of run-time checks, and by extending the set of arrays to which optimizations, such as Index Vector Elimination (IVE), can be applied. Implementation of SCI in the APEX APL compiler permitted removal of 25% of run-time checks remaining on 156 benchmarks remaining after other compiler optimizations had eliminated 72% of the 1251 checks present in the original code. In the SAC compiler, IVE using SCI produced typical speedups of 2-14X on benchmarks operating on arrays of non-fixed rank and shape, compared to the operation of IVE in a non-SCI environment. Shape clique inference data can be exploited to allow certain other optimizations, such as loop fusion and withloop folding, to be performed on arrays of statically unknown shape and rank, with the potential for significant reductions in execution time.

[1]  Clemens Grelck,et al.  SAC—A Functional Array Language for Efficient Multi-threaded Execution , 2006, International Journal of Parallel Programming.

[2]  Alexander V. Shafarenko,et al.  Implementing a Numerical Solution of the KPI Equation Using Single Assignment C: Lessons and Experiences , 2005, IFL.

[3]  Clemens Grelck,et al.  On Optimising Shape-Generic Array Programs Using Symbolic Structural Information , 2006, IFL.

[4]  Mark N. Wegman,et al.  An efficient method of computing static single assignment form , 1989, POPL '89.

[5]  Sven-Bodo Scholz,et al.  WITH-Loop-Folding in SAC - Condensing Consecutive Array Operations , 1997, Implementation of Functional Languages.

[6]  Prithviraj Banerjee,et al.  Compiling MATLAB programs to ScaLAPACK: exploiting task and data parallelism , 1996, Proceedings of International Conference on Parallel Processing.

[7]  Sven-Bodo Scholz,et al.  Single Assignment C: efficient support for high-level array operations in a functional setting , 2003, Journal of Functional Programming.

[8]  Robert Bernecky Apex: the apl parallel executor , 1997 .

[9]  Robert Bernecky Reducing computational complexity with array predicates , 1998, APL.

[10]  Alexander V. Shafarenko,et al.  Index Vector Elimination - Making Index Vectors Affordable , 2006, IFL.

[11]  François Irigoin,et al.  Efficient and effective array bound checking , 2005, TOPL.

[12]  Edith Schonberg,et al.  An HPF Compiler for the IBM SP2 , 1995, Proceedings of the IEEE/ACM SC95 Conference.

[13]  Dietmar Kreye,et al.  A Compilation Scheme for a Hierarchy of Array Types , 2001, IFL.

[14]  Roger K. W. Hui Rank and Uniformity , 1995, APL.