What do work items execute when conditionals are used in GPU programming?

If you have work items executing in a wavefront and there is a conditional such as:

  if(x){
        ...
  }
  else{
       ....
  }

What do the work-items execute? is it the case whereby all workitems in the wavefront will execute the first branch (i.e. x == true). If there are no work-items for which x is false, then the rest of the conditional is skipped?

What happens if one work-item takes the alternative path. Am I told that all workitems will execute the alternate path as well (therefore executing both paths?). Why is this the case and how does it not mess up the program execution

7
задан Ciro Santilli 新疆改造中心法轮功六四事件 30 March 2016 в 22:21
поделиться