Why the if-else statement (in GPU code) will cut performance by half

I read this article:

FPGA or GPU? - Evolution continues

And someone added a comment in which he wrote:

Since GPUs are SIMDs, any code with an if-else statement will halve your performance. Half of the kernels will execute the if part while half of the kernels are in standby mode, and then the other half of the kernel will perform else calculations, while the first half of the kernels will be idle.

I do not understand why?

Why use a GPU (ie OpenCL) when using if-elseperformance will be reduced by half?

+4
source share
1 answer

, . (, if, - ). " ", , , .
, , warp (NVIDIA) wavefront (AMD) " ". ( NVIDIA 32, AMD 64 .)

, if-else, - 50% - . : n , 1/n ( warp/wafefront ). , ​​ if-else ( switch).

, , , , , warp/wafefront. /​​ / /..., .

Tl; DR: , , /, , , .

+10

Source: https://habr.com/ru/post/1683887/


All Articles