

Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
Community
Ask the community for help and clear up your study doubts
Discover the best universities in your country according to Docsity users
Free resources
Download our free guides on studying techniques, anxiety management strategies, and thesis advice from Docsity tutors
Information about an assignment for a computer science course (cs 698l) in the semester 2019–2020-i. The assignment includes four problems with instructions, data dependences, and expected outcomes. Students are required to write code for various loop unrolling, permutations, and tiling, as well as identify data dependences.
Typology: Assignments
1 / 3
This page cannot be seen from the preview
Don't miss anything!
Due Your assignment is due by Sep 1 2019 11:59 PM IST.
General Policies
Submission
Consider the following code:
for i = 1, N- for j = i+1, i+N- A(i, i-j) = A(i, i-j-1) - A(i+1, i-j) + A(i-1, i-j-1)
List all flow, anti, and output dependences, if any.
Consider the following code:
int i, j, t; for (t = 0; t < 1024; t++) { for (i = 0; i < 1024; i++) { for (j = 1; j < 2048 - i; j++) { S(t, i, j); } } }
The data dependences for the loop are given to be (0,1,-1), (0,0,1), and (1,-1,0).
(a) Which loops, if any, are valid to unroll? Why?
(b) What are valid permutations of the loop? Why?
(c) What tiling is valid, if any?
(d) Show valid code for the tji permutation of the loop. For this part and the next one, assume all permutations are valid.
(e) Show a 2-way i-unrolled form (i.e., unroll-jam) for the tij form.
Problem 3 [70 points]
Consider the following code: int i, j, t, k; for (t = 0; t < 1024; t++) { for (i = t; i < 1024; i++) { for (j = t; j < i; j++) { for (k = 1; k < j; k++) { S(t, i, j, k); } } } }
The data dependences for the loop are given to be (1,0,-1,1), (1,-1,0,1), and (0,1,0,-1).
(a) Which loops, if any, are valid to unroll? Why?
(b) What are valid permutations of the loop? Why?
(c) What tiling is valid, if any?
(d) Which loops, if any, are parallel?
(e) Show code for the tikj form of the code. For this part, ignore the above dependences and assume tikj permutation is allowed.
Problem 4 [50 points]
Consider the following code: #define N 1024 double A[N][N]; int t,i,j; for (t = 0; t < N; t++) { for (i = 1; i < N-1; i++) { for (j = 1; j < N-1; j++) { A[i][j] = 0.2*(A[i-1][j] + A[i][j] + A[i+1][j] + A[i][j-1] + A[i][j+1]); } } }
(a) List all data dependences, stating the kind of dependence and the distance vector.