richeek.arya

Question Regarding Flow Control

Discussion created by richeek.arya on Jun 8, 2011
Latest reply on Jun 10, 2011 by LeeHowes

In regards to flow control AMD's SDK mentions the following:

"For example, if a work-item contains a branch with two paths, the wavefront first executes one path, then the second path. The total time to execute the branch is the sum of each path time. An important point is that even if only one work-item in a wavefront diverges, the rest of the work-items in the wavefront execute the branch. "

What is meant by EXECUTE here? Does it mean just to check the branch condition of does it mean to actually execute all the instructions within the branch??

Suppose hypothetically I am running an appliation with 64 threads through the following code;

if(tid < 64/2)

   printf("If");

else

  printf("else");

 

So in this case does threads from 32 to 63 execute if part too and first print "if" and then "else" ? Ofcourse that does not happen so someone could explain me the execution sequence here please?

with regards,

Richeek

Outcomes