# SIMD Utilization

Can anyone help me understanding this exercise?

We define the SIMD utilization of a program run on a GPU as the fraction of SIMD lanes that are kept busy with active threads during the run of a program. The following code segment is run on a GPU. Each thread executes a single iteration of the shown loop. Assume that the data values of the arrays A and B are already in vector registers so there are no loads and stores in this program. (Hint: Notice that there are 2 instructions in each thread.) A warp in the GPU consists of 32 threads, there are 32 SIMD lanes in the GPU. Assume that each instruction takes the same amount of time to execute.

for (i = 0; i < N; i++) { if (A[i] % 3 == 0) { A[i] = A[i] * B[i]; } }

I know should determine whether this can yield a SIMD Utilisation of 100%. My answer would be YES.

We can achieve this if each element in array A is divisible by three. (Assume A.length is 32. Then ((32*2)/32*2))*100 = 100%)

The master solution agrees to up to this point, but it also says, that we can yield a SIMD Utilisation of 100% if all elements of array A is not divisible by three. My question would be why? My thought is: When all the elements of A is not divisible by three, then each thread would execute one instruction: (32/(32*2))*100 = 50% ?

Thank you!