40 *(
volatile uint32*)count += __popc( __ballot(
true ) );
42 atomicInc( count,
uint32(-1) );
49 const volatile uint32 mask = __ballot(
true );
50 const uint32 warp_count = __popc( mask );
51 const uint32 warp_scan = __popc( mask >> warp_tid() ) - 1u;
53 *(
volatile uint32*)count = val + warp_count;
54 return val + warp_scan;
56 return atomicInc( count,
uint32(-1) );
62 *(
volatile uint32*)count -= __popc( __ballot(
true ) );
64 atomicDec( count,
uint32(-1) );
71 const volatile uint32 mask = __ballot(
true );
72 const uint32 warp_count = __popc( mask );
73 const uint32 warp_scan = __popc( mask >> warp_tid() ) - 1u;
75 *(
volatile uint32*)count = val - warp_count;
76 return val - warp_scan;
78 return atomicDec( count,
uint32(-1) );