Title: Computer Architecture
1Computer Architecture
- Lecture 18
- Superscalar Processor and High Performance
Computing
2Static Superscalar Pipeline
- Fetch 64-bits/clock cycle Int on left, FP on
right - Can only issue 2nd instruction if 1st
instruction issues - More ports for FP registers to do FP load FP
op in a pair - Type Pipe Stages
- Int. instruction IF ID EX MEM WB
- FP instruction IF ID EX MEM WB
- Int. instruction IF ID EX MEM WB
- FP instruction IF ID EX MEM WB
- Int. instruction IF ID EX MEM WB
- FP instruction IF ID EX MEM WB
- 1 cycle load delay can cause delay up to 3
instructions in Superscalar - instruction in
right half cant use it, nor instructions in next
slot
3Dynamic Super Scalar pipeline in operation
4Example 1
- Loop L.D F0,0(R1) F0array element
- ADD.D F4,F0,F2
- S.D F4,0(R1) store result
- ADDIU R1,R1,-8 8 bytes (per DW)
- BNE R1,R2,LOOP branch R1!R2
5Dual issue, 1 Integer Unit
6Dual issue, 1 Integer Unit
7Dual issue, 1 Integer Unit
8Dual issue, 1 Integer Unit
9Dual issue, 1 Integer Unit
10Dual issue, 1 Integer Unit
11Dual issue, 1 Integer Unit
12Dual issue, 1 Integer Unit
13Dual issue, 1 Integer Unit
14Dual issue, 1 Integer Unit
15Dual issue, 1 Integer Unit
16Dual issue, 1 Integer Unit
17Dual issue, 1 Integer Unit
18Dual issue, 1 Integer Unit
19Dual issue, 1 Integer Unit
20Dual issue, 1 Integer Unit
21Dual issue, 1 Integer Unit
22Dual issue, 1 Integer Unit
23Separate MEM and INT
24Dual issue, 2 Integer Unit
25Dual issue, 2 Integer Unit
26Dual issue, 2 Integer Unit
27Dual issue, 2 Integer Unit
28Dual issue, 2 Integer Unit
29Dual issue, 2 Integer Unit
30Dual issue, 2 Integer Unit
31Dual issue, 2 Integer Unit
32Dual issue, 2 Integer Unit
33Dual issue, 2 Integer Unit
34Dual issue, 2 Integer Unit
35Dual issue, 2 Integer Unit
36Dual issue, 2 Integer Unit
37Dual issue, 2 Integer Unit
38Speculative Execution
- Need to overcome
- Branch Hazards
- Precise Exception
39Speculative Pipeline
Read Reg
ROB
CDB
ISSUE/ Rename to RS
FP
Write Reg
Check for RS
Check for RAW
40The Hardware Reorder Buffer
IM
- If inst write results in program order,
reg/memory always get the correct values - Reorder buffer (ROB) reorder out-of-order inst
to program order at the time of writing
reg/memory (commit) - If some inst goes wrong, handle it at the time of
commit just flush inst afterwards - Inst cannot write reg/memory immediately after
execution, so ROB also buffer the results - No such a place in Tomasulo original
Fetch Unit
Reorder Buffer
Decode
Rename
Regfile
RS
RS
L-buf
S-buf
DM
FU1
FU2
41Speculative Tomasulo Algorithm
Issue get instruction from FP Op
Queue Condition a free RS at the required
FU Actions (1) decode the instruction (2)
allocate a RS and ROB entry (3) do source
register renaming (4) do dest register renaming
(5) read register file (6) dispatch the decoded
and renamed instruction to the RS and
ROB Execution operate on operands
(EX) Condition At a given FU, At lease one
instruction is ready Action select a ready
instruction and send it to the FU Write result
finish execution (WB) Condition At a given FU,
some instruction finishes FU execution Actions
(1) FU writes to CDB, broadcast to all RSs and to
the ROB (2) FU broadcast tag (ROB index) to all
RS (3) de-allocate the RS. Note no register
status update at this time
42Speculative Tomasulo Algorithm
- Commitupdate register with reorder result
- Condition ROB is not empty and ROB head inst has
finished execution - Actions if no mis-prediction/exception (1) write
result to register/memory, (2) update register
status, (3) de-allocate the ROB entry - Actions if with mis-prediction/exception flush
the pipeline, e.g. (1) flush IFQ (2) clear
register status (3) flush all RS and reset FU
(4) reset ROB
43Example
- while (A(i) ltgt x)
- A(i)
- i
- Loop LD R2,0(R1) R1 base address of A()
- DADDIU R2,R2,1
- SD R2,0(R1) store result
- DADDIU R1,R1,4
- BNE R2,R3,LOOP x R3
44Non-Speculative executionDual issue, 2 CDB, 2
Int Units
45Non-Speculative executionDual issue, 2 CDB
46Non-Speculative executionDual issue, 2 CDB
47Non-Speculative executionDual issue, 2 CDB
48Non-Speculative executionDual issue, 2 CDB
49Non-Speculative executionDual issue, 2 CDB
50Non-Speculative executionDual issue, 2 CDB
51Non-Speculative executionDual issue, 2 CDB
52Non-Speculative executionDual issue, 2 CDB
53Non-Speculative executionDual issue, 2 CDB
54Non-Speculative executionDual issue, 2 CDB
55Non-Speculative executionDual issue, 2 CDB
56Non-Speculative executionDual issue, 2 CDB
57Non-Speculative executionDual issue, 2 CDB
58Non-Speculative executionDual issue, 2 CDB
59Non-Speculative executionDual issue, 2 CDB
60Non-Speculative executionDual issue, 2 CDB
61Non-Speculative executionDual issue, 2 CDB
62Non-Speculative executionDual issue, 2 CDB (Gap
b/w Issue and Execute)
63Speculative executionDual issue, 2 CDB
64Speculative executionDual issue, 2 CDB
65Speculative executionDual issue, 2 CDB
66Speculative executionDual issue, 2 CDB
67Speculative executionDual issue, 2 CDB
68Speculative executionDual issue, 2 CDB
69Speculative executionDual issue, 2 CDB
70Speculative executionDual issue, 2 CDB
71Speculative executionDual issue, 2 CDB
72Speculative executionDual issue, 2 CDB
73Speculative executionDual issue, 2 CDB
74Speculative executionDual issue, 2 CDB
75Speculative executionDual issue, 2 CDB
76Speculative executionDual issue, 2 CDB