Scope-based Method Cache Analysis Benedikt Huber 1 , Stefan Hepp 1 , - - PowerPoint PPT Presentation

scope based method cache analysis
SMART_READER_LITE
LIVE PREVIEW

Scope-based Method Cache Analysis Benedikt Huber 1 , Stefan Hepp 1 , - - PowerPoint PPT Presentation

Scope-based Method Cache Analysis Benedikt Huber 1 , Stefan Hepp 1 , Martin Schoeberl 2 1 Vienna University of Technology 2 Technical University of Denmark 14th International Workshop on Worst-Case Execution Time Analysis (WCET 2014) July 8, 2014


slide-1
SLIDE 1

Scope-based Method Cache Analysis

Benedikt Huber1, Stefan Hepp1, Martin Schoeberl2

1 Vienna University of Technology

2 Technical University of Denmark

14th International Workshop on Worst-Case Execution Time Analysis (WCET 2014) July 8, 2014

slide-2
SLIDE 2

Outline

 Motivation

 The method cache

 Scope-based Cache Analysis

 Basic principle  Confmict detection

 Evaluation

2

slide-3
SLIDE 3

Motivation: The T-CREST Project

3

.c Compiler WCET Analysis RTOS Memory FPGA Memory controller M$ S$ D$ LM Patmos ALU M$ S$ D$ LM Patmos ALU M$ S$ D$ LM Patmos ALU NOC

T-CREST: The quest for a time-predictable multicore platform

slide-4
SLIDE 4

Motivation: The T-CREST Project

4

.c Compiler WCET Analysis RTOS Memory FPGA Memory controller M$ S$ D$ LM Patmos ALU M$ S$ D$ LM Patmos ALU M$ S$ D$ LM Patmos ALU NOC Method Cache Split Caches Time-composable memory hierarchy

T-CREST: The quest for a time-predictable multicore platform

slide-5
SLIDE 5

Motivation: The Method Cache

 Instruction cache that holds blocks of code of variable size  Functions or parts of functions (compiler defjned)  Cache updates only at call, return and special branches  Fully associative tag memory  More dynamic than I-SPM  Address translation, replacement done in hardware  Less hardware costs than n-way LRU instruction cache  Instructions only stall in memory stage  Smaller tag memory

5

main: 2 main() g() f() T ag memory g: 10 f: 14

  • Cache
slide-6
SLIDE 6

Motivation: Analysis of the M$

 But: Only FIFO replacement (fragmentation)  But: Variable sized cache blocks  Path-sensitive analysis techniques based on abstract interpretation do not work well for the method cache  Instead: Generalized persistence analysis

6

main: 2 main() g() f() T ag memory g: 10 f: 14

  • Cache
slide-7
SLIDE 7

Cache Analysis T echniques

 Always-miss/always-hit classifjcation

 [Grund10]: Shown to work for FIFO  [Reineke08]: bound FIFO caches based on smaller LRU cache performance

 Persistence Analyses ([Cullmann13], [Huynh11])

 Deal with LRU caches (fjrst-miss)  Use functions and loops as scopes

 Scope-based Cache Analysis

 Find at-most-one-miss scopes  Find fjne-grained persistence scopes

7

slide-8
SLIDE 8

Scope-based cache analysis

1) Build scope graph

 Scope graph: Functions, loops, callsites  Access graph (per scope graph node): control fmow, memory accesses, subscopes and backedge nodes

2) For each memory block B:

 Find set of single-entry scopes S(B) (regions) on the access graphs s.t.:

  • every access to B is within a scope
  • B is confmict-free / missed at most once within each scope

3) Maximum number of misses of B ≤ sum of maximum number of executions of all scopes S(B)

 Extend IPET by cache miss frequency variables and bound sum of variables by ∑ f(S(B))

8

slide-9
SLIDE 9

Example: Building the Scope Graph

9

g() { for (;;) { access(X); } } f() { for (;;) { access(Y); } c3: g(); } main() { access(Y); c2: if (?) f(); access(Z); c1: g(); access(Y); }

Scope graph

slide-10
SLIDE 10

Example: Building the Scope Graph

10

g() { for (;;) { access(X); } } f() { for (;;) { access(Y); } c3: g(); } main() { access(Y); c2: if (?) f(); access(Z); c1: g(); access(Y); }

Scope graph Access graph for main()

slide-11
SLIDE 11

