CUDA and if and else if
Execution serialization in CUDA occurs whenever divergent forking occurs within the same thread base. So in your abstract example, if any of the three statements does not evaluate to be the same for any given warp, then there will be branching and repetition of some combination of three blocks of computation code, creating serialization for that base. But if the conditions are the same at the warp level, there will be no serialization.
You should also keep in mind that there is conditional execution in CUDA, so if you have something like this:
if (statement1) calculation1; end if
valid for all threads in the warp, serialization will not, instead, some of the yarns in the warp just doing the equivalent
So there is no general answer to your question - depending on the structure of the code, the input that defines the conditions, and the grouping of evaluating the conditions between skews, there may or may not be serialization. In general, the architecture and compiler are much more forking than many people realize, and intelligently written code containing branches and conditions will pay little (or even negligible) execution. The CUDA Profiler provides quite a bit of information about serialization and command repetition - this should be your primary guide to understanding the performance impact of branching on this piece of code.
source to share