instruction level parallelism and dynamic execution

40
Instruction Level Parallelism and Dynamic Execution

Upload: oceana

Post on 19-Jan-2016

51 views

Category:

Documents


0 download

DESCRIPTION

Instruction Level Parallelism and Dynamic Execution. Recall from Pipelining Review. Pipeline CPI = Ideal pipeline CPI + Structural Stalls + Data Hazard Stalls + Control Stalls Ideal pipeline CPI : measure of the maximum performance attainable by the implementation - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: Instruction Level Parallelism and Dynamic Execution

Instruction Level Parallelism and Dynamic Execution

Page 2: Instruction Level Parallelism and Dynamic Execution

Recall from Pipelining Review

• Pipeline CPI = Ideal pipeline CPI + Structural Stalls + Data Hazard Stalls + Control Stalls– Ideal pipeline CPI: measure of the maximum performance

attainable by the implementation– Structural hazards: HW cannot support this combination of

instructions– Data hazards: Instruction depends on result of prior

instruction still in the pipeline– Control hazards: Caused by delay between the fetching of

instructions and decisions about changes in control flow (branches and jumps)

Page 3: Instruction Level Parallelism and Dynamic Execution

Data Hazards Review

• RAW (read after write) hazard:– instruction I occurs before instruction J in the program but…– …instruction J tries to read an operand before instruction I writes to

it, so J incorrectly gets the old value– Example: … I: LW R1, 0(R2) … J: ADD R3, R1, R4 …

• A RAW hazard is a true data dependence, where there is a programmer-mandated flow of data from one instruction (the producer) to another (the consumer)– therefore, the consumer must wait for the producer to finish

computing and writing

Page 4: Instruction Level Parallelism and Dynamic Execution

Data Hazards Review

• WAW (write after write) hazard:– instruction I occurs before instruction J in the program but…– …instruction J tries to write an operand before instruction I writes to it, so the

wrong order of writes causes the destination register to end up with the value from I rather than that from J

– Example: … I: SUB R1, R2, R3 … J: ADD R1, R3, R4 …

• A WAW hazard is a not a true data dependence, but rather a kind of name dependence, called output dependence , because of the (avoidable?) same name of the destination registers

• WAW hazards cannot occur in the classic 5-stage MIPS integer pipeline. Why…?– registers are written only in one stage, the WB stage, and– instructions enter the pipeline in order

• However, we shall deal with situations where instructions may be executed out of order…

Page 5: Instruction Level Parallelism and Dynamic Execution

Data Hazards Review

• WAR (write after read) hazard:– instruction I occurs before instruction J in the program but…– …instruction J tries to write an operand before instruction I reads it, so I

incorrectly gets the later value– Example: … I: SUB R2, R1, R3 … J: ADD R1, R3, R4 …

• A WAR hazard is a not a true data dependence, but rather a kind of name dependence, called antidependence, because of the (avoidable?) shared name of two registers

• WAR hazards cannot occur in the classic 5-stage MIPS integer pipeline. Why…?– registers are read early and written late – instructions enter the pipeline in order

• However, we shall deal with situations where instructions may be executed out of order…

Page 6: Instruction Level Parallelism and Dynamic Execution

Why Dynamic Scheduling…?

Static pipeline scheduling

DataHazard

Bypass possible

Stall instruction

Bypass orForwarding

Yes Yes

NoNo

Pipeline processing

Dynamic schedulingreduces this stall viaILP: Instruction Level Parallelism

Stall instruction

Goal of ILP: To get as many instructions as possible executing in parallel while respecting dependencies

Page 7: Instruction Level Parallelism and Dynamic Execution

Recall Data Hazard Resolution: In-order issue, in-order completion

Time (clock cycles)

or r8,r2,r9

Instr.

Order

lw r1, 0(r2)

sub r4,r1,r6

and r6,r2,r7

Reg

ALU

DMemIfetch Reg

RegIfetch

ALU

DMem RegBubble

Ifetch

ALU

DMem RegBubble Reg

Ifetch

ALU

DMemBubble Reg

