Hardware Modeling 2 Cache Analyses
Peter Puschner
slides credits: P. Puschner, R. Kirner, B. Huber
VU 2.0 182.101 SS 2015
Hardware Modeling 2 Cache Analyses Peter Puschner slides credits: - - PowerPoint PPT Presentation
Hardware Modeling 2 Cache Analyses Peter Puschner slides credits: P. Puschner, R. Kirner, B. Huber VU 2.0 182.101 SS 2015 Recap: Caches in WCET Analysis Purpose :
slides credits: P. Puschner, R. Kirner, B. Huber
VU 2.0 182.101 SS 2015
2
3
4
5
Line is selected by ld(m) address bits Line 1 Line 2 Line m m lines Line: valid bit (v), tag and data (k bytes) ... v w1 w2 wk tag tag
ld(m) bits
address word
ld(k) bits
6
START tag, line, offset 0, 0, 0 0, 0, 1 0,1,1 0,2,0 0,2,1 0,3,0 0,3,1 0, 1, 0 END 1,0,0
7
START tag, line, offset 0, 0, 0 0, 0, 1 0,2,0 0,3,0 0,3,1 0, 1, 0 END 1,0,0 always miss conflict with (0,0,x) 0,1,1 0,2,0 0,2,1 0,3,0 0, 1, 0 continue with 2nd loop iteration always hit (2..n loop iteration) 0, 1, 1 0, 2, 1 always hit
8
9
10
11
12
13
14
15
Set is selected by ld(m) address bits Block 1,1 Block 2,1 Block 1,2 Block 1,n Block 2,2 Block 2,n ... ... Block m,1 Block m,2 Block m,n ... ... ... ... Replacement Strategy updates blocks in one set 1 2 m sets n ways Block (Line): valid bit (v), tag and data (k bytes) ... v w1 w2 wk tag tag
ld(m) bits
address word
ld(k) bits
16
Cache is updated based
Replacement Policy determines the update strategy used. Way 1 Way 2 Way N Line: valid bit (v), tag and data (k bytes) ... v w1 w2 wk tag tag address word
Associativity: N LRU, FIFO: youngest LRU, FIFO:
17
18
a b c d c a b d access c a b c d e a b c access e HIT MISS
19
20
a <= 1 b <= 3 c <= 4 d,e <= 5+ { a } { } { b } { c } MUST Analysis
a >= 2 b >= 4 c >= 5 d,e >= 1 { d,e } { } { a } { b } MAY Analysis
21
a <= 1 b <= 3 c <= 4 d,e <= 5+ { a } { } { b } { c } MUST Analysis
Concretization a b c d a b c e a b d c a b e c a c b d a c b e a d b c a e b c
22
a <= 1 b <= 3 c <= 4 d,e <= 5+ MUST Join join a <= 2 c <= 4 d <= 4 b,e <= 5+ a <= 2 b <= 5+ c <= 4 d,e <= 5+ { a } { } { b } { c } { } { a } { } { c,d } { } { a } { } { c }
23
24
25
a >= 2 b >= 4 c >= 5 d,e >= 1 { d,e } { a } { } { b } MAY Analysis
Concretization d a e b e a d b d e a b e d a b
a >= 2 b >= 4 c >= 5 d,e >= 1 { } { e } { } { a } MAY Analysis join { d,e } { a } { } { b } a >= 4 b >= 5 c >= 5 d >= 5 e >= 2 a >= 2 b >= 4 c >= 5 d >= 1 e >= 1 { d, e } { a } { } { b }
28
29
30
31
32
33
34
35
36
37
38
39
40
similar ¡to ¡LRU, ¡but ¡predictability ¡is ¡much ¡ worse! ¡ ¡ Analysis ¡Results ¡with ¡PLRU: ¡ MAY ¡analysis ¡does ¡not ¡yield ¡any ¡ informa<on ¡at ¡all! ¡(star<ng ¡with ¡unknown ¡ cache, ¡no ¡block ¡is ¡found ¡to ¡be ¡removed) ¡ MUST ¡analysis ¡provides ¡some ¡informa<on ¡ (but ¡less ¡than ¡for ¡LRU): ¡at ¡most ¡4 ¡blocks ¡are ¡ found ¡in ¡each ¡cache ¡set ¡(out ¡of ¡8 ¡blocks ¡in ¡ prac<ce) ¡ S/ll ¡ongoing ¡research ¡(WCET’2010) ¡
b0 b1 b2 b4 b3 b5 b6 L1 L2 L3 L4 L5 L6 L7 L0
1 1 1 1 1 1 1 1 1 1 1 1 1 1
41
Pseudo-‑Round-‑Robin ¡(PRR): ¡ On ¡a ¡4-‑way ¡set-‑assoc. ¡caches ¡a ¡two-‑bit ¡replacement ¡counter ¡is ¡used. ¡This ¡counter ¡is ¡ shared ¡for ¡all ¡cache ¡lines ¡and ¡is ¡only ¡modified ¡(increased ¡mod ¡4) ¡on ¡replacement. ¡ Thus, ¡each ¡cache ¡line ¡has ¡an ¡influence ¡on ¡the ¡others! ¡ ¡ Analysis ¡Results ¡with ¡PRR: ¡ MAY ¡analysis ¡does ¡not ¡yield ¡any ¡informa<on ¡at ¡all! ¡(without ¡counter ¡or ¡age ¡ informa<on, ¡one ¡can ¡never ¡know ¡which ¡block ¡is ¡removed ¡from ¡cache) ¡ MUST ¡analysis ¡provides ¡only ¡ligle ¡informa<on ¡(much ¡less ¡as ¡for ¡LRU): ¡when ¡a ¡block ¡b ¡ is ¡accessed, ¡it ¡goes ¡into ¡to ¡cache, ¡but ¡without ¡counter ¡or ¡age ¡informa<on, ¡we ¡do ¡not ¡ know, ¡which ¡block ¡is ¡removed ¡à ¡all ¡elements ¡currently ¡in ¡the ¡set ¡must ¡be ¡removed ¡ (only ¡1 ¡out ¡of ¡possibly ¡4 ¡elements ¡can ¡be ¡found ¡to ¡be ¡in ¡the ¡cache) ¡ With ¡PRR, ¡only ¡1 ¡way ¡is ¡effecBvely ¡used ¡ FIFO ¡caches: ¡Cache ¡hit/miss ¡classifica<on ¡difficult ¡(ECRTS’10) ¡
42
43
1 For persistance analysis, refer to [2], not [1]
44
45
46
START tag, set, offset 0, 0, 0 0, 0, 1 0,1,1 1,0,0 1,0,1 1,1,0 1,1,1 2,0,0 0, 1, 0 END