Question
Q1 .M is an 8x8 square matrix containing integer elements (4 bytes each). The matrix is stored as a 2d array m in row major.
Q1 .M is an 8x8 square matrix containing integer elements (4 bytes each). The matrix is stored as a 2d array m in row major. The cache is a fully associative cache with block size 64 bytes and number of blocks is 2.
Consider the code given below. Successive elements in columns of m are accessed in each iteration of inner loop. The outer loop is used to select the next column. The FigureQ1 depicts how elements of m are accessed. Columnsum is an array of size 8 where each elements contains sum of one column of m matrix after execution of code.
int m[8][8];
int columnsum[8]={0,0,0,0,0,0,0,0};
int a=8,b=8;
for (j=0 ; j
for (i=0 ; i
columnsum[j]=columnsum[j]+m[i][j];
}
}
- Calculate the total number of misses for the entire execution of code. For simplification ignore the columnsum array and any space occupied by it in cache or any miss caused by it i.e. assume that only array m is read in the code. Show calculations
- It is decided to use matrix blocking while still accessing the array in columns. Tell the block size (in terms of x y elements of matrix) to bring in and utilize completely for computation in code, so that max temporal locality is used in code to calculate sum. This will also require adding more loop to code as well as changing the accumulating statement in code, so that accumulation is done for blocks and later combined, but for simplicity it is not asked to be provided. Just give a figure like FigureQ1 which tells how elements are accessed after blocking. Also describe in few words why you choose the particular block size (i.e Do not write answer only)
c. Calculate the no. of misses after blocking. Show calculations
. az' a8 ai/ap2 . 128 as as ass FigureQ1Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started