4 ms·
To give ballpark numbers: modern Intel processors can retire a few instructions per cycle in tight loops (4 is the theoretical maximum; > 2 is realistic in a lo
by umanwizard 7y ago
To give ballpark numbers: modern Intel processors can retire a few instructions per cycle in tight loops (4 is the theoretical maximum; > 2 is realistic in a lot of high-performance code). A branch misprediction wastes 10-15 cycles.
So getting rid of speculation entirely, and stalling on every branch, would waste time equivalent to dozens of instructions. On typical code that has a branch every few instructions, this could slow down execution by several times.
- ccozan 7y agoCan we actually compute without branching? Genuine question. What architecture would do that, and how?
- pcwalton 7y agoOld GPUs did that. It wasn't very pleasant to program with. :)
- gmueckl 7y agoThe simplified SIMD cores in early GPUs had to fake branching to some extent for their virtual threads: every branch in the shader code would be tested for each virtual flag and that thread (really just a vector component) would be masked out for the instructions of the branch that didn't apply. The GPU would run both branches, relying on the mask. It was workable, but very slow.
- nwallin 7y agoYou can compute with less than that. (all links are to the same thing) https://github.com/xoreaxeaxeax/movfuscator https://github.com/xoreaxeaxeax/movfuscator https://m.youtube.com/watch?v=R7EEoWg6Ekk https://m.youtube.com/watch?v=R7EEoWg6Ekk https://news.ycombinator.com/item?id=18991404 https://news.ycombinator.com/item?id=18991404
- deleted 7y ago[deleted]