By: Jukka Larja (roskakori2006.delete@this.gmail.com), August 27, 2022 11:38 pm
Room: Moderated Discussions
Kara (karaardalan.delete@this.gmail.com) on August 27, 2022 1:00 pm wrote:
>
> Someone said if the branch pattern is easily predicted,
> or has a clear patter, then let the hardware do it :)
>
> Bruh :) how lazy would you have to be.
>
> If it's easy, you do it. Tell the compiler where to look, use your
> avx instructions my friend, use the big juicy regs on there.
It may be easy for hardware to predict, yet hard for programmer. Personally, I write (and read) a lot of code with huge amount of branches. Often it may be more or less easy to take a single branch and note that, under certain conditions, it will go that way most of the time. Yet those certain conditions may depend on couple of previous branches (written in other files, in other classes), and that soon adds up to something not comprehensible for mere human. Hardware can be much better with series of branches.
Of course, in such cases direction of branch will depend on runtime data. If there is variation, it's unpredictable without knowing the data.
> And if the branching have chaotic directions, then let's do everyone a favor
> and not try to predict it by a perceptron algorithm of things, shall we?
There's a huge cap between "easy to manually state the common direction in code" and "(completely) chaotic".
-JLarja
>
> Someone said if the branch pattern is easily predicted,
> or has a clear patter, then let the hardware do it :)
>
> Bruh :) how lazy would you have to be.
>
> If it's easy, you do it. Tell the compiler where to look, use your
> avx instructions my friend, use the big juicy regs on there.
It may be easy for hardware to predict, yet hard for programmer. Personally, I write (and read) a lot of code with huge amount of branches. Often it may be more or less easy to take a single branch and note that, under certain conditions, it will go that way most of the time. Yet those certain conditions may depend on couple of previous branches (written in other files, in other classes), and that soon adds up to something not comprehensible for mere human. Hardware can be much better with series of branches.
Of course, in such cases direction of branch will depend on runtime data. If there is variation, it's unpredictable without knowing the data.
> And if the branching have chaotic directions, then let's do everyone a favor
> and not try to predict it by a perceptron algorithm of things, shall we?
There's a huge cap between "easy to manually state the common direction in code" and "(completely) chaotic".
-JLarja