1 Partitioning Loops with Variable Dependence Distances Yijun Yu and Erik D’Hollander Department of Electronics and Information Systems University of Ghent,

Slides:



Advertisements
Similar presentations
Optimizing Compilers for Modern Architectures Copyright, 1996 © Dale Carnegie & Associates, Inc. Dependence Testing Allen and Kennedy, Chapter 3 thru Section.
Advertisements

5.1 Real Vector Spaces.
Example: Given a matrix defining a linear mapping Find a basis for the null space and a basis for the range Pamela Leutwyler.
1 ECE734 VLSI Arrays for Digital Signal Processing Loop Transformation.
Using the Iteration Space Visualizer in Loop Parallelization Yijun YU
How to find intersection of lines? Snehal Poojary.
Chapter 4 Systems of Linear Equations; Matrices Section 2 Systems of Linear Equations and Augmented Matrics.
1 Systems of Linear Equations & Matrices Sections 4.2 & 4.3 After today’s lesson, you will be able to Use terms associated with matrices. Set up and solve.
Section 4.6 (Rank).
SOLVING SYSTEMS OF LINEAR EQUATIONS. Overview A matrix consists of a rectangular array of elements represented by a single symbol (example: [A]). An individual.
The Simplex Method: Standard Maximization Problems
Some useful linear algebra. Linearly independent vectors span(V): span of vector space V is all linear combinations of vectors v i, i.e.
Chapter 2 Basic Linear Algebra
A Data Locality Optimizing Algorithm based on A Data Locality Optimizing Algorithm by Michael E. Wolf and Monica S. Lam.
Chapter 1 Systems of Linear Equations
Lecture 10 Dimensions, Independence, Basis and Complete Solution of Linear Systems Shang-Hua Teng.
INDR 262 INTRODUCTION TO OPTIMIZATION METHODS LINEAR ALGEBRA INDR 262 Metin Türkay 1.
5  Systems of Linear Equations: ✦ An Introduction ✦ Unique Solutions ✦ Underdetermined and Overdetermined Systems  Matrices  Multiplication of Matrices.
Matrices Write and Augmented Matrix of a system of Linear Equations Write the system from the augmented matrix Solve Systems of Linear Equations using.
1 Systems of Linear Equations & Matrices Sections 4.2 & 4.3 After today’s lesson, you will be able to Use terms associated with matrices. Set up and solve.
Matrix Solution of Linear Systems The Gauss-Jordan Method Special Systems.
LINEAR PROGRAMMING SIMPLEX METHOD.
1 February 24 Matrices 3.2 Matrices; Row reduction Standard form of a set of linear equations: Chapter 3 Linear Algebra Matrix of coefficients: Augmented.
ECON 1150 Matrix Operations Special Matrices
Rev.S08 MAC 1140 Module 10 System of Equations and Inequalities II.
Square n-by-n Matrix.
Copyright © 2000 by the McGraw-Hill Companies, Inc. Barnett/Ziegler/Byleen Precalculus: A Graphing Approach Chapter Eight Systems: Matrices.
Gaussian Elimination, Rank and Cramer
Linear Algebra Lecture 25.
CALCULUS – II Gauss Elimination
Presentation by: H. Sarper
Chapter 2 – Linear Transformations
1 Parallel Programming using the Iteration Space Visualizer Yijun YuYijun Yu and Erik H. D'HollanderErik H. D'Hollander University of Ghent, Belgium
Aug 15-18, Montreal, Canada1 Recurrence Chain Partitioning of Non-Uniform Dependences Yijun Yu Erik H. D ’ Hollander.
Chapter 2 Simultaneous Linear Equations (cont.)
Multivariate Statistics Matrix Algebra II W. M. van der Veld University of Amsterdam.
Section 3.6 – Solving Systems Using Matrices
Array Dependence Analysis COMP 621 Special Topics By Nurudeen Lameed
We will use Gauss-Jordan elimination to determine the solution set of this linear system.
Chapter Content Real Vector Spaces Subspaces Linear Independence
Section 4-1: Introduction to Linear Systems. To understand and solve linear systems.
Matrices Addition & Subtraction Scalar Multiplication & Multiplication Determinants Inverses Solving Systems – 2x2 & 3x3 Cramer’s Rule.
Vector Norms and the related Matrix Norms. Properties of a Vector Norm: Euclidean Vector Norm: Riemannian metric:
Section 2.3 Properties of Solution Sets
Examples of linear transformation matrices Some special cases of linear transformations of two-dimensional space R 2 are illuminating:dimensional Dimoffree.svgDimoffree.svg‎
1 MODELING MATTER AT NANOSCALES 4. Introduction to quantum treatments The variational method.
4.8 Rank Rank enables one to relate matrices to vectors, and vice versa. Definition Let A be an m  n matrix. The rows of A may be viewed as row vectors.
Solve a system of linear equations By reducing a matrix Pamela Leutwyler.
10.3 Systems of Linear Equations: Matrices. A matrix is defined as a rectangular array of numbers, Column 1Column 2 Column jColumn n Row 1 Row 2 Row 3.
Linear Algebra Diyako Ghaderyan 1 Contents:  Linear Equations in Linear Algebra  Matrix Algebra  Determinants  Vector Spaces  Eigenvalues.
3.6 Solving Systems Using Matrices You can use a matrix to represent and solve a system of equations without writing the variables. A matrix is a rectangular.
Arab Open University Faculty of Computer Studies M132: Linear Algebra
Linear Algebra Diyako Ghaderyan 1 Contents:  Linear Equations in Linear Algebra  Matrix Algebra  Determinants  Vector Spaces  Eigenvalues.
Matrices and Matrix Operations. Matrices An m×n matrix A is a rectangular array of mn real numbers arranged in m horizontal rows and n vertical columns.
Lecture 14: Pole placement (Regulator Problem) 1.
1 ECE 102 Engineering Computation Chapter 3 Math Review 3: Cramer’s Rule Dr. Herbert G. Mayer, PSU Status 10/11/2015 For use at CCUT Fall 2015.
1 ECE 221 Electric Circuit Analysis I Chapter 6 Cramer’s Rule Herbert G. Mayer, PSU Status 11/14/2014 For use at Changchun University of Technology CCUT.
4 4.2 © 2016 Pearson Education, Inc. Vector Spaces NULL SPACES, COLUMN SPACES, AND LINEAR TRANSFORMATIONS.
Chapter 5 Chapter Content 1. Real Vector Spaces 2. Subspaces 3. Linear Independence 4. Basis and Dimension 5. Row Space, Column Space, and Nullspace 6.
Linear Algebra Review Tuesday, September 7, 2010.
Linear Algebra Engineering Mathematics-I. Linear Systems in Two Unknowns Engineering Mathematics-I.
5 Systems of Linear Equations and Matrices
Data Dependence, Parallelization, and Locality Enhancement (courtesy of Tarek Abdelrahman, University of Toronto)
Background: Lattices and the Learning-with-Errors problem
Chapter 10: Solving Linear Systems of Equations
Eigenvalues and Eigenvectors
Mathematics for Signals and Systems
Maths for Signals and Systems Linear Algebra in Engineering Lectures 4-5, Tuesday 18th October 2016 DR TANIA STATHAKI READER (ASSOCIATE PROFFESOR) IN.
Elementary Linear Algebra Anton & Rorres, 9th Edition
Chapter 2 Determinants.
Presentation transcript:

