Question: As another example of code with potential load-store interactions, consider the following function to copy the contents of one array to another: Suppose a is

As another example of code with potential load-store interactions, consider the following function to copy the contents of one array to another:

1 2 3 4 5 6 void copy_array (long *src, long *dest, long n) { } long i; for (i = 0; i

Critical path s_data load add s_data load add s_data load add sub sub sub Example A Critical path s_data load

Suppose a is an array of length 1,000 initialized so that each element a[i] equals i.

A. What would be the effect of the call copy_array(a+1,a,999)? 

B. What would be the effect of the call copy_array(a,a+1,999)? 

C. Our performance measurements indicate that the call of part A has a CPE of 1.2 (which drops to 1.0 when the loop is unrolled by a factor of 4), while the call of part B has a CPE of 5.0. To what factor do you attribute this performance difference? 

D. What performance would you expect for the call copy_array(a,a,999)?

1 2 3 4 5 6 void copy_array (long *src, long *dest, long n) { } long i; for (i = 0; i

Step by Step Solution

3.39 Rating (161 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

This problem requires you to analyze the potential loadstore interactions in a program A It will ... View full answer

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Computer Systems A Programmers Perspective Questions!