{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

ps6-sol - ECE 468 573 Problem Set 7 Dependence analysis 1...

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

View Full Document Right Arrow Icon
ECE 468 & 573 Problem Set 7: Dependence analysis 1. Draw the iteration space graph for the following loop: for (int i = 0; i < 5; i++) { for (int j = 0; j < 5; j++) { A[i][j - 1] = A[i - 1][j + 2] + A[i][j + 1]; } } Answer: Solid lines = flow dependences, dashed lines = anti dependences, dotted lines = output dependences. 2. Show the distance vector(s) for the loop from the previous problem. Answer: Flow dependence: (1, -3), Anti dependence (0, 2) 3. Show the direction vector(s) for the loop. Answer: Flow dependence: (+, -), Anti dependence (0, +) 4. Can the two loops be interchanged? Why or why not? Answer: No, because the flow dependence is a (+, -) dependence, and it will be broken by interchange. 5. Repeat the previous four steps for the following loop: 1
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
for (int i = 0; i < 5; i++) { for (int j = 0; j < 5; j++) { A[i][j] = A[i + 1][j + 3]; } } Answer: Solid lines = flow dependences, dashed lines = anti dependences, dotted lines = output dependences. There is an anti dependence, with distance (1, 3), and direction (+, +). Thus, interchange is legal. 6. Give an example of a doubly-nested loop with a single statement in the loop body
Image of page 2
Image of page 3
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