90 likes | 230 Views
Data Shackling. Locality enhancement of dense numerical linear algebra codes Traversals along co-ordinate axes Data-centric reference for each statement No array copying. Workloads. Basic Linear Algebra Subroutines Dot Product : xTy Sapxy : α * x + y Matrix vector : y = A * x
E N D
Data Shackling • Locality enhancement of dense numerical linear algebra codes • Traversals along co-ordinate axes • Data-centric reference for each statement • No array copying
Workloads • Basic Linear Algebra Subroutines • Dot Product : xTy • Sapxy : α * x + y • Matrix vector : y = A * x • Triangular Solve : Lx = b • Matrix Multiplication : C = C + A*B • Matrix Factorizations • Cholesky • LU • QR
Why is BLAS approach not good enough? • What is BLAS? • Machine specific code for each BLAS • Matrix factorizations are blocked • Exposes a BLAS like interface • • BLAS not portable but matrix codes are • • Automating the production of block codes not easy • Too difficult an approach for compilers
What is a data shackle? • One array in the program • Divided into blocks • Using parallel equally spaced cutting planes • Order for visiting blocks of data • One reference of that array is selected for each statement
Intuitively…A Data Shackle • Specifies the order for touching blocks • Data centric reference • Which iterations of each statement are performed • When that block is touched • Code is generated to group those iterations together
Example – Matrix Multiplication • Obtain the data shackle on C • Divide C into • 25 x 25 blocks • Vertical and horizontal cutting planes • Visited : L-R T-B • C(i,j) is data-centric reference
Discussion on example • More optimzed code can be produced by folding the loop bounds • Within a block order of instructions preserved • Cannot say the same for program • Not the real blocked code • Low locality for A and B • Compose shackles .. later
Are all shackles legal? • Definitely not • Program instructions reordered