Cache ¡Hierarchy ¡
- J. ¡Nelson ¡Amaral ¡
Cache Hierarchy J. Nelson Amaral University of Alberta - - PowerPoint PPT Presentation
Cache Hierarchy J. Nelson Amaral University of Alberta Address Transla;on (flashback) valid bit = 0 implies a page fault (there is no frame in
Baer, ¡p. ¡62 ¡
Baer, ¡p. ¡209 ¡
Baer, ¡p. ¡209 ¡
Baer, ¡p. ¡209 ¡
Only ¡works ¡if ¡index ¡+ ¡displ. ¡≤ ¡k ¡ Page ¡size ¡= ¡2k ¡
Baer, ¡p. ¡210 ¡
Stage ¡1: ¡Send ¡ ¡ Data ¡to ¡Register ¡ Stage ¡2: ¡If ¡Tag ¡in ¡TLB ¡ ¡≠ ¡Tag ¡in ¡TLB: ¡
Saves ¡a ¡pipeline ¡stage ¡when ¡ there ¡is ¡a ¡hit ¡in ¡the ¡TLB ¡and ¡cache. ¡ Baer, ¡p. ¡210 ¡
Baer, ¡p. ¡210 ¡
Baer, ¡p. ¡210 ¡
Baer, ¡p. ¡211 ¡
– ¡flush ¡the ¡cache ¡ – append ¡a ¡PID ¡to ¡tag ¡in ¡cache ¡ » must ¡flush ¡part ¡of ¡cache ¡when ¡recycling ¡PIDs ¡
Baer, ¡p. ¡211 ¡
Baer, ¡p. ¡211 ¡
Baer, ¡p. ¡212 ¡
Lowest ¡bit ¡of ¡page ¡number ¡ is ¡part ¡of ¡the ¡index. ¡ Baer, ¡p. ¡212 ¡
0 ¡ 4 ¡ 8 ¡ 12 ¡ 16 ¡ 20 ¡ 24 ¡ 28 ¡
Page ¡Number ¡ Cache ¡Tag ¡ Cache ¡Index ¡ Cache ¡
Page ¡Offset ¡ Process ¡A ¡ Page ¡ 4 ¡ Physical ¡Pages ¡ Process ¡B ¡ Page ¡ 17 ¡ Page ¡ 14 ¡ Baer, ¡p. ¡212 ¡
Page ¡Number ¡ Page ¡Offset ¡
0 ¡ 0 ¡ 0 ¡ 0 ¡
28 ¡
0 ¡ 0 ¡ 0 ¡ 0 ¡
24 ¡
0 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¡ <New ¡Data> ¡ .. ¡ Page ¡Number ¡ Page ¡Offset ¡
0 ¡ 0 ¡ 0 ¡ 0 ¡
28 ¡
0 ¡ 0 ¡ 0 ¡ 0 ¡
24 ¡
0 ¡ 0 ¡ 0 ¡ 0 ¡
20 ¡
0 ¡ 0 ¡ 0 ¡ 1 ¡
16 ¡
0 ¡ 0 ¡ 0 ¡ 1 ¡
12 ¡
0 ¡ 0 ¡ 0 ¡ 0 ¡
8 ¡
1 ¡ 0 ¡ 0 ¡ 0 ¡
4 ¡
0 ¡ 0 ¡ 0 ¡ 0 ¡
0 ¡ Cache ¡Tag ¡ Cache ¡Index ¡ Cache ¡
Baer, ¡p. ¡212 ¡
Index ¡ V ¡ d ¡ Tag ¡ Data ¡ … ¡ 8 ¡ 1 ¡ 0 ¡ 0000 ¡0000 ¡0000 ¡0010 ¡ VMem[0x0000 ¡4080] ¡ … ¡ 264 ¡ 1 ¡ 1 ¡ 0000 ¡0000 ¡0000 ¡1000 ¡ <New ¡Data> ¡ .. ¡
Baer, ¡p. ¡212 ¡
Baer, ¡p. ¡212 ¡
Baer, ¡p. ¡212 ¡
Baer, ¡p. ¡212 ¡
Baer, ¡p. ¡213 ¡
Baer, ¡p. ¡214 ¡
tag(index) ¡= ¡ tag_ref? ¡ It ¡is ¡a ¡hit. ¡ Serve ¡entry ¡to ¡processor. ¡
It ¡is ¡a ¡miss. ¡Enter: ¡
index ¡ 0 ¡ tag_ref ¡ data ¡ rehash ¡bit ¡ It ¡is ¡a ¡secondary ¡hit. ¡ swap[entry(index),entry(index1)] ¡ rehash_bit(index1) ¡← ¡1 ¡ Serve ¡entry ¡to ¡processor ¡
tag(index1) ¡ = ¡tag_ref? ¡ rehash_bit (index) ¡
index1 ¡← ¡flip_high_bit(index) ¡ ¡
It ¡is ¡a ¡secondary ¡miss. ¡Enter: ¡ swap[entry(index),entry(index1)] ¡ rehash_bit(index1) ¡← ¡1 ¡ index ¡ 1 ¡ tag_ref ¡ data ¡
Baer, ¡p. ¡214 ¡
Baer, ¡p. ¡215 ¡
Baer, ¡p. ¡215 ¡
Baer, ¡p. ¡215 ¡
Baer, ¡p. ¡215 ¡
tag(index) ¡= ¡ tag_ref? ¡ It ¡is ¡a ¡hit. ¡ Serve ¡entry ¡to ¡processor. ¡
swap(vic;m, ¡VC[i]) ¡ Update ¡VC ¡LRU ¡informa;on ¡ Serve ¡entry ¡to ¡processor ¡
Tag(VC[i]) ¡= ¡ VCTag ¡ VCTag ¡= ¡concat[index,tag(index)] ¡
Let ¡VC(j) ¡be ¡the ¡LRU ¡entry ¡in ¡VC ¡
VC(j) ¡dirty? ¡ Writeback(VC[j]) ¡
VC[j] ¡← ¡vic;m ¡ ¡
Baer, ¡p. ¡216 ¡
Baer, ¡p. ¡216 ¡
Baer, ¡p. ¡217 ¡
Baer, ¡p. ¡218 ¡
Baer, ¡p. ¡218 ¡
Baer, ¡p. ¡219 ¡
Baer, ¡p. ¡219 ¡
Baer, ¡p. ¡219 ¡
Baer, ¡p. ¡220 ¡
Baer, ¡p. ¡220 ¡
What ¡is ¡the ¡drawback ¡now? ¡ May ¡cause ¡an ¡excep;on ¡on ¡ the ¡last ¡itera;on. ¡ Each ¡prefetch ¡instruc;on ¡ ¡ brings ¡an ¡en;re ¡cache ¡line. ¡ Same ¡line ¡is ¡fetched ¡several ¡ ;mes. ¡
Baer, ¡p. ¡221 ¡
What ¡is ¡the ¡drawback ¡now? ¡ This ¡branch ¡is ¡not ¡easy ¡ to ¡predict ¡correctly. ¡
Baer, ¡p. ¡221 ¡
Baer, ¡p. ¡221 ¡ Issues: ¡
– when ¡line ¡is ¡prefetched: ¡tag ¡← ¡0 ¡ – when ¡line ¡is ¡referenced: ¡tag ¡← ¡1 ¡
Baer, ¡p. ¡222 ¡
Baer, ¡p. ¡222 ¡
Baer, ¡p. ¡223 ¡
Baer, ¡p. ¡223 ¡
Baer, ¡p. ¡223 ¡
Baer, ¡p. ¡223 ¡
based ¡on ¡instruc;on ¡address ¡ state ¡transi;on ¡field ¡ Baer, ¡p. ¡224 ¡
Decoding ¡an ¡M ¡that ¡ ¡ is ¡not ¡in ¡the ¡table ¡
stride[i] ¡← ¡stride(M,i) ¡
stride[i] ¡= ¡stride(M,i) ¡ Let ¡i ¡← ¡index ¡in ¡RPT ¡of ¡entry ¡that ¡matches ¡the ¡Tag ¡of ¡a ¡memory ¡reference ¡instruc;on ¡M ¡ stride(M,i) ¡← ¡Op.address(M) ¡– ¡Op.address(RPT[i]) ¡
stride[i] ¡≠ ¡stride(M,i) ¡ stride[i] ¡≠ ¡stride(M,i) ¡ stride[i] ¡= ¡stride(M,i) ¡ stride[i] ¡≠ ¡stride(M,i) ¡ stride[i] ¡= ¡stride(M,i) ¡ Baer, ¡p. ¡224 ¡
Baer ¡p. ¡257 ¡ ¡ ¡ ¡ ¡Address ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡Instruc;on ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡⋅⋅⋅ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡⋅⋅⋅ ¡ 0x0000 ¡0100 ¡ ¡ ¡ ¡ ¡ ¡ ¡load ¡B[i,k] ¡ 0x0000 ¡0104 ¡ ¡ ¡ ¡ ¡ ¡ ¡load ¡C[k,j] ¡ 0x0000 ¡0108 ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡⋅⋅⋅ ¡ 0x0000 ¡010c ¡ ¡ ¡ ¡ ¡ ¡ ¡load ¡A[i,j] ¡ What ¡are ¡the ¡RPT ¡contents ¡for ¡ these ¡instruc;ons ¡aier ¡itera;ons ¡ 0, ¡1, ¡and ¡2 ¡of ¡the ¡inner ¡loop? ¡ A[0,0] ¡ A[0,1] ¡ ⋅⋅⋅ ¡ ⋅⋅⋅ ¡ ⋅⋅⋅ ¡ ⋅⋅⋅ ¡ ⋅⋅⋅ ¡ ⋅⋅⋅ ¡ B[0,0] ¡ B[0,1] ¡ ⋅⋅⋅ ¡ ⋅⋅⋅ ¡ ⋅⋅⋅ ¡ ⋅⋅⋅ ¡ ⋅⋅⋅ ¡ ⋅⋅⋅ ¡ C[0,0] ¡ C[0,1] ¡ ⋅⋅⋅ ¡ ⋅⋅⋅ ¡ ⋅⋅⋅ ¡ ⋅⋅⋅ ¡ ⋅⋅⋅ ¡ ⋅⋅⋅ ¡ 0x0001 ¡0000 ¡ 0x0004 ¡0000 ¡ 0x0008 ¡0000 ¡
Accesses ¡for ¡itera;on ¡ i=0; ¡j=0; ¡k=1: ¡ &(A[0,0]) ¡= ¡0x0001 ¡0000 ¡ &(B[0,1]) ¡= ¡0x0004 ¡0004 ¡ &(C[1,0]) ¡= ¡0x0008 ¡0190 ¡
Baer ¡p. ¡257 ¡
Accesses ¡for ¡itera;on ¡ i=0; ¡j=0; ¡k=1: ¡ &(A[0,0]) ¡= ¡0x0001 ¡0000 ¡ &(B[0,1]) ¡= ¡0x0004 ¡0004 ¡ &(C[1,0]) ¡= ¡0x0008 ¡0190 ¡
¡ ¡ ¡ ¡Address ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡Instruc;on ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡⋅⋅⋅ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡⋅⋅⋅ ¡ 0x0000 ¡0100 ¡ ¡ ¡ ¡ ¡ ¡ ¡load ¡B[i,k] ¡ 0x0000 ¡0104 ¡ ¡ ¡ ¡ ¡ ¡ ¡load ¡C[k,j] ¡ 0x0000 ¡0108 ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡⋅⋅⋅ ¡ 0x0000 ¡010c ¡ ¡ ¡ ¡ ¡ ¡ ¡load ¡A[i,j] ¡ What ¡are ¡the ¡RPT ¡contents ¡for ¡ these ¡instruc;ons ¡aier ¡itera;ons ¡ 0, ¡1, ¡and ¡2 ¡of ¡the ¡inner ¡loop? ¡ A[0,0] ¡ A[0,1] ¡ ⋅⋅⋅ ¡ ⋅⋅⋅ ¡ ⋅⋅⋅ ¡ ⋅⋅⋅ ¡ ⋅⋅⋅ ¡ ⋅⋅⋅ ¡ B[0,0] ¡ B[0,1] ¡ ⋅⋅⋅ ¡ ⋅⋅⋅ ¡ ⋅⋅⋅ ¡ ⋅⋅⋅ ¡ ⋅⋅⋅ ¡ ⋅⋅⋅ ¡ C[0,0] ¡ C[0,1] ¡ ⋅⋅⋅ ¡ ⋅⋅⋅ ¡ ⋅⋅⋅ ¡ ⋅⋅⋅ ¡ ⋅⋅⋅ ¡ ⋅⋅⋅ ¡ 0x0001 ¡0000 ¡ 0x0004 ¡0000 ¡ 0x0008 ¡0000 ¡
Tag ¡
Stride ¡ State ¡ 0x0100 ¡ 0 ¡ 0x0104 ¡ 0 ¡ 0x010C ¡ 0 ¡
Baer ¡p. ¡257 ¡
Accesses ¡for ¡itera;on ¡ i=0; ¡j=0; ¡k=1: ¡ &(A[0,0]) ¡= ¡0x0001 ¡0000 ¡ &(B[0,1]) ¡= ¡0x0004 ¡0004 ¡ &(C[1,0]) ¡= ¡0x0008 ¡0190 ¡
¡ ¡ ¡ ¡Address ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡Instruc;on ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡⋅⋅⋅ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡⋅⋅⋅ ¡ 0x0000 ¡0100 ¡ ¡ ¡ ¡ ¡ ¡ ¡load ¡B[i,k] ¡ 0x0000 ¡0104 ¡ ¡ ¡ ¡ ¡ ¡ ¡load ¡C[k,j] ¡ 0x0000 ¡0108 ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡⋅⋅⋅ ¡ 0x0000 ¡010c ¡ ¡ ¡ ¡ ¡ ¡ ¡load ¡A[i,j] ¡ What ¡are ¡the ¡RPT ¡contents ¡for ¡ these ¡instruc;ons ¡aier ¡itera;ons ¡ 0, ¡1, ¡and ¡2 ¡of ¡the ¡inner ¡loop? ¡ A[0,0] ¡ A[0,1] ¡ ⋅⋅⋅ ¡ ⋅⋅⋅ ¡ ⋅⋅⋅ ¡ ⋅⋅⋅ ¡ ⋅⋅⋅ ¡ ⋅⋅⋅ ¡ B[0,0] ¡ B[0,1] ¡ ⋅⋅⋅ ¡ ⋅⋅⋅ ¡ ⋅⋅⋅ ¡ ⋅⋅⋅ ¡ ⋅⋅⋅ ¡ ⋅⋅⋅ ¡ C[0,0] ¡ C[0,1] ¡ ⋅⋅⋅ ¡ ⋅⋅⋅ ¡ ⋅⋅⋅ ¡ ⋅⋅⋅ ¡ ⋅⋅⋅ ¡ ⋅⋅⋅ ¡ 0x0001 ¡0000 ¡ 0x0004 ¡0000 ¡ 0x0008 ¡0000 ¡
Tag ¡
Stride ¡ State ¡ 0x0100 ¡ 0x0004 ¡0000 ¡ 0 ¡ Ini;al ¡ 0x0104 ¡ 0x0008 ¡0000 ¡ 0 ¡ Ini;al ¡ 0x010C ¡ 0x0001 ¡0000 ¡ 0 ¡ Ini;al ¡
Baer ¡p. ¡257 ¡ A[0,0] ¡ A[0,1] ¡ ⋅⋅⋅ ¡ ⋅⋅⋅ ¡ ⋅⋅⋅ ¡ ⋅⋅⋅ ¡ ⋅⋅⋅ ¡ ⋅⋅⋅ ¡ B[0,0] ¡ B[0,1] ¡ ⋅⋅⋅ ¡ ⋅⋅⋅ ¡ ⋅⋅⋅ ¡ ⋅⋅⋅ ¡ ⋅⋅⋅ ¡ ⋅⋅⋅ ¡ C[0,0] ¡ C[0,1] ¡ ⋅⋅⋅ ¡ ⋅⋅⋅ ¡ ⋅⋅⋅ ¡ ⋅⋅⋅ ¡ ⋅⋅⋅ ¡ ⋅⋅⋅ ¡ 0x0001 ¡0000 ¡ 0x0004 ¡0000 ¡ 0x0008 ¡0000 ¡
Accesses ¡for ¡itera;on ¡ i=0; ¡j=0; ¡k=1: ¡ &(A[0,0]) ¡= ¡0x0001 ¡0000 ¡ &(B[0,1]) ¡= ¡0x0004 ¡0004 ¡ &(C[1,0]) ¡= ¡0x0008 ¡0190 ¡
¡ ¡ ¡ ¡Address ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡Instruc;on ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡⋅⋅⋅ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡⋅⋅⋅ ¡ 0x0000 ¡0100 ¡ ¡ ¡ ¡ ¡ ¡ ¡load ¡B[i,k] ¡ 0x0000 ¡0104 ¡ ¡ ¡ ¡ ¡ ¡ ¡load ¡C[k,j] ¡ 0x0000 ¡0108 ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡⋅⋅⋅ ¡ 0x0000 ¡010c ¡ ¡ ¡ ¡ ¡ ¡ ¡load ¡A[i,j] ¡ What ¡are ¡the ¡RPT ¡contents ¡for ¡ these ¡instruc;ons ¡aier ¡itera;ons ¡ 0, ¡1, ¡and ¡2 ¡of ¡the ¡inner ¡loop? ¡
Tag ¡
Stride ¡ State ¡ 0x0100 ¡ 0x0004 ¡0004 ¡ 4 ¡ Transient ¡ 0x0104 ¡ 0x0008 ¡0190 ¡ 400 ¡ Transient ¡ 0x010C ¡ 0x0001 ¡0000 ¡ 0 ¡ Transient ¡
Baer ¡p. ¡257 ¡ A[0,0] ¡ A[0,1] ¡ ⋅⋅⋅ ¡ ⋅⋅⋅ ¡ ⋅⋅⋅ ¡ ⋅⋅⋅ ¡ ⋅⋅⋅ ¡ ⋅⋅⋅ ¡ B[0,0] ¡ B[0,1] ¡ ⋅⋅⋅ ¡ ⋅⋅⋅ ¡ ⋅⋅⋅ ¡ ⋅⋅⋅ ¡ ⋅⋅⋅ ¡ ⋅⋅⋅ ¡ C[0,0] ¡ C[0,1] ¡ ⋅⋅⋅ ¡ ⋅⋅⋅ ¡ ⋅⋅⋅ ¡ ⋅⋅⋅ ¡ ⋅⋅⋅ ¡ ⋅⋅⋅ ¡ 0x0001 ¡0000 ¡ 0x0004 ¡0000 ¡ 0x0008 ¡0000 ¡
Accesses ¡for ¡itera;on ¡ i=0; ¡j=0; ¡k=1: ¡ &(A[0,0]) ¡= ¡0x0001 ¡0000 ¡ &(B[0,1]) ¡= ¡0x0004 ¡0004 ¡ &(C[1,0]) ¡= ¡0x0008 ¡0190 ¡
¡ ¡ ¡ ¡Address ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡Instruc;on ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡⋅⋅⋅ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡⋅⋅⋅ ¡ 0x0000 ¡0100 ¡ ¡ ¡ ¡ ¡ ¡ ¡load ¡B[i,k] ¡ 0x0000 ¡0104 ¡ ¡ ¡ ¡ ¡ ¡ ¡load ¡C[k,j] ¡ 0x0000 ¡0108 ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡⋅⋅⋅ ¡ 0x0000 ¡010c ¡ ¡ ¡ ¡ ¡ ¡ ¡load ¡A[i,j] ¡ What ¡are ¡the ¡RPT ¡contents ¡for ¡ these ¡instruc;ons ¡aier ¡itera;ons ¡ 0, ¡1, ¡and ¡2 ¡of ¡the ¡inner ¡loop? ¡
Tag ¡
Stride ¡ State ¡ 0x0100 ¡ 0x0004 ¡0008 ¡ 4 ¡ Steady ¡ 0x0104 ¡ 0x0008 ¡0320 ¡ 400 ¡ Steady ¡ 0x010C ¡ 0x0001 ¡0000 ¡ 0 ¡ Steady ¡
Baer, ¡p. ¡225 ¡
Baer, ¡p. ¡225 ¡
Baer, ¡p. ¡226 ¡
Baer, ¡p. ¡227 ¡
Stoutchinin ¡et ¡al., ¡CC ¡2001 ¡
Stoutchinin ¡et ¡al., ¡CC ¡2001 ¡
Baer, ¡p. ¡229 ¡
If ¡there ¡is ¡no ¡free ¡ MSHR ¡to ¡give ¡to ¡a ¡ miss, ¡we ¡have ¡an ¡ structural ¡hazard ¡ → ¡stall ¡processor. ¡ On ¡a ¡miss, ¡the ¡line ¡address ¡of ¡all ¡MSHRs ¡are ¡checked ¡to ¡see ¡if ¡a ¡ request ¡for ¡that ¡miss ¡has ¡already ¡been ¡issued. ¡ Baer, ¡p. ¡229 ¡
When ¡an ¡entry ¡arrives ¡from ¡the ¡next ¡level, ¡its ¡address ¡is ¡ compared ¡with ¡all ¡MSHRs. ¡One ¡must ¡match ¡the ¡entry. ¡ Baer, ¡p. ¡229 ¡ Necessary ¡for ¡cache ¡ coherence ¡protocols. ¡
Baer, ¡p. ¡231 ¡
Baer, ¡p. ¡231 ¡
Baer, ¡p. ¡232 ¡
Baer, ¡p. ¡232 ¡
Baer, ¡p. ¡232 ¡
Baer, ¡p. ¡233 ¡
Baer, ¡p. ¡233 ¡
Baer, ¡p. ¡234 ¡
Baer, ¡p. ¡235 ¡
in ¡L2 ¡cache ¡of ¡IBM ¡Power4 ¡
%IPCimpr = 0.71− 0.67 0.71 ×100 = 5.6%
Baer, ¡p. ¡236 ¡
Baer, ¡p. ¡239 ¡
in ¡L3 ¡of ¡IBM ¡Power4 ¡
Baer, ¡p. ¡239 ¡
Baer, ¡p. ¡240 ¡
Baer, ¡p. ¡240 ¡
IBM ¡Power4 ¡ Each ¡of ¡the ¡two ¡processors ¡ can ¡run ¡two ¡threads ¡ simultaneously ¡ Power4 ¡(1.7 ¡GHz) ¡and ¡Power5 ¡(1.9 ¡GHz) ¡are ¡8-‑way ¡out-‑of-‑order ¡superscalars. ¡ Power6 ¡(5GHz ¡– ¡2007) ¡is ¡in-‑order ¡– ¡same ¡energy ¡dissipa;on. ¡ Branch ¡Predictor: ¡
Distributed ¡Windows: ¡ 1 ¡queue/instruc;on ¡type ¡ 11 ¡FIFO ¡queues ¡ Up ¡to ¡80 ¡instr. ¡may ¡queue ¡ 80 ¡physical ¡int. ¡reg. ¡ 72 ¡physical ¡FP ¡reg. ¡ 80-‑instruc;on ¡ROB ¡ load ¡specula;on ¡ Baer, ¡p. ¡241 ¡
IBM ¡Power4/Power5 ¡ L1 ¡I-‑Cache: ¡64KB ¡ Direct/2-‑way ¡ 128-‑byte ¡lines ¡ LRU ¡– ¡4 ¡sectors ¡ L1 ¡D-‑Cache: ¡32KB ¡ 2-‑way/4-‑way ¡ 128-‑byte ¡lines ¡ Write-‑through ¡ LRU ¡ L3 ¡data ¡is ¡in ¡memory ¡in ¡Power4 ¡and ¡in ¡the ¡processor ¡in ¡Power5. ¡ L2: ¡ 1.5 ¡MB/2 ¡MB ¡ 8 ¡way/10way ¡ 128-‑byte ¡lines ¡ Writeback ¡ Pseudo-‑LRU ¡ L3: ¡
1/1 ¡cycle ¡ 1/1 ¡cycle ¡ 12/13 ¡cycles ¡ L3: ¡123/87 ¡cycles ¡ Memory: ¡351/220 ¡cycles ¡ Baer, ¡p. ¡242 ¡
IBM ¡Power4/Power5 ¡ Single-‑ported ¡ 32 ¡bytes/cycle ¡ ≡ ¡1 ¡sector ¡ ≡ ¡8 ¡instruc;ons ¡ ¡ 128-‑byte ¡lines ¡divided ¡into ¡4 ¡32-‑byte ¡sectors ¡ ¡ 4-‑line ¡prefetch ¡buffer ¡ ¡ 4-‑line ¡prefetch ¡buffer: ¡ Fetched ¡lines ¡go ¡into ¡the ¡buffer. ¡Cri;cal ¡sector ¡ ¡sent ¡to ¡pipeline. ¡ In ¡later ¡cycles ¡(on ¡other ¡misses) ¡the ¡line ¡is ¡transferred ¡to ¡the ¡cache. ¡ ¡ Prefetch: ¡ Hit ¡in ¡prefetch ¡buffer ¡⇒ ¡prefetch ¡next ¡line. ¡ Miss ¡in ¡the ¡prefetch ¡buffer ¡⇒ ¡prefetch ¡two ¡subsequent ¡lines. ¡ 3-‑port ¡D1 ¡cache: ¡ two ¡8-‑byte ¡reads ¡
Baer, ¡p. ¡242 ¡
IBM ¡Power4/Power5 ¡ 512 ¡KB ¡of ¡data ¡per ¡slice ¡ Duplicated ¡tag ¡array ¡ for ¡coherence ¡(snooping). ¡ Mul,level ¡Inclusion: ¡ L2 ¡tags ¡contain ¡bits ¡ to ¡indicate ¡in ¡which ¡ L1 ¡cache ¡the ¡entry ¡is. ¡ 8-‑way ¡set ¡associa;ve ¡ 4 ¡banks ¡of ¡SRAM ¡per ¡slice ¡ Each ¡bank ¡may ¡supply ¡32 ¡bytes/cycle ¡to ¡L1 ¡ Replacement: ¡ Tree-‑based ¡pseudo ¡LRU ¡ Tag ¡array ¡is ¡parity-‑protected. ¡Data ¡is ¡ECC ¡protected. ¡ Queues ¡in ¡each ¡slice: ¡
Coherence: ¡
Two ¡noncacheable ¡units ¡ (one ¡per ¡processor). ¡(p.e. ¡ to ¡handle ¡memory-‑mapped ¡I/O). ¡ Baer, ¡p. ¡243 ¡
IBM ¡Power4/Power5 ¡ 4 ¡quadrants; ¡2 ¡banks/quadrant ¡ 4 ¡MB ¡embedded ¡DRAM/bank ¡ Controler: ¡ 4 ¡quadrants; ¡ ¡ 2 ¡coherence ¡processors/quadrant ¡ 1 ¡simple ¡processor/quadrant ¡ ¡ ¡ ¡ ¡ ¡ ¡for ¡writebacks ¡and ¡DMA ¡ Sector ¡cache ¡with ¡4 ¡sectors. ¡ Does ¡not ¡enforce ¡inclusion. ¡ Baer, ¡p. ¡244 ¡
IBM ¡Power4/Power5 ¡
Baer, ¡p. ¡245 ¡
IBM ¡Power4/Power5 ¡
Baer, ¡p. ¡245 ¡