Homework 5. CS 211 Fall 2008. Due Nov.25, 6pm.

 

Homework 5 is required and will count towards your total homework score, and you must

answer both questions 1, 2. Homework 6 is optional – you can submit it and earn 20 points which can improve your overall homework grade. Even if you are not answering Homework 6, you still have to read through it to answer Question 2 of this homework. Even if you are not planning on answering Homework 6, it is strongly recommended that you think through it so you can better understand how code optimization can help improve the performance of the program.

 

 

Ques.1: Consider using list scheduling to schedule the following code (in a generic assembly) on (a) a scalar processor with exactly one functional unit, and (b) a ILP processor with two integer ALU functional  units, 1 Load/Store unit, and 1 branch unit.

 

Assume addition takes 1 cycle, and load/store,branch and multiplication take 2 cycles for both processors. First construct the DAG for this code, and then illustrate the schedule generated by a list scheduler for each processor. What ranking function are you using?

 

A.  load R1, (R6)

B.  load R0, (R7)

C.  add R2, R1, R0

D.  mult R3, R1, R0

E.  add R4, R2, R0

F.  mult R5, R3, R4

G.  add R6, R2, R1

 

Ques.2: Consider optimizing the code/applications in homework 6 (i.e., the link to Homework 6) using the gcc compiler. What compiler optimizations would you select and why ? Note that you do not have to run the code – you have to examine the code and come up with a qualitative justification for your answer.  Here is one reference/URL you can look up for various gcc optimizations:

http://gcc.gnu.org/onlinedocs/gcc/Optimize-Options.html