This email thread is driving me nuts because so much of it is wrong.

*Speculative execution has nothing to do with caching.*  Caching is about
keeping often used data as close to the CPU execution unit as possible so
that the CPU execution unit doesn't stall for lack of data.  But the cache
is clearly outside of the execution unit.

Some CPUs will speculatively prefetch memory through the cache when they
predict that memory will be in use soon.  For example, if you are running
through a program in a straight line loading the next 32 or 128 bytes of
memory ahead of time is a no brainer.  Of if you are operating on a large
data structure the cache subsystem might even decide to start loading
sequential memory by itself.  But that has nothing to do with the
speculative execution inside of a CPU execution unit.


*Pipelining in a CPU is not a form of speculative execution.*  Pipelining
is a method of introducing parallelism in a CPU's execution unit.  Instead
of having large functional blocks of logic that run at relatively slow
clock speed you break those up into smaller units, allowing each of them to
do less work and complete their task more quickly.  And that partial work
gets passed to the next unit of the pipeline.

Pipelining was essential for enabling higher clock speeds on chips.  There
is nothing speculative about pipelining by itself.

Branch prediction is what I think you are referring to.  The CPU can
monitor individual branch behavior and make a good guess about what the
branch instruction will do the next time it is seen.  When combined with
pipelining it allows the pipeline to stay full when it sees a branch
instead of just pausing (stalling) and waiting to see the outcome of the
branch.  If the CPU predicts incorrectly then the partial results in the
pipeline have to be purged and started again.  That is mildly speculative,
but the speculative part is due to the branch prediction, not the
pipelining.


*The prefetch instruction queue that you refer to on the 8088 is a part of
every CPU architecture, and it was not replaced by a cache on the Pentium.*
Every CPU needs to have a functional part that fetches the next instruction
and feeds it to the next step of the execution pipeline.  The memory
subsystem (often a cache being the first thing the CPU interfaces with) is
entirely different.


-Mike
_______________________________________________
Freedos-devel mailing list
Freedos-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/freedos-devel

Reply via email to