Caching
1
Caching 1 Key Point What are Cache lines Tags Index offset - - PowerPoint PPT Presentation
Caching 1 Key Point What are Cache lines Tags Index offset How do we find data in the cache? How do we tell if its the right data? What decisions do we need to make in designing a cache? What are possible
1
2
Lower level, mean higher number
corresponds to the “data memory” block in our pipeline diagrams
“instruction memory” block in our pipeline diagrams.
3
4
EX Decode Fetch/ L1 Icache 16KB Mem L1 Dcache 16KB Write back Unified L2 8MB Unified L3 32MB DRAM Many GBs
the addresses that refer to it (in our case 32 bits)
memory.
5
6
7
8
address
modified?
possible location
(low-order bits)
bits)
Address (32 bits) tag Index line offset
dirty tag data
9
explicitly asked for.
space and bandwidth.
space is scarce and latency is important.
10
geometry”
11
12
12
12
12
13
13
13
13
hierarchy.
14
15
16
hierarchy
(why?)
17
hierarchy
(why?)
17
hierarchy
(why?)
17
hierarchy
(why?)
17
cache, or should we also forward the write to the next lower cache?
back”, since the data must be written back when it’s evicted (i.e., the line can be dirty)
In this case, a cache line is never dirty.
18
cache, or should we also forward the write to the next lower cache?
back”, since the data must be written back when it’s evicted (i.e., the line can be dirty)
In this case, a cache line is never dirty.
18
cache, or should we also forward the write to the next lower cache?
back”, since the data must be written back when it’s evicted (i.e., the line can be dirty)
In this case, a cache line is never dirty.
18
Fewer writes farther down the hierarchy. Less bandwidth. Faster writes
we can just forward the write request
is write allocate, otherwise, it is no write allocate.
19
we can just forward the write request
is write allocate, otherwise, it is no write allocate.
19
20
21
int foo[129]; // 4*129 = 516 bytes int bar[129]; // Assume the compiler aligns these at 512 byte boundaries while(1) { for (i = 0;i < 129; i++) { s += foo[i]*bar[i]; } }
0x000 foo ... 0x400 bar
22
23
Tag dirty Data Set 0 Set 1 Set 2 Set 3 Way 0 Way 1
24
25
25
25
25
25
25
26
last used the longest time ago.
write back.
access is farthest in the future. This is provably
27
28