Example: Finding confmict-free scopes

11

Scope graph Assuming a 2-way set-associative cache:

OK OK

slide-12
SLIDE 12

Example: Finding confmict-free scopes

12

Scope graph Assuming a 2-way set-associative cache:

OK OK OK OK

slide-13
SLIDE 13

Example: Finding confmict-free scopes

13

Scope graph Assuming a 2-way set-associative cache:

OK OK OK OK OK OK

slide-14
SLIDE 14

Example: Finding confmict-free scopes

14

Scope graph Assuming a 2-way set-associative cache:

OK OK OK OK OK OK

Confmict!

slide-15
SLIDE 15

Example: Finding confmict-free scopes

15

Scope graph Assuming a 2-way set-associative cache:

OK OK OK OK OK OK

Confmict! Access graph for main()

slide-16
SLIDE 16

Example: Finding confmict-free scopes

16

Scope graph Assuming a 2-way set-associative cache:

OK OK OK OK OK OK

Confmict! Access graph for main()

slide-17
SLIDE 17

Example: Finding confmict-free scopes

17

Scope graph Assuming a 2-way set-associative cache:

OK OK OK OK OK OK

Confmict! Access graph for main()

slide-18
SLIDE 18

Example: Finding confmict-free scopes

18

Scope graph Assuming a 2-way set-associative cache:

OK OK OK OK OK OK

Confmict! Access graph for main() Confmict!

slide-19
SLIDE 19

Example: Finding confmict-free scopes

19

Scope graph Assuming a 2-way set-associative cache:

OK OK OK OK OK OK

Confmict! Access graph for main()

slide-20
SLIDE 20

Example: Finding confmict-free scopes

20

Scope graph Assuming a 2-way set-associative cache:

OK OK OK OK OK OK

Confmict! Access graph for main()

slide-21
SLIDE 21

Example: Finding confmict-free scopes

21

Scope graph Assuming a 2-way set-associative cache:

OK OK OK OK OK OK

Confmict! Access graph for main()

slide-22
SLIDE 22

Example: Finding confmict-free scopes

22

Assuming a 2-way set-associative cache:

OK OK OK OK OK OK

Confmict! S1: {Y,X} S2: {Z,X} S3: {Y} Cache misses of X ≤ f(S1) + f(S2) Cache misses of Y ≤ f(S1) + f(S3) Cache misses of Z ≤ f(S2)

slide-23
SLIDE 23

Example: Finding confmict-free scopes

23

Assuming a 2-way set-associative cache:

OK OK OK OK OK OK

Confmict! S1: {Y,X} S2: {Z,X} S3: {Y} Cache misses of X ≤ f(S1) + f(S2) Cache misses of Y ≤ f(S1) + f(S3) => T

  • tal cache misses ≤ 5 f(main)

Cache misses of Z ≤ f(S2)

slide-24
SLIDE 24

Confmict Detection

 For FIFO and LRU n-way set-associative caches:

 confmict-free if at most n distinct cache lines are accessed  path-insensitive, one analysis per cache set

 For method cache:

 confmict-free if size and number of accessed functions does not exceed capacity of cache  path-insensitive, one single analysis

 For LRU n-way set-associative caches:

 confmict-free if at most n-1 distinct cache lines accessed between two accesses of a block B  path sensitive, per block, abstract interpretation

  • similar to [Cullmann13] or [Huynh11], but more fjne-

grained scopes

24

slide-25
SLIDE 25

Implementation

 Implemented in the platin analysis tool

 Persistence analysis based on [Huynh11]  Scope-based analysis for set-associative FIFO/LRU caches  Scope-based analysis for method cache  'Simple' scope-based analysis: only functions and loops as scopes, no construction of fjne-grained scopes

 Evaluated on Mälardalen and PapaBench benchmarks

25

slide-26
SLIDE 26

Evaluation

Results for a 1 kB 8-way LRU set-associative cache

slide-27
SLIDE 27

Evaluation

Results for a 1 kB method cache

slide-28
SLIDE 28

Conclusion

 Scope-based cache analysis framework

 M$ or set-associative caches, FIFO or LRU  Generalization of Persistence Analysis  Improved concept of scopes  Evaluation promises good analysis precision

 Implemented in platin, available at:

28

http://github.com/t-crest/

Thanks! Questions?

http://patmos.compute.dtu.dk/