Medium
__syncthreads() called inside one side of a branch
A block of 256 threads (8 warps) runs this kernel. What happens?
kernel.cu
__global__ void badBarrier(float* data) {
int tid = threadIdx.x;
if (tid < 128) {
data[tid] = data[tid] * 2.0f;
__syncthreads();
data[tid] += 1.0f;
} else {
data[tid] = data[tid] * 3.0f;
}
}13 of 46 in GPU / CUDA