A framework for enhancing data reuse via associative reordering

Kevin Stock, Martin Kong, Tobias Grosser, Louis-Noël Pouchet, Fabrice Rastello, J. Ramanujam, P. Sadayappan
2013 Proceedings of the 35th ACM SIGPLAN Conference on Programming Language Design and Implementation - PLDI '14  
The freedom to reorder computations involving associative operators has been widely recognized and exploited in designing parallel algorithms and to a more limited extent in optimizing compilers. In this paper, we develop a novel framework utilizing the associativity and commutativity of operations in regular loop computations to enhance register reuse. Stencils represent a particular class of important computations where the optimization framework can be applied to enhance performance. We show
more » ... how stencil operations can be implemented to better exploit register reuse and reduce load/stores. We develop a multi-dimensional retiming formalism to characterize the space of valid implementations in conjunction with other program transformations. Experimental results demonstrate the effectiveness of the framework on a collection of high-order stencils. for (i=k; i<N-k; i++) for (j=k; j<N-k; j++) { OUT[i][j] = 0; // Compact representation shown below. // Loops (ii,jj) are fully unrolled for // each value of k generated in Fig. 1(b) for (ii=-k; ii<=k; ii++) for (jj=-k; jj<=k; jj++) OUT[i][j] += IN[i+ii][j+jj]*W[k+ii][k+jj]; }
doi:10.1145/2594291.2594342 dblp:conf/pldi/StockKGPRRS14 fatcat:z5kxavwrczdilgay2ojajsqm7m