Extend to Multiple instruction issue?What if load had longer delay? Can and issue?

Page 8: Instruction Level Parallelism and Dynamic Execution

In-Order Issue, Out-of-order Completion

• Which hazards are present? RAW? WAR? WAW?• load r3 <- r1, r2• add r1 <- r5, r2• sub r3 <- r3, r1 or r3 <- r2, r1

• Register Reservations– when issue mark destination register busy till complete– check all register reservations before issue

Reg

ALU

Ifetch Reg

Ad

d

DMem RegDMem’

Page 9: Instruction Level Parallelism and Dynamic Execution

Advantages ofDynamic Scheduling

• Handles cases when dependences unknown at compile time – (e.g., because they may involve a memory reference)

• It simplifies the compiler • Allows code that compiled for one pipeline to run efficiently on a

different pipeline • Hardware speculation, a technique with significant performance

advantages, that builds on dynamic scheduling

Page 10: Instruction Level Parallelism and Dynamic Execution

HW Schemes: Instruction Parallelism

• Key idea: Allow instructions behind stall to proceedDIVD F0,F2,F4ADDD F10,F0,F8SUBD F12,F8,F14

• Enables out-of-order execution and allows out-of-order completion

• Will distinguish when an instruction begins execution and when it completes execution; between 2 times, the instruction is in execution

• In a dynamically scheduled pipeline, all instructions pass through issue stage in order (in-order issue)

Page 11: Instruction Level Parallelism and Dynamic Execution

Dynamic Scheduling Step 1

• Simple pipeline has 1 stage to check both structural and data hazards: Instruction Decode (ID), also called Instruction Issue

• Split the ID pipe stage of simple 5-stage pipeline into 2 stages:

• Issue—Decode instructions, check for structural hazards

• Read operands—Wait until no data hazards, then read operands

Page 12: Instruction Level Parallelism and Dynamic Execution

A Dynamic Algorithm: Tomasulo’s Algorithm

• For IBM 360/91 (before caches!)• Goal: High Performance without special compilers• Small number of floating point registers (4 in 360) prevented interesting

compiler scheduling of operations– This led Tomasulo to try to figure out how to get more effective

registers — renaming in hardware! • Why Study 1966 Computer? • The descendants of this have flourished!

– Alpha 21264, HP 8000, MIPS 10000, Pentium III, PowerPC 604, …

Page 13: Instruction Level Parallelism and Dynamic Execution

Tomasulo Algorithm

• Control & buffers distributed with Function Units (FU)– FU buffers called “reservation stations”; have pending operands

• Registers in instructions replaced by values or pointers to reservation stations(RS); – form of register renaming ; – avoids WAR, WAW hazards– More reservation stations than registers, so can do optimizations

compilers can’t• Results to FU from RS, not through registers, over Common Data Bus

that broadcasts results to all FUs• Load and Stores treated as FUs with RSs as well• Integer instructions can go past branches, allowing

FP ops beyond basic block in FP queue

Page 14: Instruction Level Parallelism and Dynamic Execution

Tomasulo Organization

FP addersFP adders

Add1Add2Add3

FP multipliersFP multipliers

Mult1Mult2

From Mem FP Registers

Reservation Stations

Common Data Bus (CDB)

To Mem

FP OpQueue

Load Buffers

Store Buffers

Load1Load2Load3Load4Load5Load6

Page 15: Instruction Level Parallelism and Dynamic Execution

Reservation Station Components

Op: Operation to perform in the unit (e.g., + or –)

Vj, Vk: Value of Source operands– Store buffers has V field, result to be stored

Qj, Qk: Reservation stations producing source registers (value to be written)– Note: Qj,Qk=0 => ready– Store buffers only have Qi for RS producing result

Busy: Indicates reservation station or FU is busy

Register result status—Indicates which functional unit will write each register, if one exists. Blank when no pending instructions that will write that register.

Page 16: Instruction Level Parallelism and Dynamic Execution

Three Stages of Tomasulo Algorithm

1. Issue—get instruction from FP Op Queue If reservation station free (no structural hazard),

