Cache Miss Rate Computations - PowerPoint PPT Presentation

About This Presentation
Title:

Cache Miss Rate Computations

Description:

Assumed Simple Cache 2 ints per block 2-way set associative 2 blocks total 1 set i.e., ... Do I re-use blocks over time? In what order am I accessing blocks? – PowerPoint PPT presentation

Number of Views:127
Avg rating:3.0/5.0
Slides: 17
Provided by: C1092
Category:

less

Transcript and Presenter's Notes

Title: Cache Miss Rate Computations


1
Cache Miss Rate Computations
  • Topics
  • Simple examples

2
Assumed Simple Cache
Cache


Block 0
Block 1
  • 2 ints per block
  • 2-way set associative
  • 2 blocks total
  • 1 set
  • i.e., same thing as fully associative
  • Replacement policy Least Recently Used (LRU)

3
Array Access Key Questions
  • How many array elements are there per block?
  • Does the data structure fit in the cache?
  • Do I re-use blocks over time?
  • In what order am I accessing blocks?

4
Simple Array
Cache
for (i0iltNi) Ai


1 2 3 4
A
Miss rate misses / accesses
5
Simple Array
Cache
for (i0iltNi) Ai


1 2 3 4
A
Miss rate misses / accesses
(N//2) / N ½ 50
6
Simple Array w outer loop
Cache
for (k0kltPk) for (i0iltNi)
Ai


1 2 3 4
A
Assume A fits in the cache Miss rate
misses / accesses
7
Simple Array w outer loop
Cache
for (k0kltPk) for (i0iltNi)
Ai


1 2 3 4
A
Assume A fits in the cache First Visit Miss
rate misses / accesses
(N//2) / N ½ 50
8
Simple Array w outer loop
Cache
for (k0kltPk) for (i0iltNi)
Ai


1 2 3 4
A
Assume A fits in the cache Miss rate
misses / accesses ? 0 if P ? infinity
Lesson for sequential accesses with re-use, If
fits in the cache, first visit suffers all the
misses
9
Simple Array
Cache
for (i0iltNi) Ai


1 2 3 4 5 6 7 8
A
Assume A does not fit in the cache Miss rate
misses / accesses
10
Simple Array
Cache
for (i0iltNi) Ai
5 6
7 8
1 2 3 4 5 6 7 8
A
Assume A does not fit in the cache Miss rate
misses / accesses (N/2) / N ½ 50
Lesson for sequential accesses, if no-reuse it
doesnt matter whether data structure fits
11
Simple Array with outer loop
Cache
for (k0kltPk) for (i0iltNi)
Ai


1 2 3 4 5 6 7 8
A
Assume A does not fit in the cache Miss rate
misses / accesses
(N/2) / N ½ 50
Lesson for sequential accesses with re-use, If
the data structure doesnt fit, same miss rate as
no-reuse
12
2D array
Cache
for (i0iltNi) for (j0jltNj)
Aij
A


1 2
3 4
Assume A fits in the cache Miss rate
misses / accesses
(NN/2) / (NN) ½ 50
13
2D array
Cache
A
for (i0iltNi) for (j0jltNj)
Aij
1 2 3 4
5 6 7 8
9 10 11 12
13 14 15 16


Assume A does not fit in the cache Miss rate
misses / accesses
50
Lesson for 2D accesses, if row order and
no-reuse, same hit rate as sequential, whether
fits or not
14
2D array
Cache
for (j0jltNj) for (i0iltNi)
Aij
A


1 2
3 4
Assume A fits in the cache Miss rate
misses / accesses (NN/2) / NN ½ 50
Lesson for 2D accesses, if column order and
no-reuse, same hit rate as sequential if entire
column fits in the cache
15
2D array
Cache
A
for (j0jltNj) for (i0iltNi)
Aij
1 2 3 4
5 6 7 8
9 10 11 12
13 14 15 16


Assume A does not fit in the cache Miss rate
misses / accesses
100
Lesson for 2D accesses, if column order, if
entire column doesnt fit, then 100 miss rate
(block (1,2) is gone after access to element 9).
16
(No Transcript)
Write a Comment
User Comments (0)
About PowerShow.com