The ¡Basics: ¡Pipelining ¡
- J. ¡Nelson ¡Amaral ¡
University ¡of ¡Alberta ¡
1 ¡
The Basics: Pipelining J. Nelson Amaral University of - - PowerPoint PPT Presentation
The Basics: Pipelining J. Nelson Amaral University of Alberta 1 The Pipeline Concept 2 Bauer p. 32 Pipeline Throughput and Latency IF ID EX MEM
1 ¡
Bauer ¡p. ¡32 ¡
2 ¡
3 ¡
5 ns 4 ns 5 ns 10 ns 4 ns
4 ¡
5 ns 4 ns 5 ns 10 ns 4 ns
5 ¡
5 ns 4 ns 5 ns 10 ns 4 ns
IF MEM ID I1 L(I1) = 28ns EX WB MEM ID IF I2 L(I2) = 33ns EX WB MEM ID IF I3 L(I3) = 38ns EX WB MEM ID IF I4 L(I5) = 43ns EX WB We are in trouble! The latency is not constant. This happens because this is an unbalanced
the same length as the longest one.
6 ¡
5 ns 4 ns 5 ns 10 ns 4 ns
IF MEM ID I1 L(I1) = L(I2) = L(I3) = L(I4) = 50ns EX WB IF MEM ID I2 L(I2) = 50ns EX WB IF MEM ID EX WB IF MEM ID EX
10 20 30 40 50 60
I3 I4
7 ¡
5 ns 4 ns 5 ns 10 ns 4 ns
8 ¡
5 ns 4 ns 5 ns 10 ns 4 ns
9 ¡
MEM1
5 ns 4 ns 5 ns 5 ns 4 ns
MEM2
5 ns
10 ¡
MEM1
5 ns 4 ns 5 ns 5 ns 4 ns
MEM2
5 ns
IF
MEM1
ID I1 EX WB
MEM1
IF
MEM1
ID I2 EX WB
MEM1
IF
MEM1
ID I3 EX WB
MEM1
IF
MEM1
ID I4 EX WB
MEM1
IF
MEM1
ID I5 EX WB
MEM1
IF
MEM1
ID I6 EX WB
MEM1
IF
MEM1
ID I7 EX WB
MEM1
11 ¡
MEM1
5 ns 4 ns 5 ns 5 ns 4 ns
MEM2
5 ns
12 ¡
MEM1
5 ns 4 ns 5 ns 5 ns 4 ns
MEM2
5 ns
Bauer ¡p. ¡33 ¡
13 ¡
Bauer ¡p. ¡34 ¡
14 ¡
Read-‑AYer-‑Write ¡(RAW) ¡ dependencies ¡ (true ¡dependencies) ¡ Write-‑AYer-‑Read ¡(WAR) ¡ dependencies ¡ (anM ¡dependencies) ¡ Bauer ¡p. ¡35 ¡
15 ¡
v ¡ v ¡ v ¡ Bauer ¡p. ¡36 ¡
16 ¡
Bauer ¡p. ¡37 ¡
17 ¡
The ¡data ¡from ¡the ¡load ¡is ¡not ¡available ¡unMl ¡the ¡Mem/WB ¡of ¡instrucMon ¡i, ¡ but ¡it ¡is ¡needed ¡at ¡the ¡ID/EX ¡of ¡instrucMon ¡i+1 ¡ Cannot ¡forward ¡ back ¡on ¡Mme! ¡ Bauer ¡p. ¡36 ¡
18 ¡
Bauer ¡p. ¡38 ¡
19 ¡
Bauer ¡p. ¡38 ¡
20 ¡
Bauer ¡p. ¡39 ¡
21 ¡
AYer ¡the ¡load, ¡the ¡contents ¡of ¡the ¡Mem/WB ¡register ¡ must ¡be ¡forwarded ¡to ¡be ¡wrifen ¡to ¡memory ¡(not ¡only ¡ to ¡R5). ¡ ¡
Bauer ¡p. ¡38 ¡
22 ¡
Bauer ¡p. ¡40 ¡
23 ¡
Bauer ¡p. ¡40 ¡
24 ¡
Save ¡the ¡Process ¡State ¡ Schedule ¡Process ¡Restart ¡ Clear ¡ExcepMon ¡CondiMon ¡ Abort ¡Program ¡ “Correct” ¡ ExcepMon ¡ Perform ¡ Unrelated ¡Task ¡
Bauer ¡p. ¡41 ¡
25 ¡
– The ¡PC ¡saved ¡is ¡the ¡PC ¡of ¡instrucMon ¡i. ¡
Bauer ¡p. ¡41 ¡
26 ¡
i ¡ i-‑1 ¡ i-‑2 ¡ i+2 ¡ i+1 ¡ ⋅⋅⋅ ¡ ⋅⋅⋅ ¡ Complete ¡normally ¡ no-‑op ¡ no-‑op ¡ no-‑op ¡ no-‑op ¡ ExcepMon ¡happens ¡here ¡→ ¡ ←ExecuMon ¡re-‑starts ¡here ¡
Bauer ¡p. ¡41 ¡
27 ¡
divide-‑by-‑zero ¡excepMon ¡ page-‑fault ¡excepMon ¡ Which ¡excepMon ¡occurs ¡first ¡in ¡Mme? ¡ Which ¡excepMon ¡should ¡be ¡handled ¡first? ¡ Bauer ¡p. ¡41 ¡
28 ¡
Bauer ¡p. ¡38 ¡
29 ¡
Example: ¡ ¡ ¡i: ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡R4 ¡← ¡Mem[R8] ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡i+1: ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡R7 ¡← ¡R4 ¡+ ¡R5 ¡ Bauer ¡p. ¡43 ¡
30 ¡
Example: ¡ ¡ ¡i: ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡R4 ¡← ¡Mem[R8] ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡i+1: ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡R7 ¡← ¡R4 ¡+ ¡R5 ¡ Bauer ¡p. ¡43 ¡
31 ¡
Example: ¡ ¡ ¡i: ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡R5 ¡← ¡R6 ¡+ ¡R7 ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡i+1: ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡R9 ¡← ¡Mem[R5] ¡ Can’t ¡forward ¡from ¡ ¡
Bauer ¡p. ¡43 ¡
32 ¡
Bauer ¡p. ¡43 ¡
33 ¡
Bauer ¡p. ¡43 ¡
34 ¡
Bauer ¡p. ¡44 ¡
35 ¡
Bauer ¡p. ¡44 ¡
36 ¡
Most ¡standard ¡floaMng ¡point ¡representaMon ¡use: ¡ ¡ ¡ ¡1 ¡bit ¡for ¡the ¡sign ¡(posiMve ¡or ¡negaMve) ¡ ¡ ¡ ¡8 ¡bits ¡for ¡the ¡range ¡(exponent ¡field) ¡ ¡23 ¡bits ¡for ¡the ¡precision ¡(fracMon ¡field) ¡
S E F
23 ¡ 8 ¡ 1 ¡
S ×1.fraction × 2exponent−127, 1≤ exponent ≤ 254
S × 0.fraction × 2exponent−126, exponent = 0
From: ¡Paf ¡and ¡Patel, ¡pp. ¡33 ¡ P-‑H. ¡p. ¡245 ¡ Bauer ¡p. ¡45 ¡ exponent ¡ frac0on ¡ sign ¡
37 ¡
In ¡the ¡8-‑bit ¡field ¡of ¡the ¡exponent ¡we ¡can ¡represent ¡numbers ¡from ¡0 ¡to ¡
What ¡is ¡the ¡value ¡represented ¡when ¡the ¡exponent ¡is ¡255 ¡(i.e. ¡111111112)? ¡ An ¡exponent ¡equal ¡255 ¡= ¡111111112 ¡in ¡a ¡floaMng ¡point ¡representaMon ¡ indicates ¡a ¡special ¡value. ¡ When ¡the ¡exponent ¡is ¡equal ¡255 ¡= ¡111111112 ¡and ¡the ¡fracMon ¡is ¡0, ¡ the ¡value ¡represented ¡is ¡± ¡infinity. ¡ When ¡the ¡exponent ¡is ¡equal ¡255 ¡= ¡111111112 ¡and ¡the ¡fracMon ¡is ¡ ¡ non-‑zero, ¡the ¡value ¡represented ¡is ¡Not ¡a ¡Number ¡(NaN). ¡ Hen/Paf, ¡pp. ¡301 ¡ P-‑H. ¡p. ¡246 ¡ Bauer ¡p. ¡45 ¡
38 ¡
E1 ¡< ¡E2 ¡
S1 ¡≠ ¡S2 ¡
yes ¡
yes ¡ Bauer ¡p. ¡46 ¡
39 ¡