control issues instr & sends operands (renames registers).2. Execute—operate on operands (EX)

When both operands ready then execute; if not ready, watch Common Data Bus for result

3. Write result—finish execution (WB) Write on Common Data Bus to all awaiting units;

mark reservation station available• Normal data bus: data + destination (“go to” bus)• Common data bus: data + source (“come from” bus)

– 64 bits of data + 4 bits of Functional Unit source address– Write if matches expected Functional Unit (produces result)– Does the broadcast

• Example speed: 2 clks for load, 3 clks for +/-, 10 clks for * ; 40 clks for /

Page 17: Instruction Level Parallelism and Dynamic Execution

Tomasulo ExampleInstruction status: Exec Write

Instruction j k Issue Comp Result Busy AddressLD F6 34+ R2 Load1 NoLD F2 45+ R3 Load2 NoMULTD F0 F2 F4 Load3 NoSUBD F8 F6 F2DIVD F10 F0 F6ADDD F6 F8 F2

Reservation Stations: S1 S2 RS RSTime Name Busy Op Vj Vk Qj Qk

Add1 NoAdd2 NoAdd3 NoMult1 NoMult2 No

Register result status:Clock F0 F2 F4 F6 F8 F10 F12 ... F30

0 FU

Clock cycle counter

FU countdown

Instruction stream

3 Load/Buffers

3 FP Adder R.S.2 FP Mult R.S.

Page 18: Instruction Level Parallelism and Dynamic Execution

Tomasulo Example Cycle 1Instruction status: Exec Write

Instruction j k Issue Comp Result Busy AddressLD F6 34+ R2 1 Load1 Yes 34+R2LD F2 45+ R3 Load2 NoMULTD F0 F2 F4 Load3 NoSUBD F8 F6 F2DIVD F10 F0 F6ADDD F6 F8 F2

Reservation Stations: S1 S2 RS RSTime Name Busy Op Vj Vk Qj Qk

Add1 NoAdd2 NoAdd3 NoMult1 NoMult2 No

Register result status:Clock F0 F2 F4 F6 F8 F10 F12 ... F30

1 FU Load1

Page 19: Instruction Level Parallelism and Dynamic Execution

Tomasulo Example Cycle 2Instruction status: Exec Write

Instruction j k Issue Comp Result Busy AddressLD F6 34+ R2 1 Load1 Yes 34+R2LD F2 45+ R3 2 Load2 Yes 45+R3MULTD F0 F2 F4 Load3 NoSUBD F8 F6 F2DIVD F10 F0 F6ADDD F6 F8 F2

Reservation Stations: S1 S2 RS RSTime Name Busy Op Vj Vk Qj Qk

Add1 NoAdd2 NoAdd3 NoMult1 NoMult2 No

Register result status:Clock F0 F2 F4 F6 F8 F10 F12 ... F30

2 FU Load2 Load1

Note: Can have multiple loads outstanding

Page 20: Instruction Level Parallelism and Dynamic Execution

Tomasulo Example Cycle 3Instruction status: Exec Write

Instruction j k Issue Comp Result Busy AddressLD F6 34+ R2 1 3 Load1 Yes 34+R2LD F2 45+ R3 2 Load2 Yes 45+R3MULTD F0 F2 F4 3 Load3 NoSUBD F8 F6 F2DIVD F10 F0 F6ADDD F6 F8 F2

Reservation Stations: S1 S2 RS RSTime Name Busy Op Vj Vk Qj Qk

Add1 NoAdd2 NoAdd3 NoMult1 Yes MULTD R(F4) Load2Mult2 No

Register result status:Clock F0 F2 F4 F6 F8 F10 F12 ... F30

3 FU Mult1 Load2 Load1

• Note: registers names are removed (“renamed”) in Reservation Stations; MULT issued

• Load1 completing; what is waiting for Load1?

Page 21: Instruction Level Parallelism and Dynamic Execution

Tomasulo Example Cycle 4Instruction status: Exec Write