1 Partitioning Loops with Variable Dependence Distances Yijun Yu and Erik D’Hollander Department of Electronics and Information Systems University of Ghent, Belgium

2 Introduction 1.Overview 2.Dependence analysis: pseudo distance matrix (PDM) 3.Loop transformations: unimodular and partitioning 4.Results 5.Conclusion

3 1. Overview Loop with linear array subscripts Solve dependence equation Find all non-constant distances Create maximally covering grid and base-vectors Create the pseudo distance matrix, PDM containing all base-vectors of the covering grid Find independent loops or independent partitions, based on the rank of PDM

4 Approach Uniform or constant distance Variable or non-constant distance rank(H)<loop depth? Non-full rank Full rank Partitioning transformation Unimodular transformation NY Dependence analysis: H= PDM det(H)> 1? Loop parallelization Y N Linear dependence equation Loop transformation:

5 2. Dependence Analysis 4I 1 -I 2 +3=J 1 +J I 1 +I 2 -2=J 1 -J 2 +2 f(i)=g(j) iA+a = jB+b i=(I 1,I 2 ) j=(J 1,J 2 ) A[f(I)]=… …=A[g(I)] L 1 :do I 1 = -N,N L 2 : do I 2 = -N,N A(4I 1 -I 2 +3,2I 1 +I 2 -2)=… …=A(I 1 +I 2 -1,I 1 -I 2 +2) enddo ijA[f(i)]=A[g(j)]d=|j-i| (1, -5)(3, 10)A[12, -5](2,15) (3, 0)(9, 7)A[15, 4](6, 7) (-3,-3)(-9, 4)A[-6,-11](6, -7) …

6 The dependence distance 1. The linear dependence equation: 2. Using Banerjee’s unimodular transformation U to obtain an echelon matrix S, the equation t S=(b-a) is solved, yielding: 3. The distance between dependent iterations i, j is: U l and U r are left, right halves of U t has constant part t 1 and unknown part t 2

7 The distance set 1. From the dependence equation t S = (b-a), the solution vector t contains a constant and an arbitrary part: 2. Matrix F=U r -U l can be vertically separated into two sub-matrices: 3. The distance set of the dependence equations is: 

8 Distances in the iteration space Iteration-space (i 1,i 2 ) of loop 1 with dep. eqns: 4I 1 -I 2 +3=J 1 +J I 1 +I 2 -2=J 1 -J The arrows (I1,I2)  (J1,J2) represent the distance vectors between dependent iterations. i1i1 i2i2

