Cache Memory Analysis and Performance Optimization: A Case Study in CS698L, Assignments of Compilers

Compilers Design Solutions abcds

Typology: Assignments

2019/2020

Uploaded on 10/13/2020

Muzafarwani28
Muzafarwani28 🇮🇳

4 documents

1 / 4

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
CS698L Assignment-1
Hritvik Taneja(160300)
September 9, 2019
Problem 1
t+s+b= 32
b= 6 because block size is 64B
Here B(block size) is 64B and C(cache size) is 256KB and we use A as an acronym for associativity.
Total number of lines are C
B, and s= log2(C
B×A).
(i) direct-mapped
Here A is 1
(a) 212
(b) b= 6
(c) s= 12
(d) t= 14
(ii) 4-way set-associative
Here A is 4
(a) 212
(b) b= 6
(c) s= 10
(d) t= 16
(iii) fully-associative
Here A is C
B
(a) 212
(b) b= 6
(c) s= 0
(d) t= 26
1
pf3
pf4

Partial preview of the text

Download Cache Memory Analysis and Performance Optimization: A Case Study in CS698L and more Assignments Compilers in PDF only on Docsity!

CS698L Assignment-

Hritvik Taneja(160300)

September 9, 2019

Problem 1

t + s + b = 32 b = 6 because block size is 64B

Here B(block size) is 64B and C(cache size) is 256KB and we use A as an acronym for associativity. Total number of lines are CB , and s = log 2 ( (^) BC×A ).

(i) direct-mapped

Here A is 1

(a) 212

(b) b = 6

(c) s = 12

(d) t = 14

(ii) 4-way set-associative

Here A is 4

(a) 212

(b) b = 6

(c) s = 10

(d) t = 16

(iii) fully-associative

Here A is

C

B

(a) 212

(b) b = 6

(c) s = 0

(d) t = 26

Total Size of Cache = 256KB Total Size of A = 128KB

Stride = 1

For it = 0 the number of misses will be 32 ×^2 10 8 = 2

(^12) and for the rest of the iterations all the data will

be in the cache. Total Number of Misses = 2^12

Stride = 4

For it = 0 the number of misses will be 32 ×^2 10 4 × 2 = 2

(^12) and for the rest of the iterations all the data will

be in the cache. Total Number of Misses = 2^12

Stride = 16

For it = 0 the number of misses will be 32 ×^2 10 16 × 1 = 2

(^11) and for the rest of the iterations all the data will

be in the cache. Total Number of Misses = 2^11

Stride = 32

For it = 0 the number of misses will be 32 ×^2 10 32 × 1 = 2 (^10) and for the rest of the iterations all the data will

be in the cache. Total Number of Misses = 2^10

Stride = 2K

For it = 0 the number of misses will be 32 ×^2

10 211 × 1 = 2

(^4) and for the rest of the iterations all the data will

be in the cache. Total Number of Misses = 2^4

Stride = 8K

For it = 0 the number of misses will be 32 ×^2 10 213 × 1 = 2 (^2) and for the rest of the iterations all the data will

be in the cache. Total Number of Misses = 2^2

Stride = 32K

For it = 0 the number of misses will be 32 ×^2 10 215 × 1 = 2

(^0) and for the rest of the iterations all the data will

be in the cache. Total Number of Misses = 2^0

Total Size of Cache = 16M B Block Size = 32B ⇒ B = 32 Total Size of Arrays = 4096 × 4096 W ords ⇒ N = 4096 × 8

A X

k N N j N NB i N 1

  • M iss[j][A] = N and M iss[k][A] = N because after every 512 iterations a new row will overwrite the previous row present in the cache(example: A[0] will be overwritten by A[512]).