4 ms·
GPU threads aren't "threads" as you know them on a CPU. They aren't independent units of execution with their own control flow. Each instruction decoder in the
by c4mpute 3y ago
GPU threads aren't "threads" as you know them on a CPU. They aren't independent units of execution with their own control flow. Each instruction decoder in the GPU feeds a few hundred execution units, each addressing and fetch unit feeds a few hundred execution units. So if suddenly one of those hundreds of execution units takes a different branch, that control flow will have to be executed in sequence, before or after the control flows that didn't branch. This means that all the other execution units will be flushed, stay idle, and wait while the few instruction decoder and fetch units will process that one different branch. So a branch penalty won't be just a few cycles, as in a CPU, but a few thousand cycles times a few hundred execution units. Plus an additional memory fetch latency because GPU memory also isn't really designed for random access patterns.