Docsity

Computer Architecture Homework 2: Cache Size and Unblocked vs Blocked Cache Access, Assignments of Advanced Computer Architecture

Toggle sidebar
bg1
Computer Architecture Homework #2
Assigned Question #4
(a) Since each element = 8-byte, here has 64-byte / 8-byte = 8 elements
Minimum size of the cache =
(elements in matrix + elements out of matrix) x bytes per element
= (8 x 8 + 8 x 8) x 8-byte = 128 x 8-byte = 1024 bytes = 1 KB
(b) (1) Blocked version: only needs to fetch each I/O element once.
(2) Unblocked version:
one cache miss for every 64-byte / 8-byte = 8 row elements
each column requires 64-byte x 256 = 16 KB of storage, and
column elements will be replaced in the cache before they can
be used again
Thus, in the unblocked version, it will have 1 row and 8 columns =
9 misses for every 2 in the blocked version.
(c) Here we make an extension from simple loop and demonstrate
below:
for (i=0; i<256; i=i+B) {
for (j=0; j<256; j=j+B)
{
for (m=0; m<B; m++)
{
for (n=0; n<B; n++)
{
output[j+n][i+m] = input[i+m][j+n];
}
}
}
}
(d) Since blocks in a direct-mapped cache could be allocated, so that
they map to overlapping regions in the cache.
Thus, 2-way set associative has minimum associativity required.

Partial preview of the text

Download Computer Architecture Homework 2: Cache Size and Unblocked vs Blocked Cache Access and more Assignments Advanced Computer Architecture in PDF only on Docsity!

Computer Architecture Homework # 2

Assigned Question # 4 (a) Since each element = 8 - byte, here has 64 - byte / 8 - byte = 8 elements Minimum size of the cache = ( elements in matrix + elements out of matrix ) x bytes per element

= (8 x 8 + 8 x 8) x 8 - byte = 128 x 8 - byte = 1024 bytes = 1 KB

(b)(1) Blocked version: only needs to fetch each I/O element once.

(2) Unblocked version:  one cache miss for every 64 - byte / 8 - byte = 8 row elements  each column requires 64-byte x 256 = 16 KB of storage, and column elements will be replaced in the cache before they can be used again Thus, in the unblocked version, it will have 1 row and 8 columns =

9 misses for every 2 in the blocked version.

(c) Here we make an extension from simple loop and demonstrate below: for (i=0; i<256; i=i+B) { for (j=0; j<256; j=j+B) { for (m=0; m<B; m++) { for (n=0; n<B; n++) { output[j+n][i+m] = input[i+m][j+n]; } } } } (d) Since blocks in a direct-mapped cache could be allocated, so that they map to overlapping regions in the cache.

Thus, 2 - way set associative has minimum associativity required.