On Thursday, April 6, 2023 at 10:52:46 AM UTC-5, Quadibloc wrote:
> Branches are bad!
>
> This is why many ISAs which intend to achieve high performance
> include the option of changing the flow of execution through
> predicated instructions.
>
> But that doesn't seem to be an ideal solution, because the instructions
> that aren't executed still at least get fetched from memory, and likely
> are processed in some other ways as well.
>
> Why are branches bad?
>
> Essentially, it's because they cause pipeline flushes - the computer
> reads ahead in the code, perhaps assuming that any conditional
> branches aren't taken, or using sophisticated branch prediction logic,
> so that it's only a branch if it guesses wrong... and now the results
> from reading ahead are all useless.
<
Predication accepts reading the instructions not executed in order
to avoid disrupting the front-end. In other words, If the front-end will
fetch the first instruction at the convergence point by the time the
branch in the then clause would execute, then predication has saved
you the pipeline flush !! Pipeline flushes are expensive in power and
sometimes in cycles.
>
> Hmm. Perhaps my idea won''t solve this problem.
>
> I was thinking that perhaps one could use a pair of instructions -
>
> BLBB, ELBB - begin local branch block, end local branch block
>
> which, like Mitch's VVM instructions, delimit code which otherwise
> isn't modified. What it directs is that the block of code be given priority
> to be saved in the micro-op cache because it contains lots of little
> local branches to carry out some complicated logic.
<
That is too many instructions. My 66000 Predication uses 1 PRED
instruction to describe the then-clause extent and the else-clause
extent and by implication the sum of then and else clauses which
is the convergence point. And does this in 1 instruction. Anytime
a predicated instruction sequence has both a then-clause and an
else clause, you have saved 1 branch instruction.