Cache Performance
1
Cache Performance 1 C and cache misses (1) int array[1024]; // 4KB - - PowerPoint PPT Presentation
Cache Performance 1 C and cache misses (1) int array[1024]; // 4KB array int even_sum = 0, odd_sum = 0; for ( int i = 0; i < 1024; i += 2) { even_sum += array[i + 0]; odd_sum += array[i + 1]; } Assume everything but array is kept in
1
2
3
4
4
4
4
5
5
5
5
6
7
8
9
n
10
n
11
n
11
100 200 300 400 500 N 0.0 0.2 0.4 0.6 0.8 1.0 1.2
billions of instructions k inner k outer
100 200 300 400 500 N 0.0 0.2 0.4 0.6 0.8 1.0
billions of cycles k inner k outer 12
100 200 300 400 500 N 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9
13
100 200 300 400 500 N 1.0 1.5 2.0 2.5 3.0 3.5
14
15
15
n
16
n
16
n
16
100 200 300 400 500 N 20 40 60 80 100 120 140
17
50 100 150 200 N 20 40 60 80 100 120 140 matrix smaller than L1 cache
18
50 100 150 200 N 20 40 60 80 100 120 140 matrix smaller than L1 cache N = 93; 93 * 11 210 N = 114; 114 * 9 210 N = 27
19
20
20
21
22
23
24
25
25
26
26
26
27
27
27
27
28
29
30
30
31
31
31
31
32
33
33
33
33
33
34
35
35
36
36
36
36
37
38