about divergent branches

If in a warp, thread{1,3,5,11,13} take one side of the branch, the other threads take the other side of the branch, so only two branches paths are serialized or all 32 paths are serialized?


Hella ya there… uh… huh…,

Good Kochin infact… Personally, I think only 2 branch paths are serialized.

In my understanding, How this happens is that:

The compiler generated code will first create a predicate for all threads. The predicate will hold true value for threads {1,3,5…} and false value for other threads…

The compiler will generate a predicated branch instruction.

Now all the WARP threads execute the predicated branch instruction together.

Threads that take the branch will wait. The threads that dont take the branch will first execute their code and then join the other threads… OR vice versa…