33
Minimizing Cache Overhead via Loaded Cache Blocks and Preemption Placement John Cavicchio, Corey Tessler, and Nathan Fisher Department of Computer Science Wayne State University Detroit, MI, USA This research has been supported in part by US National Science Foundation (Grant no.: CNS-0953585).

Minimizing Cache Overhead via Loaded Cache Blocks and Preemption Placement John Cavicchio, Corey Tessler, and Nathan Fisher Department of Computer Science

Embed Size (px)

Citation preview

Page 1: Minimizing Cache Overhead via Loaded Cache Blocks and Preemption Placement John Cavicchio, Corey Tessler, and Nathan Fisher Department of Computer Science

Minimizing Cache Overhead via

Loaded Cache Blocks and Preemption Placement

John Cavicchio, Corey Tessler, and Nathan Fisher

Department of Computer ScienceWayne State University

Detroit, MI, USA

This research has been supported in part by US National Science Foundation (Grant no.: CNS-0953585).

Page 2: Minimizing Cache Overhead via Loaded Cache Blocks and Preemption Placement John Cavicchio, Corey Tessler, and Nathan Fisher Department of Computer Science

1. Refined CRPD Calculation;2. Preemption Placement

Algorithm; 3. Simulation of Actual Code Cache-

Behavior.

Preemption Placement to Minimize CRPD inSequential Flowgraphs.

Sequential (Non-Branching) Control Flowgraphs.

Cache-Related Preemption Delay (CRPD) & Limited Preemption Scheduling.

1

Outline

Background

Model

Problem Statement

Solution

Page 3: Minimizing Cache Overhead via Loaded Cache Blocks and Preemption Placement John Cavicchio, Corey Tessler, and Nathan Fisher Department of Computer Science

Write A Read A

Write B

2

Cache-Related Preemption Delay (CRPD)

Background Model Problem

Statement Solutions Conclusions

CRPD

Cache evictions due to preempting higher-priority jobs.

Cache

TAG AB

Cache eviction

Cache reload

Page 4: Minimizing Cache Overhead via Loaded Cache Blocks and Preemption Placement John Cavicchio, Corey Tessler, and Nathan Fisher Department of Computer Science

Write B

2

Cache-Related Preemption Delay (CRPD)

Background Model Problem

Statement Solutions Conclusions

CRPD

Cache evictions due to preempting higher-priority jobs.

1. Delay preemption to maintain cache locality (Limited/Deferred Preemptions).

Write A Read A

Techniques to Reduce CRPD

Page 5: Minimizing Cache Overhead via Loaded Cache Blocks and Preemption Placement John Cavicchio, Corey Tessler, and Nathan Fisher Department of Computer Science

2

Cache-Related Preemption Delay (CRPD)

Background Model Problem

Statement Solutions Conclusions

CRPD

Cache evictions due to preempting higher-priority jobs.

1. Delay preemption to maintain spatial locality (Limited/Deferred Preemptions).

2. Decrease CRPD analysis pessimism by considering interdependencies between adjacent preemptions.

Techniques to Reduce CRPD

Write A

Write B

Read A

Write B

Independent Preemption (Single-Valued) Analysis: include a reload of A in the CRPD for each preemption of J1 between the write and the read.

Interdependent Preemption Analysis: CRPD of each preemption depends on location of next. Only account for one reload of A for each preemption of J1 between the write and the read.

Page 6: Minimizing Cache Overhead via Loaded Cache Blocks and Preemption Placement John Cavicchio, Corey Tessler, and Nathan Fisher Department of Computer Science

3

Opportunity: InterdependentPreemption Placement

Background Model Problem

Statement Solutions Conclusions

Interdependent CRPD (Best-Case)

Single Valued CRPD

Preemption Location in the Sequential Flowgraph

CR

PD

Cost

Opportunity for CRPD Reduction

Reduce CRPD via preemption placement by exploiting preemption interdependencies while preserving system schedulability.

Our goal

Page 7: Minimizing Cache Overhead via Loaded Cache Blocks and Preemption Placement John Cavicchio, Corey Tessler, and Nathan Fisher Department of Computer Science

4

