Homework Assignment 4

 

 

Question 1: For the following code segment, apply the loop optimization techniques to improve the code quality: 1) code motion, 2) loop unrolling, 3) loop fusion

 

for(i=0; i<N*2; i++)
            a[i] = b[i] * c[i];
for(j=0; j<N*2; j++)
            m[j] = m[j] + 5;

 

Question 2: For the following instruction sequence, draw the register lifetime graph and calculate the number of registers needed to execute these instructions. Afterwards, reschedule the instruction sequence to see how many registers can be saved. Also draw the register lifetime graph after rescheduling.

 

  1. w = a + b;
  2. x = a - c;
  3. y = c * w;
  4. p = b - x;
  5. z = a + y;

 

 

Question 3: Considering the power state machine of SA-1100 that we described in class. 1) Calculate the break-even time between the running and sleep states, given that the power consumption during transition is 500mW. 2) Given an idle period of 2 seconds, calculate the amount of energy being saved by switching the system from the running state to the sleep state. Still use the same power consumption during transitions.

 

 

 

Question 4: Given that the break-even time is 1 second, and the idle period is exponentially distributed with a mean value of 2.5 seconds. If we use a fixed timeout of 1 second to decide transitions to power-saving states, compute the safety and efficiency metrics (as conditional probabilities) of power management.