When there's a conditional branch (i.e. if-else statement in c), the way that a masked vector program will handle that is:
The mask is set according to the specified condition, corresponding to the values in the current vector being handled. For example, assume a vector of width 4 containing values {2, -4, 3, 5}. The mask, under the condition of (x>0), will be set as {1, 0, 1, 1} indicating the result of the comparison.
Codes in the corresponding block are executed based on mask values. For example, in the case given in step 1, ALU 1, 3, 4 will execute the code in the if{} block while ALU 2 is idle. Thus in this case the utilization is 3/4. In the worst case the utilization will go down to 1/VECTOR_WIDTH. (After ALU 1, 3, 4 has finished executing the if{} block, ALU 2 will execute the else{} block and the utilization will be 1/4)
Explanation of current slide
(Under the background of masked vector program)
When there's a conditional branch (i.e. if-else statement in c), the way that a masked vector program will handle that is:
The mask is set according to the specified condition, corresponding to the values in the current vector being handled. For example, assume a vector of width 4 containing values {2, -4, 3, 5}. The mask, under the condition of (x>0), will be set as {1, 0, 1, 1} indicating the result of the comparison.
Codes in the corresponding block are executed based on mask values. For example, in the case given in step 1, ALU 1, 3, 4 will execute the code in the if{} block while ALU 2 is idle. Thus in this case the utilization is 3/4. In the worst case the utilization will go down to 1/VECTOR_WIDTH. (After ALU 1, 3, 4 has finished executing the if{} block, ALU 2 will execute the else{} block and the utilization will be 1/4)