I have a question concerning loops and branching. Lets say that we had no other way of doing something except by having a while(1) loop with a break condition. Something like:
And the question is: Do we have an implicit barrier within our warp? Or there’s no guaranty that the SM wont start executing the other path (in this case the code after the loop) before the condition is satisfied for all threads.
That is, is there any guaranty that the GPU scheduler wont drop the execution of loop and continue with the code after the loop, and return to the loop once it reaches a barrier of end of code (always within a warp)? Of course that would mean that the code after the loop will be executed several times (with a maximum of 32 times) and that is my concern
The reason I am asking (as opposed to just adding a __syncthreads() call) is because the code I’m working on the while loop is nested inside another while loop and adding a sync point might result in a deadlock… Well… I know this is horrible, but that’s how it is…