Instruction j k Issue Comp Result Busy AddressLD F6 34+ R2 1 3 4 Load1 NoLD F2 45+ R3 2 4 Load2 Yes 45+R3MULTD F0 F2 F4 3 Load3 NoSUBD F8 F6 F2 4DIVD F10 F0 F6ADDD F6 F8 F2

Reservation Stations: S1 S2 RS RSTime Name Busy Op Vj Vk Qj Qk

Add1 Yes SUBD M(A1) Load2Add2 NoAdd3 NoMult1 Yes MULTD R(F4) Load2Mult2 No

Register result status:Clock F0 F2 F4 F6 F8 F10 F12 ... F30

4 FU Mult1 Load2 M(A1) Add1

• Load2 completing; what is waiting for Load2?

Page 22: Instruction Level Parallelism and Dynamic Execution

Tomasulo Example Cycle 5Instruction status: Exec Write

Instruction j k Issue Comp Result Busy AddressLD F6 34+ R2 1 3 4 Load1 NoLD F2 45+ R3 2 4 5 Load2 NoMULTD F0 F2 F4 3 Load3 NoSUBD F8 F6 F2 4DIVD F10 F0 F6 5ADDD F6 F8 F2

Reservation Stations: S1 S2 RS RSTime Name Busy Op Vj Vk Qj Qk

2 Add1 Yes SUBD M(A1) M(A2)Add2 NoAdd3 No

10 Mult1 Yes MULTD M(A2) R(F4)Mult2 Yes DIVD M(A1) Mult1

Register result status:Clock F0 F2 F4 F6 F8 F10 F12 ... F30

5 FU Mult1 M(A2) M(A1) Add1 Mult2

• Timer starts down for Add1, Mult1

Page 23: Instruction Level Parallelism and Dynamic Execution

Tomasulo Example Cycle 6Instruction status: Exec Write

Instruction j k Issue Comp Result Busy AddressLD F6 34+ R2 1 3 4 Load1 NoLD F2 45+ R3 2 4 5 Load2 NoMULTD F0 F2 F4 3 Load3 NoSUBD F8 F6 F2 4DIVD F10 F0 F6 5ADDD F6 F8 F2 6

Reservation Stations: S1 S2 RS RSTime Name Busy Op Vj Vk Qj Qk

1 Add1 Yes SUBD M(A1) M(A2)Add2 Yes ADDD M(A2) Add1Add3 No

9 Mult1 Yes MULTD M(A2) R(F4)Mult2 Yes DIVD M(A1) Mult1

Register result status:Clock F0 F2 F4 F6 F8 F10 F12 ... F30

6 FU Mult1 M(A2) Add2 Add1 Mult2

• Issue ADDD here despite name dependency on F6?

Page 24: Instruction Level Parallelism and Dynamic Execution

Tomasulo Example Cycle 7Instruction status: Exec Write

Instruction j k Issue Comp Result Busy AddressLD F6 34+ R2 1 3 4 Load1 NoLD F2 45+ R3 2 4 5 Load2 NoMULTD F0 F2 F4 3 Load3 NoSUBD F8 F6 F2 4 7DIVD F10 F0 F6 5ADDD F6 F8 F2 6

Reservation Stations: S1 S2 RS RSTime Name Busy Op Vj Vk Qj Qk

0 Add1 Yes SUBD M(A1) M(A2)Add2 Yes ADDD M(A2) Add1Add3 No

8 Mult1 Yes MULTD M(A2) R(F4)Mult2 Yes DIVD M(A1) Mult1

Register result status:Clock F0 F2 F4 F6 F8 F10 F12 ... F30

7 FU Mult1 M(A2) Add2 Add1 Mult2

• Add1 (SUBD) completing; what is waiting for it?

Page 25: Instruction Level Parallelism and Dynamic Execution

Tomasulo Example Cycle 8Instruction status: Exec Write

Instruction j k Issue Comp Result Busy AddressLD F6 34+ R2 1 3 4 Load1 NoLD F2 45+ R3 2 4 5 Load2 NoMULTD F0 F2 F4 3 Load3 NoSUBD F8 F6 F2 4 7 8DIVD F10 F0 F6 5ADDD F6 F8 F2 6

