terminate kernel execution for a thread Is there something like break from loops or clip from HLSL?

In some Kernels I would like to terminate the execution of the kernel in the current thread.

In HLSL there was a function clip() which ended the execution of the “shader” at that point for the given pixel.

of cause it can be done like:



I search for something like:




Would be pretty useful.

Assuming you mean for threads in your kernel, you could just have them return if they meet the condition, and any other threads that didn’t meet the condition would continue their execution


  //threads that meet the condition exit



//threads that didnt meet the condition continue execution


Hope I understood your question correctly

oh that was easy :D, thanks