parallel processing, pipelining, flynn’s taxonomy
DESCRIPTION
Parallel Processing, Pipelining, Flynn’s taxonomy. Ernest Jamro Dep. of Electronics AGH, Kraków. Example of parallelism / Przykład zrównoleglenia. General case Postać ogólna. Parrallel-Array Multiplier. Parallel Processing /Przetwarzanie Równoległe. - PowerPoint PPT PresentationTRANSCRIPT
Parallel Processing, Pipelining,Flynn’s taxonomy
Ernest Jamro
Dep. of Electronics
AGH, Kraków
2
Example of parallelism / Przykład zrównoleglenia
DMUX
F1
DMUXF2
DMUXF3
DMUX
MUX
F1
DMUXF2
DMUXF3
DMUX
+ Parrallel-Array Multiplier
General case
Postać ogólna
3
Parallel Processing /Przetwarzanie Równoległe
• Increases throughput R (http://en.wikipedia.org/wiki/Throughput)
/ Zwiększa przepustowość R.
• Increases Area A / Wymaga więcej sprzętu A.
Optimal parallel processing / Optymalne zrównoleglenie:
• RP= NR1
• AP= NA1
• TP= T1 - (clock period)
Real / Rzeczywiste
• RP< NR1
• AP= NA1+ADMUX + AMUX
• TP= T1 + TDMUX + TMUX
4
Functional Density D / Funkcjonalność układu D
A- Area; R- throughputAR
D
Parallel processing usually results in decreasing D: DP < D1 as:
• requires additional connection, arbitration logic
• synchronization of parallel processors (PP), cache coherency
• conficts between PPs, sharing of the same bus or memory
5
Amdahl’s Law
NP
PD
)1(
1
http://en.wikipedia.org/wiki/Amdahl’s_law
D- Speedup
P- Parallel portion
N- number of Parallel UnitsExample:
P= 0.9, Sequancial S=(1-P)=0.1
N=1 t1=(P+S)
N=2 t2=t1*(P/2+S)=0.55t1
N=10 t10=t1(P/10+S)=0.19t1
N=100 t100=t1(P/100+S)=0.109t1
tN=t1(P/N + S)
NP
Stt
DN
11
6
Power consumption and parallel processing Pobór energii a równoległość
2DDVAfConstP
Moc strat jest w przybliżeniu proporcjonalna do częstotliwości, powierzchni i kwadratu nap. zasilania
Power consumption is roughly proportional to square supply voltage
AP= NA1
fP= f1/N – same throughput for PP / taka sama przepustowość przepustowość dla przetw. rów.
RP= R1
2
21
21
2111
DDP
DD
DDP
DD
p VV
VANNf
const
VAfconstPP
Lower freq. => lower power supply
7
Pipelining / Potokowość
F1 F2 F3
- rejestry / flip-flops
Example / Przykład: F= (AB+C)DF1= AB F2= F1+C F3= F2 * DF= (AB+C)DF1= AB F2= F1+C F3= F2 * DWithout pipelining / Bez potokowości (bez rejestrów):T= T1 + T2 + T3 A= A1 + A2 + A3
With pipelining / Architektura potokowa:T= MAX(T1, T2, T3) A= A1 + A2 + A3 + AFF
8
Pipelining Pentium Processor
Clock cycle
Instruction fetch
decoding (etap 1)
decoding (etap 2)
Execution Registers updating
TN+4 Instruc. M+4 Instruc. M+3 Instruc. M+2 Instruc. M+1 TN+3 Instruc. M+3 Instruc. M+2 Instruc. M+1 TN+2 Instruc. M+2 Instruc. M+1 TN+1 Instruc. M+1 TN
time / czas
9
Pipelining and external SRAM memory accessPotokowy dostęp do pamięci zewnętrznej SRAM
FPGA
opb_sram
SRAM
ABus
Adr Data
DBus RNW
Write Enable (Not)
Magistrala OPB On-chip Peripheral Bus
Logic / Logika
Piplining Flip-Flops Rejestry potokowe
10
Waveforms / Przebiegi CLK
RNW
ABus
DBus
SeqAddr
ADR
DATA
WEN
External Signals
Select
Ack
AW AW+1 AR AR+1
DW0 DW1 X DR0 DR1
AW AW+1 AR AR+1 AR+2
DW0 DW1 DR0 DR1 DR2
11
Additional registers are required to compensate different delays
(Cut-Set Rule). Example of adders
Add
Add
Rejestry (pipelining flip-flops)
3 inputs
Add
Add
Add
Add
5 inputs
12
Pipeling and reduction of transient states and energy consumption
Module 1 Module 2
Dodatkowy rejestr potokowy Additional pipeline flip-flop
A B C D
Clk
A A1 (stan ustalony) settled state A2
B X (transent state) B1 (stan ustalony) settled state X
t1min
t1max
C (z pot.) C0 C1
D (z pot.) X D0 X
D (bez) X (long transent state (t1 + t2) D1 X
13
Employing double clock edge
Należy używać tylko pojedynczego zbocza zegara – wykorzystywanie zarówno opadającego i narastającego zbocza zegara powoduje nieoptymalne wykorzystanie logiki
Only a single clock edge (rising or falling) should be used
Module A Module B
FF – falling edge
A B C D
Clk
A A1 (stan ustalony) settled A2
B X(transient) przejściowy) B1 (stan ustalony) settled X
t1min
t1max
C (z pot.) C0 C1
D (z pot.) X D1
D (bez pot.) X D1 X
FF – rising edge FF – rising edge
D0
Lepiej dwa razy większą częstotliwość zegara
Better double clock frequency
14
Piplining and Clock EnableBlocking
D Q CE Clk
CE
Clk
logic
D Q CE Clk
logic
D Q CE Clk
Data
15
Piplining and Clock EnableNon-Blocking
D Q CE Clk
CE
Clk
logic
D Q CE Clk
logic
D Q CE Clk
Data
D Q Clk
D Q Clk
16
Control logic and pipelining
Moduł A
Moduł B
sel
ack
sel
ack
sel
ack S S M M
data data data
Kontrola przepływu danych
-sel – urządzenie typu Master jest gotowe do wysłania danych / Master ready to send data
-ack – Slave jest gotowe do odbioru danych / Slave is ready to accept new data
clk
Slave – Ack
0 1 2 3 4 5 6
Master – Sel
Master – Data D1 D2 D3
17
Adding pipeline registers
Moduł A
Moduł B
sel
ack
sel
ack
sel
ack S S M M
data D data
selq
Dq
clk
Slave – Ack
0 1 2 3 4 5 6
Master – Sel
Master – D D1
Master – Selq
Master – Dq D1
Źle działający układ – dwa transfery tej samej danej
Not working properly – double transfer of the same data
18
Additional logic selq
Moduł A
Moduł B
sel
ack
sel
ack
sel
ack S S M M
data D data
selq
Dq
clk
Slave – Ack
0 1 2 3 4 5 6
Master – Sel
Master – D D1
Master – Selq
Master – Dq D1 D2
D2 D3
D3
2 clk
Process (clk) begin
if clk’event and clk=‘1’then
sel_Q<= sel and not ack;
end if; end process;
Wady:
1) Maksymalny transfer ograniczony do co drugiego taktu zegara / transfer only every second clock cycle
2) Długa ścieżka sygnału Ack (bez potokowości) / long Ack path
19
Piplining and FIFO (First-In First-Out)
Module 1
Module 2
sel
ack
sel1
ack1
sel
ack S S M M
data data1 data
FIFO
sel2
ack2
data2
clk
Ack1
0 1 2 3 4 5 6
Sel1
D1 D1
Sel2
D2
D2
Ack2
D3 D4 D5
D1 D2 D3 D4
Wada:
Skomplikowana logika i stosunkowo duże zajmowane zasoby
Drawback:
Complicated logic and large occupied resources
20
Użycie pojedynczego bufora FIFO dla wielu etapów potokowościSingle FIFO buffer for many pipeline stages
opb_slave
Wielostop- -niowa
architekt. potokowa
module with many pipeline stages
FIFO opb_master
di do
adr, sel, seqAddr, be
ack
Fifo_full – must take into account pipline stages of the module.
FIFO depth must be greater than the number of pipeline stages
21
Wady potokowości / Pipelining drawbacks
• Użycie dodatkowych rejestrów (dodatkowy hardware i opóźnienie) - w FPGA i tak są rejestry po każdym bloku logicznym
• Utrudnienie analizy i symulacji układu
• Bardziej rozbudowany system sterujący przepływem danych szczególnie dla instrukcji warunkowych (np. w procesorach: predykcja skoku), przy pętli zwrotnej danych
• Ograniczoność stosowania - wzrost szybkości szybko ulega nasyceniu.
• Additional flip-flops are required (additional resources and delay – latency), in FPGA every LUT (logic) is associated with FF
• Much more difficult design and simulation of the circuit
• Much more difficult control logic, esp. for feedback data path
• Limited level of pipelining (quick saturation of the architecture)
22
Zalety potokowości / Advantages of pipelining
• Znaczne przyspieszenie przepustowości często niewielkim kosztem
• Możliwość obniżenia poboru mocy poprzez obniżenie napięcia zasilania podobnie jak dla architektury równoległej przy tej samej przepustowości
• Obniżenie zużycia energii poprzez ograniczenie rozchodzenia się przebiegów przejściowych wynikających z czasów propagacji
• Much increase of the throughputby often insignificant increase of occupied hardware resources
• Reduction of power consuption similarty like for parallel architecture – by decreasing supply voltage in the same throughput
• Reduction of power consumption by limited transient state propagation
23
Architektura potokowa i równoległa przepustowość R= f(Area)Pipelining and parallel processing R= f(Area)
24
Flynn’s TaxonomyKlasyfikacja Flynn’a
•SISD (Single Instruction Single Data-stream)
•SIMD (Single Instruction Multiple Data-stream)
•MISD (Multiple Instruction Single Data-stream)
•MIMD (Multiple Instruction Multiple Data-stream)
http://en.wikipedia.org/wiki/Flynn’s_taxonomy
25
Single Instruction Single Data Stream (SIMD)
Jednostka Procesora Processing Unit
Jednostka Sterująca Control Unit
Moduł Pamięci Memory
Strumień Rozkazów Instruction Stream
26
Single Instruction Multiple Data Stream (SIMD)( Pentium MMX/SSE/AVX)
Jednostka Procesora Processing Unit
Jednostka Sterująca Control Unit
Moduł Pamięci Memory
Strumień Rozkazów Instruction Stream
Jednostka Procesora Processing Unit
Jednostka Procesora Processing Unit
27
Multiple Instruction Single Data Stream (MISD) (e.g. Pipelining)
Jednostka Procesora Processing Unit
Moduł Pamięci Memory
Strumień Rozkazów Instruction Stream
Jednostka Procesora Processing Unit
Jednostka Procesora Processing Unit
Strumień Danych Data Stream
Jednostka Sterująca Control Unit
Jednostka Sterująca Control Unit
Jednostka Sterująca Control Unit
28
Multiple Instruction Multiple Data Stream (MIMD)
Jednostka Procesora Processing Unit
Moduł Pamięci Memory
Strumień Rozkazów Instruction Stream
Jednostka Procesora Processing Unit
Jednostka Procesora Processing Unit
Jednostka Sterująca Control Unit
Jednostka Sterująca Control Unit
Jednostka Sterująca Control Unit
29
DSP TMS320C80