Reservation Stations: S1 S2 RS RSTime Name Busy Op Vj Vk Qj Qk

Add1 No2 Add2 Yes ADDD (M-M) M(A2)

Add3 No7 Mult1 Yes MULTD M(A2) R(F4)

Mult2 Yes DIVD M(A1) Mult1

Register result status:Clock F0 F2 F4 F6 F8 F10 F12 ... F30

8 FU Mult1 M(A2) Add2 (M-M) Mult2

Page 26: Instruction Level Parallelism and Dynamic Execution

Tomasulo Example Cycle 9Instruction status: Exec Write

Instruction j k Issue Comp Result Busy AddressLD F6 34+ R2 1 3 4 Load1 NoLD F2 45+ R3 2 4 5 Load2 NoMULTD F0 F2 F4 3 Load3 NoSUBD F8 F6 F2 4 7 8DIVD F10 F0 F6 5ADDD F6 F8 F2 6

Reservation Stations: S1 S2 RS RSTime Name Busy Op Vj Vk Qj Qk

Add1 No1 Add2 Yes ADDD (M-M) M(A2)

Add3 No6 Mult1 Yes MULTD M(A2) R(F4)

Mult2 Yes DIVD M(A1) Mult1

Register result status:Clock F0 F2 F4 F6 F8 F10 F12 ... F30

9 FU Mult1 M(A2) Add2 (M-M) Mult2

Page 27: Instruction Level Parallelism and Dynamic Execution

Tomasulo Example Cycle 10Instruction status: Exec Write

Instruction j k Issue Comp Result Busy AddressLD F6 34+ R2 1 3 4 Load1 NoLD F2 45+ R3 2 4 5 Load2 NoMULTD F0 F2 F4 3 Load3 NoSUBD F8 F6 F2 4 7 8DIVD F10 F0 F6 5ADDD F6 F8 F2 6 10

Reservation Stations: S1 S2 RS RSTime Name Busy Op Vj Vk Qj Qk

Add1 No0 Add2 Yes ADDD (M-M) M(A2)

Add3 No5 Mult1 Yes MULTD M(A2) R(F4)

Mult2 Yes DIVD M(A1) Mult1

Register result status:Clock F0 F2 F4 F6 F8 F10 F12 ... F30

10 FU Mult1 M(A2) Add2 (M-M) Mult2

• Add2 (ADDD) completing; what is waiting for it?

Page 28: Instruction Level Parallelism and Dynamic Execution

Tomasulo Example Cycle 11Instruction status: Exec Write

Instruction j k Issue Comp Result Busy AddressLD F6 34+ R2 1 3 4 Load1 NoLD F2 45+ R3 2 4 5 Load2 NoMULTD F0 F2 F4 3 Load3 NoSUBD F8 F6 F2 4 7 8DIVD F10 F0 F6 5ADDD F6 F8 F2 6 10 11

Reservation Stations: S1 S2 RS RSTime Name Busy Op Vj Vk Qj Qk

Add1 NoAdd2 NoAdd3 No

4 Mult1 Yes MULTD M(A2) R(F4)Mult2 Yes DIVD M(A1) Mult1

Register result status:Clock F0 F2 F4 F6 F8 F10 F12 ... F30

11 FU Mult1 M(A2) (M-M+M)(M-M) Mult2

• Write result of ADDD here?• All quick instructions complete in this cycle!

Page 29: Instruction Level Parallelism and Dynamic Execution

Tomasulo Example Cycle 12Instruction status: Exec Write

Instruction j k Issue Comp Result Busy AddressLD F6 34+ R2 1 3 4 Load1 NoLD F2 45+ R3 2 4 5 Load2 NoMULTD F0 F2 F4 3 Load3 NoSUBD F8 F6 F2 4 7 8DIVD F10 F0 F6 5ADDD F6 F8 F2 6 10 11

Reservation Stations: S1 S2 RS RSTime Name Busy Op Vj Vk Qj Qk

