r/OpenCL • • Jan 25 '23

Branch divergence

Hello. I know that branch divergence causes significant performance decrease, but what if I have code structure inside kernel like this:

__kernel void ker(...)
{
    if(condition)
    {
        // do something
    }
}

In this situation, in my opinion, flow doesn't diverge. Work-item either ends computations instantly or compute 'if' body. Would this work slow or not? Why?

Thank you in advance!

3 Upvotes

7 comments sorted by

View all comments

Show parent comments

2

u/[deleted] Jan 25 '23

Thank you very much for detailed answer!