24
Exploiting Spatial Locality in Data Caches using Spatial Footprints Sanjeev Kumar, Princeton University Christopher Wilkerson, MRL, Intel

Exploiting Spatial Locality in Data Caches using Spatial Footprints Sanjeev Kumar, Princeton University Christopher Wilkerson, MRL, Intel

Embed Size (px)

Citation preview

Page 1: Exploiting Spatial Locality in Data Caches using Spatial Footprints Sanjeev Kumar, Princeton University Christopher Wilkerson, MRL, Intel

Exploiting Spatial Locality in Data Caches using Spatial Footprints

Sanjeev Kumar, Princeton University

Christopher Wilkerson, MRL, Intel

Page 2: Exploiting Spatial Locality in Data Caches using Spatial Footprints Sanjeev Kumar, Princeton University Christopher Wilkerson, MRL, Intel

July 1, 1998 Princeton University 2

Spatial Locality in Caches Current approach: Exploit spatial

locality within a cache line Small cache line

– Lower bandwidth

– Less pollution Big cache line

– Exploit more locality

– Fewer tags Current caches use 32 byte lines

Access

Cache Line{

Memory

Page 3: Exploiting Spatial Locality in Data Caches using Spatial Footprints Sanjeev Kumar, Princeton University Christopher Wilkerson, MRL, Intel

July 1, 1998 Princeton University 3

Spatial Locality in Caches contd.

Spatial locality exhibited varies– Across applications– Within an application

Using fixed size line to exploit locality– Inefficient use of cache resources

» Less than half the data fetched is used

» Wastes bandwidth, Pollutes cache

– Limited benefit of spatial locality

Page 4: Exploiting Spatial Locality in Data Caches using Spatial Footprints Sanjeev Kumar, Princeton University Christopher Wilkerson, MRL, Intel

July 1, 1998 Princeton University 4

Outline

Introduction Spatial Footprint Predictors Practical Considerations Future Work Related Work Conclusions

Page 5: Exploiting Spatial Locality in Data Caches using Spatial Footprints Sanjeev Kumar, Princeton University Christopher Wilkerson, MRL, Intel

July 1, 1998 Princeton University 5

Spatial Footprint Predictor (SFP) Exploit more spatial locality Need to reduce pollution Fetch words selectively Requires accurately predicting

spatial footprint of a block– Bit Vector

– 0100 1011 0010 0010

Access

Memory0100101100100010

Page 6: Exploiting Spatial Locality in Data Caches using Spatial Footprints Sanjeev Kumar, Princeton University Christopher Wilkerson, MRL, Intel

July 1, 1998 Princeton University 6

Spatial Footprint Predictor contd. Record spatial footprints Use footprint history to make

predictions– Lookup table based on

» Nominating data address

» Nominating instruction address

» Combination

L1 data caches

NominatingAccess(NA)

Memory0100101100100010

Page 7: Exploiting Spatial Locality in Data Caches using Spatial Footprints Sanjeev Kumar, Princeton University Christopher Wilkerson, MRL, Intel

July 1, 1998 Princeton University 7

Simple Approach Use large cache lines

– Fetch specific words

– leave holes for words that were not fetched

Might decrease bandwidth Increases miss ratio

– missed lines

– under-utilization of cache

MemoryCache

CacheLine

Page 8: Exploiting Spatial Locality in Data Caches using Spatial Footprints Sanjeev Kumar, Princeton University Christopher Wilkerson, MRL, Intel

July 1, 1998 Princeton University 8

Our Approach Regular cache with small

lines– 8 bytes i.e. one word

Exploit spatial locality at sector granularity– 16 lines i.e. 128 bytes

Spatial Footprint Predictor– Fetch 1-16 lines in a sector

on a missMemoryCache

Line

Sector

{

Page 9: Exploiting Spatial Locality in Data Caches using Spatial Footprints Sanjeev Kumar, Princeton University Christopher Wilkerson, MRL, Intel

July 1, 1998 Princeton University 9

When to Record/Predict footprints?

Sectors in memory are active or inactive – Active

» Record footprints» cache miss in an inactive sector

– Inactive» Use history to predict» Cache miss on a line that is marked used (footprint)

in an active sector

Use infinite size tables

Page 10: Exploiting Spatial Locality in Data Caches using Spatial Footprints Sanjeev Kumar, Princeton University Christopher Wilkerson, MRL, Intel

July 1, 1998 Princeton University 10

Recording Footprints

Active SectorTable

Spatial Footprint History Table

NA

SF

SF

6 0100 ...

0100 ...1000 ...1001 ...

Done

MemoryCache0100101100100010

Access

(Records FP) (Stores FP)

Page 11: Exploiting Spatial Locality in Data Caches using Spatial Footprints Sanjeev Kumar, Princeton University Christopher Wilkerson, MRL, Intel

July 1, 1998 Princeton University 11

Predicting Footprints

Spatial Footprint History Table

MemoryCache

FetchLines

Predicted Footprint

SF

0100 ...1000 ...1001 ...

0100101100100010

Access

Page 12: Exploiting Spatial Locality in Data Caches using Spatial Footprints Sanjeev Kumar, Princeton University Christopher Wilkerson, MRL, Intel

July 1, 1998 Princeton University 12

The default footprint predictor

When SFP has no prediction– No history– Evicted from Spatial Footprint Table

Picks a single line size for the application– Based on the footprints observed

Page 13: Exploiting Spatial Locality in Data Caches using Spatial Footprints Sanjeev Kumar, Princeton University Christopher Wilkerson, MRL, Intel

July 1, 1998 Princeton University 13

Experimental Setup Cache Parameters

– 16 KB L1

– 4-way associative

– 8 bytes per line

– 16 lines per sector Cache simulator

– Miss Ratios

– Fetch bandwidth

12 Intel MRL traces– gcc and go (SPEC)– Transaction processing– Web server– PC applications

» word processors» spreadsheets

Normalized results– 16KB conventional

cache with 32 byte line

Page 14: Exploiting Spatial Locality in Data Caches using Spatial Footprints Sanjeev Kumar, Princeton University Christopher Wilkerson, MRL, Intel

July 1, 1998 Princeton University 14

Experimental Evaluation

0

0.5

1

1.5

draw gcc go pc_db pres1 specweb sprdsht tpcc_long wdproc1

Application Trace

Infinite Size Tables

Normalized Miss Ratios

Page 15: Exploiting Spatial Locality in Data Caches using Spatial Footprints Sanjeev Kumar, Princeton University Christopher Wilkerson, MRL, Intel

July 1, 1998 Princeton University 15

GCC Comparison

0

0.5

1

1.5

2

2.5

3

8 16 32 64 128 32KB 16KB

16 KB Cache with Line Size Cache with 32 Byte lines SFP Cache

Miss Ratio Bytes Fetched

Page 16: Exploiting Spatial Locality in Data Caches using Spatial Footprints Sanjeev Kumar, Princeton University Christopher Wilkerson, MRL, Intel

July 1, 1998 Princeton University 16

GCC Comparison Contd.

Comparing SFP cache to– Conventional caches with varying line sizes

» Comparable to best miss ratio (using 64 byte lines)

» Close to lowest bandwidth (using 8 byte lines)

– Bigger conventional cache» Comparable to a 32 KB Cache

Page 17: Exploiting Spatial Locality in Data Caches using Spatial Footprints Sanjeev Kumar, Princeton University Christopher Wilkerson, MRL, Intel

July 1, 1998 Princeton University 17

Outline

Introduction Spatial Footprint Predictors Practical Considerations Future Work Related Work Conclusions

Page 18: Exploiting Spatial Locality in Data Caches using Spatial Footprints Sanjeev Kumar, Princeton University Christopher Wilkerson, MRL, Intel

July 1, 1998 Princeton University 18

Decoupled Sectored Cache

Seznec et. al.– Proposed to improve sectored L2 cache

Decouple tag array from data array– Dynamic mapping: no longer one-to-one– Multiple lines from the same sector share tags– Flexible: Data and tag array can be of different

sizes and associativities

Page 19: Exploiting Spatial Locality in Data Caches using Spatial Footprints Sanjeev Kumar, Princeton University Christopher Wilkerson, MRL, Intel

July 1, 1998 Princeton University 19

Practical Considerations

Reasonable Spatial Footprint History Table– 1024 entries

Reduce Tag Storage– Use Decoupled Sectored Cache– Same number of tags as a conventional cache

with 32 byte lines– Both data and tag array are 4-way associative

Page 20: Exploiting Spatial Locality in Data Caches using Spatial Footprints Sanjeev Kumar, Princeton University Christopher Wilkerson, MRL, Intel

July 1, 1998 Princeton University 20

Experimental Evaluation

0

0.5

1

1.5

draw gcc go pc_db pres1 specweb sprdsht tpcc_long wdproc1

Application Trace

Infinite Size TablesPractical ImplementationNormalized Miss Ratios

Page 21: Exploiting Spatial Locality in Data Caches using Spatial Footprints Sanjeev Kumar, Princeton University Christopher Wilkerson, MRL, Intel

July 1, 1998 Princeton University 21

Cost

Additional Space– 9 KB– Can be reduced by

» Using partial tags

» Compressing footprints

Time– Most predictor actions are off the critical path– Little impact on cache access latency

Page 22: Exploiting Spatial Locality in Data Caches using Spatial Footprints Sanjeev Kumar, Princeton University Christopher Wilkerson, MRL, Intel

July 1, 1998 Princeton University 22

Future Work

Improve miss ratios further– Infinite tables: 30% – Practical Implementation: 18%

Reduce the additional memory required Better coarse grained predictor L2 Caches

Page 23: Exploiting Spatial Locality in Data Caches using Spatial Footprints Sanjeev Kumar, Princeton University Christopher Wilkerson, MRL, Intel

July 1, 1998 Princeton University 23

Related Work

Przybylski et. al., Smith et. al.– Statically best line size, fetch size

Gonzalez et. al.– Dual data cache: temporal and spatial locality– Numeric codes

Johnson et. al.– Dynamically pick line size per block (1 KB)

Page 24: Exploiting Spatial Locality in Data Caches using Spatial Footprints Sanjeev Kumar, Princeton University Christopher Wilkerson, MRL, Intel

July 1, 1998 Princeton University 24

Conclusions

Spatial Footprint Predictors– Decrease miss ratio (18% on average)– Reduce bandwidth usage– Little impact on cache access latency

Can use fine-grain predictor for data caches