Add1 NoAdd2 NoAdd3 No

3 Mult1 Yes MULTD M(A2) R(F4)Mult2 Yes DIVD M(A1) Mult1

Register result status:Clock F0 F2 F4 F6 F8 F10 F12 ... F30

12 FU Mult1 M(A2) (M-M+M)(M-M) Mult2

Page 30: Instruction Level Parallelism and Dynamic Execution

Tomasulo Example Cycle 13Instruction status: Exec Write

Instruction j k Issue Comp Result Busy AddressLD F6 34+ R2 1 3 4 Load1 NoLD F2 45+ R3 2 4 5 Load2 NoMULTD F0 F2 F4 3 Load3 NoSUBD F8 F6 F2 4 7 8DIVD F10 F0 F6 5ADDD F6 F8 F2 6 10 11

Reservation Stations: S1 S2 RS RSTime Name Busy Op Vj Vk Qj Qk

Add1 NoAdd2 NoAdd3 No

2 Mult1 Yes MULTD M(A2) R(F4)Mult2 Yes DIVD M(A1) Mult1

Register result status:Clock F0 F2 F4 F6 F8 F10 F12 ... F30

13 FU Mult1 M(A2) (M-M+M)(M-M) Mult2

Page 31: Instruction Level Parallelism and Dynamic Execution

Tomasulo Example Cycle 14Instruction status: Exec Write

Instruction j k Issue Comp Result Busy AddressLD F6 34+ R2 1 3 4 Load1 NoLD F2 45+ R3 2 4 5 Load2 NoMULTD F0 F2 F4 3 Load3 NoSUBD F8 F6 F2 4 7 8DIVD F10 F0 F6 5ADDD F6 F8 F2 6 10 11

Reservation Stations: S1 S2 RS RSTime Name Busy Op Vj Vk Qj Qk

Add1 NoAdd2 NoAdd3 No

1 Mult1 Yes MULTD M(A2) R(F4)Mult2 Yes DIVD M(A1) Mult1

Register result status:Clock F0 F2 F4 F6 F8 F10 F12 ... F30

14 FU Mult1 M(A2) (M-M+M)(M-M) Mult2

Page 32: Instruction Level Parallelism and Dynamic Execution

Tomasulo Example Cycle 15Instruction status: Exec Write

Instruction j k Issue Comp Result Busy AddressLD F6 34+ R2 1 3 4 Load1 NoLD F2 45+ R3 2 4 5 Load2 NoMULTD F0 F2 F4 3 15 Load3 NoSUBD F8 F6 F2 4 7 8DIVD F10 F0 F6 5ADDD F6 F8 F2 6 10 11

Reservation Stations: S1 S2 RS RSTime Name Busy Op Vj Vk Qj Qk

Add1 NoAdd2 NoAdd3 No

0 Mult1 Yes MULTD M(A2) R(F4)Mult2 Yes DIVD M(A1) Mult1

Register result status:Clock F0 F2 F4 F6 F8 F10 F12 ... F30

15 FU Mult1 M(A2) (M-M+M)(M-M) Mult2

• Mult1 (MULTD) completing; what is waiting for it?

Page 33: Instruction Level Parallelism and Dynamic Execution

Tomasulo Example Cycle 16Instruction status: Exec Write

Instruction j k Issue Comp Result Busy AddressLD F6 34+ R2 1 3 4 Load1 NoLD F2 45+ R3 2 4 5 Load2 NoMULTD F0 F2 F4 3 15 16 Load3 NoSUBD F8 F6 F2 4 7 8DIVD F10 F0 F6 5ADDD F6 F8 F2 6 10 11

Reservation Stations: S1 S2 RS RSTime Name Busy Op Vj Vk Qj Qk

Add1 NoAdd2 NoAdd3 NoMult1 No

40 Mult2 Yes DIVD M*F4 M(A1)

Register result status:Clock F0 F2 F4 F6 F8 F10 F12 ... F30

16 FU M*F4 M(A2) (M-M+M)(M-M) Mult2

