[Cryptography] RISC-V branch predicting

Nemo nemo at self-evident.org
Wed Feb 7 12:43:04 EST 2018


Arnold Reinhold <agr at me.com> writes:

> In most cases the programmer knows which way branches are
> likely to go, optimizing compilers can make good guesses and profiling
> tools should be very effective if given realistic data.

Wrong on every count. For example:

    https://stackoverflow.com/q/11227809/

Granted, that is just a 20K-upvote StackOverflow question. But it is
extremely common for branch patterns not to determined until
runtime. Also note that the performance delta in this example is 6x.

Polymorphic method invocations (e.g. C++ "virtual functions") are
similar. Where it is possible for the compiler to make a determination
("de-virtualization") or a good guess about the target, they already do
so. But it is still very common for patterns to exist only at runtime.

Eliminating speculative execution would be a disaster for
performance. It would also be stupid, because the real problem is not
speculation per se, but covert channels between privilege domains
(e.g. cache timing attacks).

 - Nemo
   https://self-evident.org/


More information about the cryptography mailing list