CS398 Exam 3, 2 Chance December 17th, 2012: Circle The Section That Attend (So We Can Hand Back Your Exam)
CS398 Exam 3, 2 Chance December 17th, 2012: Circle The Section That Attend (So We Can Hand Back Your Exam)
Name:
NETID:
Circle the section that attend (so we can hand back your exam).
Monday
Tuesday
This exam has 7 pages; the final sheet is provided as a reference to you.
You have 120 minutes.
No calculators or other electronics are allowed. You may bring one 8.5 x 11 sheet of handwritten notes.
To make sure you receive credit, please write clearly and show your work.
We will not answer questions regarding course material.
The 2nd chance test is done at the granularity of the 3 questions; if you choose to have a
question graded, we will grade ALL PARTS of that question and use that to update your score.
Question
Maximum
40
25
20
Total
100
Your Score
!
Question 1:! Pipelining, cont.
map:
loop:
stall
!forwA
____1
!____10 !____11!
____2
!____12 !!
____3
!____13 !____14!
____4
!____15 !____16!
____5
!____17 !!
____6
!____18 !____19!
done:
!forwB!
!jr !$ra!
Part (e) Re-schedule/re-write the function to
make it faster. Faster code will achieve more
points, but your answer must fit in the space below.
(10 points)
Part (a) Compute the MINIMUM number of cache misses per outer-loop iteration that is possible for the
code on the previous page. Explain how you computed it and the assumptions you made! (15 points)
Part (b) Compute the MAXIMUM number of cache misses per outer-loop iteration that is possible for the
code on the previous page. Explain how you computed it and the assumptions you made! (10 points)
a) (10 points)
!
addr: the address of the memory to prefetch.
#define N 5000!
rw: (optional) a compile-time constant 1 or 0; 1: the
!
program anticipates writing the data soon, 0 (default) in
for (int i = 0 ; i < N ; i ++) {!
the near term, the program expects to only read the data.
for (int j = 0 ; j < N ; j += 2) {! locality: (optional) a compile-time constant from 0 to 3.
0: the data has no temporal locality, so need not be left in
A[i][j] = A[i][j+1];!
the cache after the access, 3: (default) the data has a high
B[j][i] = B[j+1][i];!
degree of temporal locality and should be retained in all
levels of cache if possible. Use 0 or 3 based on the
}!
expected reuse.
}!
!
!
!
!
!
!
!