• Just waiting for Mult2 (DIVD) to complete

Page 34: Instruction Level Parallelism and Dynamic Execution

After skipping a couple of cycles

Page 35: Instruction Level Parallelism and Dynamic Execution

Tomasulo Example Cycle 55Instruction status: Exec Write

Instruction j k Issue Comp Result Busy AddressLD F6 34+ R2 1 3 4 Load1 NoLD F2 45+ R3 2 4 5 Load2 NoMULTD F0 F2 F4 3 15 16 Load3 NoSUBD F8 F6 F2 4 7 8DIVD F10 F0 F6 5ADDD F6 F8 F2 6 10 11

Reservation Stations: S1 S2 RS RSTime Name Busy Op Vj Vk Qj Qk

Add1 NoAdd2 NoAdd3 NoMult1 No

1 Mult2 Yes DIVD M*F4 M(A1)

Register result status:Clock F0 F2 F4 F6 F8 F10 F12 ... F30

55 FU M*F4 M(A2) (M-M+M)(M-M) Mult2

Page 36: Instruction Level Parallelism and Dynamic Execution

Tomasulo Example Cycle 56

Instruction status: Exec WriteInstruction j k Issue Comp Result Busy AddressLD F6 34+ R2 1 3 4 Load1 NoLD F2 45+ R3 2 4 5 Load2 NoMULTD F0 F2 F4 3 15 16 Load3 NoSUBD F8 F6 F2 4 7 8DIVD F10 F0 F6 5 56ADDD F6 F8 F2 6 10 11

Reservation Stations: S1 S2 RS RSTime Name Busy Op Vj Vk Qj Qk

Add1 NoAdd2 NoAdd3 NoMult1 No

0 Mult2 Yes DIVD M*F4 M(A1)

Register result status:Clock F0 F2 F4 F6 F8 F10 F12 ... F30

56 FU M*F4 M(A2) (M-M+M)(M-M) Mult2

• Mult2 (DIVD) is completing; what is waiting for it?

Page 37: Instruction Level Parallelism and Dynamic Execution

Tomasulo Example Cycle 57

Instruction status: Exec WriteInstruction j k Issue Comp Result Busy AddressLD F6 34+ R2 1 3 4 Load1 NoLD F2 45+ R3 2 4 5 Load2 NoMULTD F0 F2 F4 3 15 16 Load3 NoSUBD F8 F6 F2 4 7 8DIVD F10 F0 F6 5 56 57ADDD F6 F8 F2 6 10 11

Reservation Stations: S1 S2 RS RSTime Name Busy Op Vj Vk Qj Qk

Add1 NoAdd2 NoAdd3 NoMult1 NoMult2 Yes DIVD M*F4 M(A1)

Register result status:Clock F0 F2 F4 F6 F8 F10 F12 ... F30

56 FU M*F4 M(A2) (M-M+M)(M-M) Result

• Once again: In-order issue, out-of-order execution and out-of-order completion.

Page 38: Instruction Level Parallelism and Dynamic Execution

Tomasulo Drawbacks

• Complexity– delays of 360/91, MIPS 10000, Alpha 21264,

IBM PPC 620 in CA:AQA 2/e, but not in silicon!• Many associative stores (CDB) at high speed• Performance limited by Common Data Bus

– Each CDB must go to multiple functional units high capacitance, high wiring density

– Number of functional units that can complete per cycle limited to one!

• Multiple CDBs more FU logic for parallel assoc stores

• Non-precise interrupts!– We will address this later

Page 39: Instruction Level Parallelism and Dynamic Execution

Superscalar Architecture

• A superscalar processor executes more than one instruction during a clock cycle by simultaneously dispatching multiple instructions to redundant functional units on the processor. • Each functional unit is not a separate CPU core but an execution resource within a single CPU

Typical 5-stage pipeline Superscalar Pipeline

Page 40: Instruction Level Parallelism and Dynamic Execution

Conclusion

20-stage pipeline

Pipeline design and scheduling are techniques to achieve significant throughput improvement in modern CPU.