9 Distances base vectors 1.The dependence distance is non-constant for the reference pair, e.g. (2,15),(6,7),(6,-7), as highlighted. 2.However, the distance set is spanned by the grid generated by the base vectors (2,1) and (0,2). 3.For example, (2,15) = (2,1) + 7 (0,2), (6, 7) = 3 (2,1) + 2 (0,2), (6, -7) = 3 (2,1) - 5 (0,2). i1i1 i2i2

10 The largest base vectors The distance set is the linear combination of the row vectors in R : A lattice L ( R ) is a group of vectors generated by all the linear combinations of the independent row vectors of a matrix R. We look for the smallest lattice L ( R ) (generating the largest grid) which covers the whole distance set: In this way, possible spurious dependencies introduced by replacing the distance set with a lattice are minimized. 

11 Pseudo Distance Matrix (PDM) A Hermite normal form HNF ( R ) is a full row rank matrix reduced from the echelon form of R by unimodular transformation. Therefore H generates the same lattice as R does, that is, the smallest lattice. In addition, the HNF rows are base vectors. H is called the pseudo distance matrix (PDM), because it generates the distance set from its row vectors. Since the row vectors of H are constant, the techniques from the uniform distance dependence matrix may apply. H = HNF (R) L (H) = L (R)

12 Calculating the PDM 1. Solving the linear dependence equations: 2. Expressing the distance set : 3. Finding the largest base vectors:

13 3. Loop transformations: unimodular and partitioning Legality Any transformation should be legal, i.e. preserve the executing order of dependent iterations. Transformations depending on rank(H): 3.1 Unimodular transformation: non-full rank PDM 3.2 Partitioning transformation: full rank PDM 3.3 Combined approach

Unimodular transformation Given a non-full rank ( r  m ) pseudo distance matrix H, a unimodular matrix T can be developed such that the first m-r columns of HT are zero. As a result, m-r outermost loops can be parallelized.

Partitioning transformation Given a full rank pseudo distance matrix H, the loop nest can be partitioned such that det( H ) partitions are found. The partitioned parallelism is det( H ).

Combined approach After a unimodular transformation on a non-full rank PDM, the transformed PDM matrix has a full rank sub-matrix, S. When the det(S)>1, additional parallelism can be found using loop partitioning transformation.

17 L’ 1 :doall J 1 =-2N,2N L’ 2 : do J 2 =max(-N,-N-J 1 ), min(N,N-J 1 ) I 1 =J 2 I 2 =J 1 +J 2 A(3I 1 +1,2I 1 +I 2 -1)=… …=A(I 1 +3,I 2 +1) enddo enddoall 4. Results (1) Non-full rank PDM PDM=(2,2)(2,0)(0,2) L 1 :do I 1 =-N,N L 2 : do I 2 =-N,N A(3I 1 +1,2I 1 +I 2 -1)=… …=A(I 1 +3,I 2 +1) enddo

18 NF-rank: Dependence graphs j1j1 j2j2 i2i2

19 4. Results (2) partitioning L 1 :do I 1 =-N,N L 2 : do I 2 =-N,N A(4I 1 -I 2 +3,2I 1 +I 2 -2)=… …=A(I 1 +I 2 -1,I 1 -I 2 +2) enddo L’ 1 : doall Io 1 =0,1 L’ 2 : doall Io 2 =0,1 L’ 3 :do I 1 =-N+mod(N+Io 1,2), N-mod(N-Io 1,2),2 io’ 2 =Io 2 +(I 1 -Io 1 )/2 L’ 4 : do I 2 =-N+mod(N+Io’ 2,2), N-mod(N-Io’ 2,2),2 A(4I 1 -I 2 +3,2I 1 +I 2 -2)=… …=A(I 1 +I 2 -1,I 1 -I 2 +2) enddo enddoall

20 F-rank partitioning: dependence graphs

21 4. Results (3) Combined PDM=(2,2)(0, 2) L’ 1 :doall J 1 =-2N,2N L’ 2 : do J 2 =max(-N,-N-J 1 ), min(N,N-J 1 ) I 1 =J 2 I 2 =J 1 +J 2 A(3I 1 +1,2I 1 +I 2 -1)=… …=A(I 1 +3,I 2 +1) enddo enddoall (0, 1) L’’ 1 : doall Jo 2 =0,1 L’’ 2 : doall J 1 =-2N,2N p2=max(-N,-N-J 1 ) q2=min(N,N-J 1 ) L’’ 3 : do J 2 =p 2 +mod(Jo 2 -p 2,2), q 2 -mod(q 2 -Jo 2,2),2 I 1 =J 2 I 2 =J 1 +J 2 A(3I 1 +1,2I 1 +I 2 -1)=… …=A(I 1 +3,I 2 +1) enddo enddoall

22 F-rank submatrix dependence graph j1j1 j2j2 j2j2 j2j2 j1j1 j1j1

23 5. Conclusion The distances of the dependent iterations are non- constant when the array subscripts are linear. A pseudo distance matrix(PDM) with the largest base vectors of the distance space is computed from the linear dependence equations. Parallelism can still be exploited for these loops with variable distances by the unimodular and partitioning transformations that are derived from the PDM.