Related Work: CRPD Calculation

Background Model Problem

Statement Solutions Conclusions

Independent Preemption Calculation

Interdependent Preemption Calculation

Cache-Block Categorization

& Counting Techniques

(UCBs, ECBs,

DC-UCBs,…)

Lee et al. ['96, ’97, ‘98]

Tomiyamay and

Dutt. ['00]

Negi, et al. [‘03]

Tan and Mooney [‘04]

Staschulat and Ernst [‘05]

Altmeyer and

Burguiere [‘11]

Luniss et al. [’13]

….

Cache Partitiong

/Coloring

Mueller [’95]

Lietdtke et al. [‘96]

Mancuso et al. [‘13]

Memory Access

Patterns

Ramaprasad and

Mueller [‘06]  

Probabilistic Davis et al. [‘13]

Our Work

Page 8: Minimizing Cache Overhead via Loaded Cache Blocks and Preemption Placement John Cavicchio, Corey Tessler, and Nathan Fisher Department of Computer Science

5

Related Work: Limited Preemption Model

Background Model Problem

Statement Solutions Conclusions

Fixed preemption

point models

Floating preemption point

models

EDF scheduled systems

Burns ['94]

Baruah ['05]

Bertogna and Baruah ['10]

Fixed Priority scheduled systems

Burns ['94], Bril et al. ['09],

Bertogna et al. ['11], Davis et al. ['12]

Yao et al. ['09]

Single valued CRPD

Bertogna et al.['10, '11]

Peng, Fisher, Bertogna ['13]

Interdependent CRPD

Our work

Page 9: Minimizing Cache Overhead via Loaded Cache Blocks and Preemption Placement John Cavicchio, Corey Tessler, and Nathan Fisher Department of Computer Science

6

Model:Sequential Control Flowgraphs

Background Model Problem

Statement Solutions Conclusions

         

         

 

 

 

 

 

 

An arbitrary control sequence of instructions with a single entry point and a single exit point.

Basic Block (Region)

..

Basic block numeric identifier.

Block ID  

Task numeric identifier.

Task ID

 

Block non-preemptive worst case execution time.

Block WCET 

Page 10: Minimizing Cache Overhead via Loaded Cache Blocks and Preemption Placement John Cavicchio, Corey Tessler, and Nathan Fisher Department of Computer Science

7

Model:Sequential Control Flowgraphs

Background Model Problem

Statement Solutions Conclusions

         

         

 

 

 

 

Potential Preemption Point (PPP)Each edge is a potential

program location to (statically) insert a preemption point.

 

CRPD Cost Matrix

0 1 2 4 4 3 2

- 0 3 5 6 4 3

- - 0 8 7 5 4

- - - 0 8 7 6

- - - - 0 6 7

- - - - - 0 8

- - - - - - 0

Interpretation: Entry i(i, i ) represents the CRPD of preemption inserted after i if a preemption is also inserted after i.

j

j

k

k

Page 11: Minimizing Cache Overhead via Loaded Cache Blocks and Preemption Placement John Cavicchio, Corey Tessler, and Nathan Fisher Department of Computer Science

8

Preemption Point PlacementProblem

Background Model Problem

Statement Solutions Conclusions

Given: A set of tasks {1, 2, …, n}.Each task i is characterized by:

1. Timing parameters (e.g., deadline and period).

2. Maximum non-preemptive region Qi. Note: Determined

from limited-preemption schedulability analysis (e.g., Baruah, RTSS’05)

Page 12: Minimizing Cache Overhead via Loaded Cache Blocks and Preemption Placement John Cavicchio, Corey Tessler, and Nathan Fisher Department of Computer Science

9

Preemption Point PlacementProblem

Background Model Problem

Statement Solutions Conclusions

Given: A set of tasks {1, 2, …, n}.Each task i is characterized by:

1. Timing parameters (e.g., deadline and period).

2. Maximum non-preemptive region Qi.3. Sequential Control Flowgraph &

CRPD Matrix:         

         

 

 

 

 

Goal: Determine the choice of preemption points to minimize the WCET + CRPD of each task such that any non-preemptive region is at most Qi.

i(i, i ) + bi Qi

j j+1 ℓℓ=j+1

k

Page 13: Minimizing Cache Overhead via Loaded Cache Blocks and Preemption Placement John Cavicchio, Corey Tessler, and Nathan Fisher Department of Computer Science

9

Preemption Point PlacementProblem

Background Model Problem

Statement Solutions Conclusions

Given: A set of tasks {1, 2, …, n}.Each task i is characterized by:

1. Timing parameters (e.g., deadline and period).

2. Maximum non-preemptive region Qi.

3. Sequential Control Flowgraph:         

         

 

 

 

 

Goal: Determine the choice of preemption points to minimize the WCET + CRPD of each task such that any non-preemptive region is at most Qi.

Let be selected preemption points.

Minimize i(i, i ) + bi j j+1 ℓ

ℓ=1

# of blocks

i j

Page 14: Minimizing Cache Overhead via Loaded Cache Blocks and Preemption Placement John Cavicchio, Corey Tessler, and Nathan Fisher Department of Computer Science

I. Calculation of CRPD for Interdependent Preemptions.

II. Preemption Placement Algorithm.

III.Estimation of CRPD via Cache Simulation.

10

Outline of Solutions Background Model Problem

Statement Solutions Conclusions

0 1 2 4 4 3 2

- 0 3 5 6 4 3

- - 0 8 7 5 4

- - - 0 8 7 6

- - - - 0 6 7

- - - - - 0 8

- - - - - - 0

Page 15: Minimizing Cache Overhead via Loaded Cache Blocks and Preemption Placement John Cavicchio, Corey Tessler, and Nathan Fisher Department of Computer Science

11

CRPD Computation: UCBs

 

Definition: Useful Cache Block (UCB) [Lee et al., ‘96]

Background Model Problem

Statement Solutions Conclusions

         

         

 

 

 

 Task

1

Write X Read X

X maps to Cache Block 1

{} {1,2} {1,2,4,8} {1,2,8} {1,2,7,8} {1,2,7,8} {1,2}UCBs:

Page 16: Minimizing Cache Overhead via Loaded Cache Blocks and Preemption Placement John Cavicchio, Corey Tessler, and Nathan Fisher Department of Computer Science

12

CRPD Computation: ECBs Background Model Problem

Statement Solutions Conclusions

A memory block m is called an evicting cache block, at basic block i, if it may be accessed during execution of that basic block.

Definition: Evicting Cache Block (ECB) [Lee et al., ‘96]

j

         

         

 

 

 

 Task

1

{} {1,2} {1,2,4,8} {1,2,8} {1,2,7,8} {1,2,7,8} {1,2}UCBs: {} {1,2} {3,4,8} {4,5,6,8} {1,2,7,8} {1,2,7,8} {1,2}ECBs: Write X Read X Read XRead X

X maps to Cache Block 1

ECB(τ1) = ECB(1) ={1, 2, 3, 4, 5, 6, 7, 8}Task-LevelView

j

j

Page 17: Minimizing Cache Overhead via Loaded Cache Blocks and Preemption Placement John Cavicchio, Corey Tessler, and Nathan Fisher Department of Computer Science

13

CRPD Computation: AUCBs Background Model Problem

Statement Solutions Conclusions

Definition: Accessed Useful Cache Block (AUCB):

A memory block m is called an accessed useful cache block, if it may be accessed during execution of that basic block and is useful.

         

         

 

 

 

 Task

1

{} {1,2} {1,2,4,8} {1,2,8} {1,2,7,8} {1,2,7,8} {1,2}UCBs: {} {1,2} {3,4,8} {4,5,6,8} {1,2,7,8} {1,2,7,8} {1,2}ECBs: {} {1,2} {4,8} {8} {1,2,7,8} {1,2,7,8} {1,2}AUCBs:

AUCB(i ) = UCB(i ) ECB(i )

j j j

Page 18: Minimizing Cache Overhead via Loaded Cache Blocks and Preemption Placement John Cavicchio, Corey Tessler, and Nathan Fisher Department of Computer Science

14

CRPD Computation: LCBs

A memory block m of the preempted task is called a loaded cacheblock, if it may be re-loaded during the non-preemptive region defined by two adjacent selected preemption points.

Definition: Loaded Cache Block (LCB):

Background Model Problem

Statement Solutions Conclusions

LCB(i , i ) = [UCB(i ) [ AUCB(i )]] [ ECB(k)]

curr next curr

v=curr+

1

next v

k hp(i)

Useful blocks of task i at time of a preemption.

Blocks accessed by i between two adjacent preemptions. Contention with higher-priority tasks.

         

         

 

 

 

 Task

1

icurr inext

Page 19: Minimizing Cache Overhead via Loaded Cache Blocks and Preemption Placement John Cavicchio, Corey Tessler, and Nathan Fisher Department of Computer Science

14

CRPD Computation: LCBs

A memory block m of the preempted task is called a loaded cacheblock, if it may be re-loaded during the non-preemptive region, defined by two adjacent selected preemption points.

Definition: Loaded Cache Block (LCB):

Background Model Problem

Statement Solutions Conclusions

LCB(i , i ) = [UCB(i ) [ AUCB(i )]] [ ECB(k)]

curr next curr

v=curr+

1

next v

k hp(i)

{} {1,2} {1,2,4,8} {1,2,8} {1,2,7,8} {1,2,7,8} {1,2}UCBs: {} {1,2} {4,8} {8} {1,2,7,8} {1,2,7,8} {1,2}AUCBs:

         

         

 

 

 

 Task

1

icurr inext

Assume [ ECB(k)] = {1, 2, …, 8}:

LCB(1 , 1 ) = {1, 2, 8}

k hp(i)

curr next

Page 20: Minimizing Cache Overhead via Loaded Cache Blocks and Preemption Placement John Cavicchio, Corey Tessler, and Nathan Fisher Department of Computer Science

15

CRPD Computation: Interdependent Cost Structure

0 1 2 4 4 3 2

- 0 3 5 6 4 3

- - 0 8 7 5 4

- - - 0 8 7 6

- - - - 0 6 7

- - - - - 0 8

- - - - - - 0

Background Model Problem

Statement Solutions Conclusions

 

 

         

         

 

 

 

 

   

Interdependent CRPD cost between each pair of PPPs.

CRPD CostConsider a pair of PPPs.

Interdependence

i(i , i ) = |LCB(i , i )| BlockReloadTimecurr next curr next

Page 21: Minimizing Cache Overhead via Loaded Cache Blocks and Preemption Placement John Cavicchio, Corey Tessler, and Nathan Fisher Department of Computer Science

16

CRPD Computation: Single Valued Cost Structure

0 1 2 4 4 3 2

- 0 3 5 6 4 3

- - 0 8 7 5 4

- - - 0 8 7 6

- - - - 0 6 7

- - - - - 0 8

- - - - - - 0

Background Model Problem

Statement Solutions Conclusions

         

         

 

 

 

 

Compared to the interdependent CRPD cost, the single valued approach must use the maximum CRPD cost at each PPP.

Single Valued CRPD Cost

4 6 8 8 7 8 0

Page 22: Minimizing Cache Overhead via Loaded Cache Blocks and Preemption Placement John Cavicchio, Corey Tessler, and Nathan Fisher Department of Computer Science

17

Outline of Solutions Background Model Problem

Statement Solutions Conclusions

I. Calculation of CRPD for Interdependent Preemptions.

II. Preemption Placement Algorithm.

III.Estimation of CRPD via Cache Simulation.

Page 23: Minimizing Cache Overhead via Loaded Cache Blocks and Preemption Placement John Cavicchio, Corey Tessler, and Nathan Fisher Department of Computer Science

18

Preemption Placement Algorithm:Dynamic Programming

Background Model Problem

Statement Solutions Conclusions

         

         

 

 

 

 

Optimal SubstructureAssume optimal set of preemption points selected.

Subset of select preemption points must also be optimal for subproblem.

Page 24: Minimizing Cache Overhead via Loaded Cache Blocks and Preemption Placement John Cavicchio, Corey Tessler, and Nathan Fisher Department of Computer Science

18

Preemption Placement Algorithm:Dynamic Programming

Background Model Problem

Statement Solutions Conclusions

         

         

 

 

 

 

Optimal SubstructureSP1

SP2SP3

Qi

Result: Optimal preemption placement for sequential flowgraphs can be done in quadratic complexity in the number of basic blocks.

Page 25: Minimizing Cache Overhead via Loaded Cache Blocks and Preemption Placement John Cavicchio, Corey Tessler, and Nathan Fisher Department of Computer Science

19

Outline of Solutions Background Model Problem

Statement Solutions Conclusions

I. Calculation of CRPD for Interdependent Preemptions.

II. Preemption Placement Algorithm.

III.Estimation of CRPD via Cache Simulation.

Page 26: Minimizing Cache Overhead via Loaded Cache Blocks and Preemption Placement John Cavicchio, Corey Tessler, and Nathan Fisher Department of Computer Science

Select ten random tasks from the MRTC Benchmarks.

Compute enhanced preemption cost matrix. Each task compiled for GRSIM LEON3 target Absint’s a3 used to get CFG and WCET. Cache snapshots used to obtain LCB

estimates. Plot CRPD cost as function of preemption

location: Illustrate preemption-cost interdependence &

variation. Breakdown Utilization Evaluation.

20

Simulations:Methodology

Background Model Problem

Statement Solutions Conclusions

ADPCM BSORT100 CNT COVER CRC

FFT1 FIBCALL LMS NDES RECURSION

Page 27: Minimizing Cache Overhead via Loaded Cache Blocks and Preemption Placement John Cavicchio, Corey Tessler, and Nathan Fisher Department of Computer Science

21

Simulations: Recursion Task CRPD

Background Model Problem

Statement Solutions Conclusions

Emphasizes the interdependence of preemption points

Preemption cost trend

Page 28: Minimizing Cache Overhead via Loaded Cache Blocks and Preemption Placement John Cavicchio, Corey Tessler, and Nathan Fisher Department of Computer Science

22

Simulations: LMS Task CRPD

Background Model Problem

Statement Solutions Conclusions

Large cost variations

Preemption cost trend

Page 29: Minimizing Cache Overhead via Loaded Cache Blocks and Preemption Placement John Cavicchio, Corey Tessler, and Nathan Fisher Department of Computer Science

23

Simulations: ADPCM Task CRPD

Background Model Problem

Statement Solutions Conclusions

Large cost variations

Preemption cost trend

Page 30: Minimizing Cache Overhead via Loaded Cache Blocks and Preemption Placement John Cavicchio, Corey Tessler, and Nathan Fisher Department of Computer Science

24

Simulations: Breakdown Utilization

Background Model Problem

Statement Solutions Conclusions

Preemption Placement & Interdependent PreemptionsPreemption Placement & Independent Preemptions (Bertogna et al.)

UCB-Only(Lee et al., Lunnis et al..)

Page 31: Minimizing Cache Overhead via Loaded Cache Blocks and Preemption Placement John Cavicchio, Corey Tessler, and Nathan Fisher Department of Computer Science

Conlusions: Enhance CRPD calculation to account for

preemption interdependence. Proposed quadratic dynamic programming

algorithm for selection of optimal preemption points.

Simulations over code show potential for significant CRPD reduction.

Future work: Extend the sequential flow graph structure to an

arbitrary flow graph structure. (E.g., conditional blocks, loops, function calls, and gotos.)

Develop automated & integrated compiler/schedulability tools.

Extend the technique to utilize other CRPD set-theoretic concepts. (E.g., UCB-U Multiset, ECB-U Multiset, DC-UCB).

25

Conclusions and Future Work

Background Model Problem

Statement Solutions Future Work

Page 32: Minimizing Cache Overhead via Loaded Cache Blocks and Preemption Placement John Cavicchio, Corey Tessler, and Nathan Fisher Department of Computer Science

26

[email protected]

Thank You!

Page 33: Minimizing Cache Overhead via Loaded Cache Blocks and Preemption Placement John Cavicchio, Corey Tessler, and Nathan Fisher Department of Computer Science

Deadline: July 24th

Lille, November 4-6

23rd International Conference on Real-Time Networks & Systems