{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

ece475-l17 - ECE 475/CS 416 Computer Architecture Hardware...

Info icon This preview shows pages 1–5. Sign up to view the full content.

View Full Document Right Arrow Icon
1 ECE 475/CS 416 Computer Architecture - Hardware Support for Software Approaches Edward Suh C omputer S ystems L aboratory [email protected] ECE 475/CS 416 — Computer Architecture, Fall 2007 Prof. Suh Announcements
Image of page 1

Info icon This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
2 ECE 475/CS 416 — Computer Architecture, Fall 2007 Prof. Suh Review ± Wide-issue processors require lots of ILP to fill the pipeline Little’s law ± How can compilers extract ILP? Basic pipeline scheduling Loop unrolling Software pipelining Trace scheduling ± Dependence analysis is a key for scheduling ECE 475/CS 416 — Computer Architecture, Fall 2007 Prof. Suh Dependence Analysis In general how can a compiler determine if a loop is parallel? need to detect if there are any dependences Nearly all algorithms assume array indices are af fi ne array index is af fi ne if it can be written in the form a*i+ b a and b are constants and i is the loop index variable for multi-dimensional arrays, each index must be af fi ne Deciding whether there is a dependence between two accesses is same as deciding whether two af fi ne functions can have the same value for different indices within the bounds of the loop
Image of page 2
3 ECE 475/CS 416 — Computer Architecture, Fall 2007 Prof. Suh Dependence Analysis Algorithm Assume we store an element with an index value a*i + b and load an element with index c*i + d where i runs from m to n A dependence exists if both of the following hold there are 2 iterations j and k such that m <= j,k <= n there is a store to an element with index a*j+b and a later load from the same array element c*k+d . i.e. a*j + b = c*k + d Unfortunately, in general cannot determine at compile time a,b,c,d may not be known (could be in other arrays!) might be known at compile time but expensive to compute accesses depend on indices of multiple nested loops... ECE 475/CS 416 — Computer Architecture, Fall 2007 Prof. Suh GCD Test Luckily, many programs use indices known at compile time a,b,c,d are often constants One simple and ef fi cient test is the GCD test GCD is the greatest common divisor (remember 4 th grade?) Observation: if a loop-carried dependence exists then: GCD( c,a ) must divide ( d-b ) In other words, ( d-b )/GCD( c,a ) is an integer Why? well if a*j + b = c*k + d then a*j – c*k = ( d-b ) therefore ( a /GCD( a,c ) * j c /GCD( a,c ) * k ) = ( d-b )/GCD(a,c) implies GCD( a,c ) divides ( d-b ) Q.E.D.
Image of page 3

Info icon This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
4 ECE 475/CS 416 — Computer Architecture, Fall 2007 Prof. Suh Example Is the following loop parallel? for (j=0; j <=100; j++) { A[2*j+3] = A[2*j] * 5.0; } First, are the indices af fi ne? what are values of a,b,c,d ? what is GCD( a,c )? ( d-b )? does GCD( a,c ) divide d-b ? The GCD test is suf fi cient to guarantee no dependences but it is not necessary (there are false positives) can anyone think of why? Improvement over GCD: Banerjee ± s Test (There are others…) ECE 475/CS 416 — Computer Architecture, Fall 2007 Prof. Suh General Dependence Analysis Determining dependences in the general case is NP-complete this does not mean it is impossible, but rather that there are no
Image of page 4
Image of page 5
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern