Threads exiting considered divergent?

Hello! I know that divergent threads will slow down my program, is the following considered divergent?

__global__ void divergentKernel( float * data, unsigned long N ) {

	unsigned long n = blockIdx.x * blockDim.x + threadIdx.x;

	if( n < N )



	//do stuff


Will the return statement cause a speed penalty amongst my threads?

Thank you!

For the last warp, potentially. If you have 129 threads and five warps (so 160 threads), you’ll have four nondivergent warps and one divergent warp with a corresponding speed penalty.