Consider the following piece of C code: for (j=2;j <1000;j++) D[j] = D[j1]+D[j2]; Th e MIPS code

Question:

Consider the following piece of C code:

for (j=2;j<1000;j++)

D[j] = D[jˆ’1]+D[jˆ’2];

Th e MIPS code corresponding to the above fragment is:

addiu $s2,$zero,7992 $s1,$zero,16 $f0, -16($ s1) $f2, -8($s1) $f4, $f0, $f2 $f4, 0($s1) $s1, $s1, 8 $s1, $s2, 1oop addiu

Instructions have the following associated latencies (in cycles):

add.d I.d s.d addiu 4

1. How many cycles does it take for all instructions in a single iteration of the above loop to execute?

2. When an instruction in a later iteration of a loop depends upon a data value produced in an earlier iteration of the same loop, we say that there is a loop carried dependence between iterations of the loop. Identify the loop-carried dependences in the above code. Identify the dependent program variable and assembly-level registers. You can ignore the loop induction variable j.

3. Loop unrolling was described in Chapter 4. Apply loop unrolling to this loop and then consider running this code on a 2-node distributed memory message passing system. Assume that we are going to use message passing as described in Section 6.7, where we introduce a new operation send (x, y) that sends to node x the value y, and an operation receive( ) that waits for the value being sent to it. Assume that send operations take a cycle to issue (i.e., later instructions on the same node can proceed on the next cycle), but take 10 cycles be received on the receiving node. Receive instructions stall execution on the node where they are executed until they receive a message. Produce a schedule for the two nodes assuming an unroll factor of 4 for the loop body (i.e., the loop body will appear 4 times). Compute the number of cycles it will take for the loop to run on the message passing system.

4. The latency of the interconnect network plays a large role in the efficiency of message passing systems. How fast does the interconnect need to be in order to obtain any speedup from using the distributed system described in Exercise 6.4.3?

Fantastic news! We've Found the answer you've been seeking!

Step by Step Answer:

Related Book For  book-img-for-question
Question Posted: