Some concepts and designs of the SIMT architecture are still unclear.
From what I saw and read, diverging code paths and if () are generally a pretty bad idea, because many threads can execute in lockstep. What does it mean? Sort of:
kernel void foo(..., int flag)
{
if (flag)
DO_STUFF
else
DO_SOMETHING_ELSE
}
The flag parameter is the same for all work units, and the same branch is used for all work units. Now, is the GPU going to execute all the code, still serializing everything, and basically still taking the branch that is not taken? Or is it a little smarter and will only execute the branch if all the threads are consistent with the branch? Which will always be the case here.
those. does serialization ALWAYS happen or only when necessary? Sorry for the stupid question.;)
source
share