Question: In the previous dotprod example, what fraction of the total references to x and y will be hits once we have padded array x? Example:
In the previous dotprod example, what fraction of the total references to x and y will be hits once we have padded array x?
Example:
For example, instead of defining x to be float x[8], we define it to be float x[12]. Assuming y starts immediately after x in memory, we have the following mapping of array elements to sets:
![Element x [0] x [1] x [2] x [3] x [4] x [5] x [6] x [7] Address 0 4 8 12 16 20 24 28 Set index 0 0 0 0 1 1 1](https://dsd5zvtm8ll6.cloudfront.net/images/question_images/1704/9/8/3/047659ffa07e67541704983047277.jpg)
With the padding at the end of x, x[i] and y[i] now map to different sets, which eliminates the thrashing conflict misses.
Element x [0] x [1] x [2] x [3] x [4] x [5] x [6] x [7] Address 0 4 8 12 16 20 24 28 Set index 0 0 0 0 1 1 1 1 Element y [0] y [1] y [2] y [3] y [4] y [5] y [6] y [7] Address 48 52 56 60 64 68 72 76 Set index 1 1 1 1 0 0 0 0
Step by Step Solution
3.39 Rating (171 Votes )
There are 3 Steps involved in it
To calculate the fraction of total references to x and y that will be hits after padding array x we ... View full answer
Get step-by-step solutions from verified subject matter experts
