




Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!





College of Computing
CS6290/CS4290 | High-Performance Computer Architecture Fall 1999
CS6290/CS4290 Issued: Octob er 11, 1999 Homework 3 Due: Octob er 22, 1999
Purp ose: This homework covers instruction-level parallel machines.
Reading: H&P Chapter 4, particularly sections 4.2, 4.3 and 4. [Smith88], [Gwennap95] (problem 2)
Problems: 1. Extracting ILP in Hardware.
App endix: State table for Tomasulo's algorithm (also on-line).
Problem 1: Extracting ILP in Hardware
Use the following program fragment in DLX assembly language for the questions in this problem. These sequence is identical to one used in the last problem on Homework 2 (Problem 4.5 in the b o ok).
The program computes the dot pro duct of two vectors.
; R1 and R2 point to the vectors, F2 is initialized to zero. ;------------------------- loop: LD F0, 0(R1) LD F4, 0(R2) MULTD F0, F0, F ADDD F2, F0, F SUBI R1, R1, # SUBI R2, R2, # BNEZ R1, loop ;------------------------- ; result in F
For this problem, assume the following delay characteristics. This table is similar to Figure 4.2 in the text with the exception that branches have no delay slots or other stalls asso ciated with them.
Operations Stall Cycles
FOP -> FOP 3 LD -> FOP 3 IOP -> IOP 0 branch 0 (predicted; no delay slot)
Note, as in Homework 2, it is p ossible to eliminate the stalls through clever scheduling. Here's one solution. Note the slight di erence b etween this and the solutions to Home- work 2 b ecause there's no delay slot after the branch.
; R1 and R2 point to the vectors, F2 is initialized to zero. MOVED F0, 0.0 ; prologue: first ADDD dummy ;------------------------- loop: LD F4, 0(R2) ADDD F2, F0, F2 ; ADDD for previous iteration LD F0, 0(R1) SUBI R1, R1, 8 ; was a stall MULTD F0, F0, F SUBI R2, R2, 8 ; was a stall BNEZ R1, loop ; was a stall ;-------------------------
i. How many cycles p er iteration are required by the resched- uled lo op? ii. How many FOPPCs do es the rescheduled lo op achieve? Note that the rate of execution is limited by the time to issue in- structions only { we've eliminated all stalls.
Next, consider a pip elined machine controlled by Tomasulo's algorithm. See the attached worksheet for the b o okkeeping data structures implied.
Assume:
Only oating p oint instructions are controlled by Tomasulo's algorithm, i.e. only oat- ing p oint numb ers are passed over the Common Data Bus (CDB). Integer instructions consume issue slots but do not app ear in the rest of the instruction-state table. One whole cycle is required to send a result over the CDB. In other words, Tomasulo's algorithm intro duces an extra cycle of latency over a static pip eline. For instance, note in the example instruction-state table b elow that the MULTD b egins executing in cycle 7, an extra cycle after the LD on which it is waiting. Assume that structural stalls due to the single CDB are resolved after the execution unit. If you nd you have to make other assumptions, list 'em.
instr. issue exec write
LD 1 2-4 5 LD 2 3-5 6 MULTD 3 7-10 11 ADDD 4 ... ... ADDI 5 ; exec/write unused ...
C: Simulate the execution of the original co de in a pip eline con- trolled by Tomasulo's algorithm. i. Use the attached worksheet to show the detailed state of execution at the time the BNEQ instruction rst issues. ii. How many cycles are required to execute one iteration of the lo op in a long vector? To gure this question out, you need to simulate through the second iteration of the lo op (or mayb e the third, to really convince yourself ). Show the instruction-state table you use to answer this part. iii. How many FOPPCs are achieved by the hardware? iv. What limits the rate of execution of the lo op?
Dynamic scheduling hardware is commonplace but some designs are still using static, in- order, scheduling. The reasoning is that the dynamic scheduling hardware is so complex that it may slow down the clo ck rate of the pro cessor. The last two questions will lo ok at the consequences of sticking with an in-order design.
The last machine to consider is a 4-way sup erscalar that supp orts only in-order instruction execution (something like the UltraSPARC-I I I describ ed in [Song97]). This machine can execute up to four instructions in a cycle as long as there are no dependencies between them. For instance, the original lo op on such a machine would start out executing as follows (this is the execution trace):
loop: LD F2, 0(R2) | LD F4, 0(R4)
Assume:
All four units are identical. Only one branch instruction is allowed p er four. Pip eline delays and resulting stalls are the same as for the vanilla DLX. I.e. the original co de would su er stalls as indicated in the trace ab ove. Note that on a stall, no new instructions issue (zero out of a p ossible four!). Thus it is hugely imp ortant to eliminate stalls.
E: For the static 4-way sup erscalar hardware: i. Show the execution trace for executing the original lo op. ii. How many cycles are required to execute one iteration of the lo op? I.e. one lo op out of many, once you get started. iii. How many FOPPCs do es your co de achieve? Assume a very long vector.
Finally, rewrite the dot-pro duct lo op to target the static 4-way sup erscalar hardware. Feel free to use unrolling, software pip elining and anything else you can think of. You may transform the linear sequence of additions into a \tree" as suggested on one of the slides in Lecture 13, if you like.
F: For your rewritten lo op: i. Show your new co de. ii. How many cycles are required to execute one iteration of your new lo op? I.e. one lo op out of many, once you get started. iii. How many FOPPCs do es your co de achieve? Assume a very long vector. iv. OPTIONAL: lo op scheduling generally intro duces prologue and epilogue co de. This extra co de reduces the p erformance of the machine for short vectors. Considering the extra co de (and stalls therein), what length of vector is required to achieve half the FOPPCs you found in part iii? This vector length is called \N 12 " and is widely used to characterize the \agility" of vector machines. Current sup ercomputers often exhibit N 12 of 100 or more.
Problem 2: Branch Prediction
Problem 4.10 in the b o ok.