Menu

[Solved]-Q2 Please Unroll Following Loop Three Times Benefit Loop Unrolling 0 Q37252898

Q2: Please unroll the following loop threetimes. What is the benefit of loop unrolling?

for (i=0; i<4; i++) { a[i] = b[i] * i;}

Q3: Use tiling (tile size = 4) to improve theperformance of the following code.
If N=20 and the cache size is 10, how much performance gain do youexpect? Assume that it takes c clock cycles to lookup from cacheand m clock cycles to lookup from memory and m=10*c.

for (i=0; i<N; i++)

                 for (j=0; j<N; j++)

                                   c[i] = c[i] + a[i] *b[j];

Expert Answer


Answer to Q2: Please unroll the following loop three times. What is the benefit of loop unrolling? for (i=0; i… . . .

OR


Leave a Reply

Your email address will not be published. Required fields are marked *