A C OMPONENT - BASED D EFINITION OF S PATIAL L OCALITY Xiaoming GuChengliang Zhang Chen Ding...
-
Upload
justin-dalton -
Category
Documents
-
view
218 -
download
0
Transcript of A C OMPONENT - BASED D EFINITION OF S PATIAL L OCALITY Xiaoming GuChengliang Zhang Chen Ding...
A COMPONENT-BASED DEFINITION OF SPATIAL
LOCALITY
Xiaoming Gu Chengliang Zhang
Chen DingUniversity of
RochesterMicrosoft Corporation
TRADITIONAL DEFINITION OF SPATIAL LOCALITY
When a data element is accessed, the nearby data elements will also be accessed
Overall miss rate The fewer the misses, the better the layout
QUESTIONS
Can the overall spatial locality be decomposed into finer components?
How much can the locality of a given data layout be improved?
Can a data layout be improved if the miss rate cannot be lowered?
A COMPONENT-BASED DEFINITION OF SPATIAL LOCALITY
Based on the reuse distance Based on components
REUSE DISTANCE
The reuse distance of a memory access is the number of distinct data elements accessed between this and the previous access to the same data.
∞ ∞ ∞ 2 0 2 0 1a b c a a b b a
REUSE SIGNATURE
The distribution of all reuse distances In our experiment, we use log sized bins
0 1 2 ∞0
1
2
3
0 1 2-3 ∞2 1 2 3
A COMPONENT-BASED DEFINITION OFSPATIAL LOCALITY
Spatial locality measures the change in reuse distance when the data block size changes from b1 to twice the size b2 = 2*b1.
∞ ∞ ∞ 2 0 2 0 1∞ 0 ∞ 1 0 0 0 0a b c a a b b a
b1
b2
CASES OF CHANGEx yData layout
xTrace ...........................................
Case 1: ...........................................
Case 2: ...........................................
c d
x
x x
x xy
b2
b1
x y
s
Data layout
CHANGES OF REUSE SIGNATURE
2 1 2 3
5 1 0 2
0-0 1-1 2-3 ∞
b2
b1
DATA LAYOUT QUALITY
Effective spatial reuse: the bin they are located has been moved to left by at least C bins, when the block size is doubled
Ineffective spatial reuse: the other reuses In our experiment, we pick C to be 3 The data layout quality of a bin:
2 * effective spatial reuse / total spatial reuse
COMPONENT
Data reuses of nearby bins that have a similar portion of effective spatial reuse
The spatial locality of a component is the weighted average of the spatial locality of each bin
We manually examine the bins and groups them into components
EXPERIMENTAL SETTING
7 SPEC2000 (equake, art, swim, gzip, mcf, crafty, twolf) and 1 SPEC2006 (milc) Data size varies from 1.2MB to 72MB Trace length varies from 7.7 billion to 400 billion
Valgrind [NethercoteSeward’07] to collect traces
Augmented reuse distance analyzer [DingZhong’03] Several hundred times slower
SWIM
WHY OPTIMIZED SWIM BETTER
L1 miss rate L2 miss rate
Original version 10.4% 5.33%
Optimized version 9.7% 5.33%
L1 miss rate reduced by 6.7%
Performance increased by 8.1%
4% reference: 0.16 -> 0.99
Good temporal locality
Good spatial locality
Poor Spatial locality
DIFFERENT INPUTS
Component Spatial locality
Size (%)
ref input
swim-c1 0.25 5.1swim-c2 1 5.2
train input
swim-c1 0.25 5.1swim-c2 0.98 5.2
POSSIBLE USES
User tuning [Levinthal] Superpage management Data-based cache hints [ Fang’05,
BeylsD’Hollander’05]
RELATED WORK
Spatial locality [BuntMurphy’84,Weinberg+’05]
Component-based analysis [DingZhong’03,Shen+’03]
Spatial uses within a loop [WolfLam’91,McKiney+’96]
SUMMARY
A quantitative model of spatial locality We have tested our new model on 8 SPEC
benchmark programs Among 18 components, 2 have good temporal
locality, 6 have good spatial locality, 4 have poor spatial locality/poor temporal locality/large
Possible uses