Hacker News new | ask | show | jobs
by adrian_b 94 days ago
The article makes some serious confusions, which make its conclusions wrong.

If the vector extension of RISC-V becomes mandatory, that has several good consequences, which are mentioned in the article. However, this has nothing to do with speculation.

There are many examples of CPUs which had excessive speculation or badly implemented speculation, for instance the infamous Intel Meltdown case, which was a mistake inexcusable for beginners, much less for experienced CPU designers.

Despite this, today it is impossible to make a CPU with acceptable performance without speculative execution, even if it should always be a design target that any failed speculation should not affect any kind of state that can affect the observable behavior of the CPU.

For example, not only any conditional branches require speculative execution, to avoid stalling the execution pipeline, but also a large part of the instructions may generate various kinds of exceptions, so they must be treated as conditional jumps that are predicted to be not taken, and only when an exceptional condition occurs, all the following instructions, which have been executed speculatively, must be canceled and the exception must be handled.

The requirement for speculative execution is caused by the existence of pipelined execution, which cannot be avoided for either scalar execution or vector execution.

Vector instructions do not help at all for avoiding speculative execution. The usefulness of vector instructions is that they ensure a much higher energy efficiency than in the case when out-of-order and/or superscalar execution is used to achieve the same performance, or than in the case when the number of cores is increased to achieve the same performance.

Whenever the solution of a problem is written by the compiler or by the programmer with the help of vector instructions or matrix instructions, that is a more efficient solution than an alternative that relies on more cores or on superscalar execution or on increasing the clock frequency, but this has nothing to do with speculation.