News for hackers. Stuff that matters.
Re:Mispredicted branches can multiply your running times by ThePadawan on Wednesday October 16, 2019 @06:35AM (#21268906)
Not a computer engineer either, but I did do some GPGPU in college (~6 years ago).

Notably, branching on a flag f on the GPU was so slow that most of the time it was faster to (manually) compute both branches b1 and b2 and then calculate the result as r = f * b1 + (1-f) * b2 (where f is either 0 or 1).

Re:Mispredicted branches can multiply your running times by vardump on Wednesday October 16, 2019 @06:09PM (#21276498)
Just like you can do on x86/ARM SIMD. It often pays to compute both sides and mask out the undesired results.
Re:Mispredicted branches can multiply your running times by hellofunk on Wednesday October 16, 2019 @01:02PM (#21272668)
This is pretty awesome.
Re:Mispredicted branches can multiply your running times by sv_h1b on Wednesday October 16, 2019 @01:46PM (#21273141)
GPUs are designed to do massive parallel computations which all branch one way and don't have much (any?) branch prediction logic.

You trade it off with increased code size which might spill the cache but for small tight loops not exceeding the cache line/ size it would still be a good win.

Re:Mispredicted branches can multiply your running times by ScottFree on Wednesday October 16, 2019 @04:23PM (#21275089)
Would there be any benefit to adding branch prediction logic to a GPU?
Re:Mispredicted branches can multiply your running times by rdc12 on Wednesday October 16, 2019 @05:53PM (#21276312)
You would probably get some benefit on a per CUDA core basis, but the extra space required would mean less CUDA cores, overall it would probably be a net loss on problems well suited to GPU acceleration