top | item 41626431

(no title)

hinoki | 1 year ago

If you’re not speculatively executing, you don’t need a branch hint because you don’t need to speculate which way it goes.

Also, I don’t think executing both sides of a branch ever took off on any mainstream CPUs (unless Itanium counts). It wastes power to spend half your execution units on things that won’t be committed, why not use them on the other hyperthread instead?

discuss

order

me_me_me|1 year ago

> Also, I don’t think executing both sides of a branch ever took off on any mainstream CPUs

That part I am sure off. I will double check with a friend of mine of of curiosity, but one thing to note is that the execution units are processing branches up to the point when branch is evaluated, then the false path is dropped.

Back then the speed was trumping the power draw. I am not sure what are the priorities today.

In terms of hyperthread, i don't think you can safely execute instructions of both siblings due to possible shared cache mem clashes. But I am guessing now. Its been a while since I have been working that low level to remember the details.

zerohp|1 year ago

I don't know of any CPU that speculates both sides of a branch. I work on a CPU design team.

Modern CPUs speculate hundreds of instructions ahead, and with just a dozen branches you can have a few thousand different paths. It makes more sense to speculate down one path with very high accuracy.

bee_rider|1 year ago

I’ve always thought this would be an interesting use for a hyperthread (send it to execute both sides of an if, when the programmers knows the branch predictor is likely to not be able to know which side is right). But, never got around to coding anything like that up…

markhahn|1 year ago

the problem is that when you care (unpredictable but hot branches), there are probably too many of them to execute in parallel (use up all your speculation depth). 2^n, you know!

not to mention that you burn a lot more power.