Professional Documents
Culture Documents
Administrative
• Project proposals
• Due 5PM, Friday, March 13 (hard deadline)
L9: Control Flow • MPM Sequential code and information
posted on website
– A brief discussion now
• Class cancelled on Wednesday, Feb. 25
2
CS6963
CS6963
L9:
Control
Flow
3
4
CS6963
CS6963
L9:
Control
Flow
L9:
Control
Flow
1
2/23/09
P0
Reg
P!
...
P
Reg
Instruc6on
/*
int
i=0;
*/
based
on
its
threadIdx)
M‐1
Unit
own
R3
LDC
0,
R3
own
threadIdx
&dout
&dout
&dout
Memory
Memory
5
6
CS6963
CS6963
L9:
Control
Flow
L9:
Control
Flow
P0
Reg
P!
...
P
Reg
Instruc6on
+ threadIdx */
LDC BLOCKSIZE,R2
P0
P!
...
P M‐1
Instruc6on
Unit
threadIdx,2
opera6ons
from
M‐1
Unit
MUL R1, R3, R2
its
own
registers
ADD R4, R1, RO
Memory
Memory
Etc.
7
8
CS6963
CS6963
L9:
Control
Flow
L9:
Control
Flow
2
2/23/09
9
10
CS6963
CS6963
L9:
Control
Flow
L9:
Control
Flow
3
2/23/09
∑ p
Sip m p Vp • Partitioning is always the same
Vi = – Thus you can use this knowledge in control flow
mi
– However, the exact size of warps may change from
• No need to test for divide by 0 error, generation to generation
– (Covered next)
and slight delta does not impact results
• However, DO NOT rely on any ordering between
warps
– If there are any dependences between threads, you must
__syncthreads() to get correct results
13
©
David
Kirk/NVIDIA
and
Wen‐mei
W.
Hwu,
2007‐2009
14
CS6963
ECE
498AL,
University
of
Illinois,
Urbana‐Champaign
L9:
Control
Flow
L9:
Control
Flow
4
2/23/09
©
David
Kirk/NVIDIA
and
Wen‐mei
W.
Hwu,
2007‐2009
19
©
David
Kirk/NVIDIA
and
Wen‐mei
W.
Hwu,
2007‐2009
20
ECE
498AL,
University
of
Illinois,
Urbana‐Champaign
L9:
Control
Flow
ECE
498AL,
University
of
Illinois,
Urbana‐Champaign
L9:
Control
Flow
5
2/23/09
©
David
Kirk/NVIDIA
and
Wen‐mei
W.
Hwu,
2007‐2009
21
©
David
Kirk/NVIDIA
and
Wen‐mei
W.
Hwu,
2007‐2009
22
ECE
498AL,
University
of
Illinois,
Urbana‐Champaign
L9:
Control
Flow
ECE
498AL,
University
of
Illinois,
Urbana‐Champaign
L9:
Control
Flow
6
2/23/09
: :
: :
if (x == 10) LDR r5, X A
c = c + 1; p1 <- r5 eq 10 B C B
C
: <p1> LDR r1 <- C D
: <p1> ADD r1, r1, 1
<p1> STR r1 -> C
:
D
:
©
David
Kirk/NVIDIA
and
Wen‐mei
W.
Hwu,
2007‐2009
25
©
David
Kirk/NVIDIA
and
Wen‐mei
W.
Hwu,
2007‐2009
26
ECE
498AL,
University
of
Illinois,
Urbana‐Champaign
L9:
Control
Flow
ECE
498AL,
University
of
Illinois,
Urbana‐Champaign
L9:
Control
Flow
7
2/23/09
Summary of Lecture
31
CS6963
L9:
Control
Flow