





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 2001
CS6290/CS4290 Issued: September 30, 2001 Homework 4 Due: October 19, 2001
Purpose: This homework covers hardware scheduling for instruction-level parallel architectures.
Reading: H&P Chapter 4, particularly Sections 4.2, 4.3 and 4.4. [Smith88]
Problems: 1. Extracting ILP in Hardware.
Appendix: 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 the problem. The program computes the dot product 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 Fig- ure 4.2 in the text with the exception that branches have no delay slots or other stalls associated with them. Instead, branches are predicted taken.
Operations Stall Cycles Pipeline Stages (for plain DLX) (for Tomasulo)
FOP -> FOP 3 4 LD -> FOP 1 2 IOP -> IOP 0 1 branch 0 --- (branches are predicted)
Note, as in Homework 4, it is possible to eliminate the stalls through clever scheduling. Here’s one solution. Note the slight difference between this and the solutions to Home- work 4 because here there is 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 is a 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 per iteration are required by the rescheduled loop above? ii. How many FOPPCs are achived by the the rescheduled loop? Note that the rate of execution is limited by the time to issue instructions only – we’ve eliminated all stalls.
Next, consider a pipelined machine controlled by Tomasulo’s algorithm. See the attached worksheet for the bookkeeping data structures implied.
Assume:
instr. issue exec write
LD 1 2-3 4 LD 2 3-4 5 MULTD 3 6-9 10 ADDD 4 ... ... ADDI 5 ; exec/write unused ...
C: Simulate the execution of the original code in a pipeline con- trolled by Tomasulo’s algorithm. i. Use the attached worksheet to show the detailed state of execution at the time the BNEQ instruction issues for the second time. ii. How many cycles are required to execute one iteration of the loop in a long vector? To figure out this question, you need to simulate through the second iteration of the loop (or better yet the third to really convince yourself). Show the instruction-state table you use to answer this part. iii. How many FOPPCs are achived by the hardware? iv. What limits the rate of execution of the loop?
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 many slow down the clock rate of the processor. The last two questions will look at the consequences of sticking with an in-order design.
The last machine to consider is a 4-way superscalar that supports only in-order instruction execution (something like the UltraSPARC-III described in [Song97]). The machine can execute up to four sequential instructions in a cycle as long as there are no dependencies between them. For instance, the original loop on such a machine would start out executing as follows (this is the execution trace):
loop: LD F2, 0(R2) | LD F4, 0(R4)
The machine attempts to start four instruction on the first cycle but can only start two before running into a dependence. Since instructions must execute in order, no other instructions may execute until the dependence is resolved. Assume:
Finally, rewrite the dot-product loop to target the static 4-way superscalar hardware. Fell free to use unrolling, software pipelining 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, if you like.*
F: For your rewritten loop: i. Show your new code. You need only show the body of the loop in detail. ii. How many cycles are requied to execute one iteration of your new loop? I.e. one loop out of many, once you get started. iii. How many FOPPCs does your code achieve? Assume a very long vector. iv. OPTIONAL: loop scheduling generally introduces pro- logue and epilogue code, sometimes gobs of it. This extra code reduces the performance of the machine for short vec- tors. Considering the extra code (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 supercomputers often exhibit N 12 of 100 or more.