From: David Alan Gilbert <dg@cogency.co.uk>
Subject: Re: Seasons Greetings from a new platform :-)
Date: Tue, 16 Dec 1997 15:39:15 +0000 [thread overview]
Message-ID: <277617ec9099ebd35c7fce93ed0ec880.axp-list@archive.invalid> (raw)
Przemek Klosowski wrote:
> However, when there is a branch or a conditional operation,
> i.e. instruction N+1 executes differently based on the result of
> instruction N, this pipeline has to stop and wait for the result of
> N. Since on average there is a branch/conditional every 10 or so
> instructions, a simple pipeline might be stalled 10-20% of the time.
>
> Speculative execution means that the CPU executes code for either
> outcome for the test, but stores the results in temporary hidden
> registers, keeping track of what data comes from such speculation.
> When the actual predicate becomes known, the CPU picks up the data
> calculated for the correct value of the predicate, and discards the
> alternative computation.
No - you don't have to execute both possibilities to qualify for saying a
processor does speculative execution - and I doubt that the 21264 does
do both possibilities.
All that speculative execution means is executing an instruction
when your not sure if its going to execute or not. So consider
a little loop:
set x 1000
loop
some-work
decr x <- I mean x=x-1
if x>0 goback to loop
something-else
When we get to the 'if' we could stop there and
wait for the decrement to finish and then go back to the loop.
But thats slow.
With speculative execution we make a guess; in this case 'hmm
a backward branch - thats probably a loop, lets guess thats done'.
So we make a note of the current state (not quite..) and start executing
some-work. If the branch happened thats fine, we don't do anything else.
If the branch didn't happen then we restore the state from the note
we made and then carry on at something else. (The not quite is
the fact that we have to include the state of the not finished
stuff before the branch).
Now this is fairly efficient - if we are good at guessing we rarely
throw any work away - although we do need that hardware to hold
the state just in case we are wrong.
If we're desperate for more speed we go and execute both sides - so
we always execute some-work and something-else and then choose the
appropriate result. But thats hopelessly unefficent - you waste
50% of your work. OK if your desperate for all out speed - but its
complex, and its a waste of 50% of your work. This is still a form
of speculative execution - but its a more aggressive one.
So how does the superscalar help - well say the loop bodies were REALLY
simple; you could execute an instruction of one loop on one functional
unit and an instruction of the next loop on another functuional unit.
So we might be able to do the some-work on one functiuonal unit
while doing the decr of the previous loop on another functional
unit (probably while working out the branch at the same time).
If the loop bodies are interdependent then you still have to wait
for results - so in the example above you couldn't run two decr's
in parallel because one needs the result of the other
With superscalar you really need some speculative execution otherwise
you wait around for branches most of the time and never actually
have any instructions to feed your functional units with.
If your a good guesser then you can keep two (on a good day) of your
4 functional units busy. The art is in getting the compiler to generate
code which is organised so that it can keep as many functional
units on the run as possible.
So are there any dhrystone figures for the 21264 yet? (and I thought
it was going to be clocked faster?).
Dave
--
----------------------------------------------------------------------
- David Alan Gilbert - WARNING! This is a beta release .signature -
- Work: dg @ cogency.co.uk - 0161-428-9444 -
- Home: gro.gilbert @ treblig.org - -
----------------------------------------------------------------------
--
To unsubscribe: send e-mail to axp-list-request@redhat.com with
'unsubscribe' as the subject. Do not send it to axp-list@redhat.com
next reply other threads:[~1997-12-16 15:39 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
1997-12-16 15:39 David Alan Gilbert [this message]
-- strict thread matches above, loose matches on Subject: below --
1997-12-16 14:40 Seasons Greetings from a new platform :-) Przemek Klosowski
[not found] <3496A0A3.31D6AF8D@cogency.co.uk>
1997-12-16 8:32 ` Jay.Estabrook
[not found] <199712151341.IAA18985@clove.com>
1997-12-15 22:33 ` Tom Linden
1997-12-15 13:41 Mike Howard
[not found] <3491223D.C87F9F77@voicenet.com>
1997-12-12 19:50 ` Richard Henderson
1997-12-12 15:36 Toon Moene
1997-12-12 11:50 ` Jay.Estabrook
1997-12-12 12:06 Dave Gilbert
1997-12-12 11:55 A.Arnold
1997-12-12 11:38 Uncle George
1997-12-12 9:27 Stefan Schroepfer
[not found] <349128C9.5DF646C5@treblig.org>
1997-12-12 9:17 ` Jay.Estabrook
1997-12-13 4:38 ` George
1997-12-12 9:15 Dave Gilbert
1997-12-12 7:38 warp
[not found] <3490B5A9.2F1C@agapesystems.com>
1997-12-12 6:07 ` Ross A. Knepper
1997-12-12 3:55 Paul Anderson
[not found] <199712112254.RAA12058@linux03.amt.tay1.dec.com>
1997-12-11 22:06 ` Chris Price
1997-12-12 2:10 ` Christopher F. Miller
1997-12-13 1:50 ` Jakob 'Sparky' Kaivo - MCP
1997-12-11 12:54 Jay.Estabrook
read-only archive
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox