I was wrong.
superdan
super at dan.org
Thu Aug 14 16:40:46 PDT 2008
Jb Wrote:
>
> "superdan" <super at dan.org> wrote in message
> news:g81o61$21bs$1 at digitalmars.com...
> > Jb Wrote:
> >
> >>
> >> "superdan" <super at dan.org> wrote in message
> >> news:g81e1l$18js$1 at digitalmars.com...
> >> > downs Wrote:
> >>
> >> >> Null: 729908
> >> >> Naive: 1615314
> >> >> Speculative for B: 1692860
> >> >> Speculative for B/C: 1664040
> >> >
> >> > the whole premise of speculation is it oils the common path. you have
> >> > uniform probabilities.
> >> > what you gain on speculating for B you lose in the extra test when
> >> > misspeculating on others.
> >> > so to really test speculation make B like 90% of cases and retry.
> >>
> >> To speculate localy you still have to lookup the class info, compare it
> >> to
> >> the speculated object type, and then conditionaly branch. You cant avoid
> >> a
> >> conditional branch, and as it will share the same pattern as the indirect
> >> jump, and (in most cases) the same prediction mechanism, neither will be
> >> better predicted than the other.
> >
> > no that's wrong. conditional branch is better speculated than indirect
> > jump.
> > they share no other hardware than the instruction fetching pipe.
>
> Sorry but you dont know what you are talking about. Indirect jumps get a
> slot in the branch target buffer (BTB) the same as conditional branches.
> They both share the same target prediction hardware. It's not only a fact
> it's also common sense that they would do so.
>
> http://www.agner.org/optimize/microarchitecture.pdf
>
> Read the chapter on branch prediction.
>
> http://www.intel.com/design/processor/manuals/248966.pdf
>
> Read Chapter 3.4.1.6
relax. i do know what i'm talking about eh. i didn't claim it was timely :) also it got real jumbled in my head. like i described predicated execution instead of straight branch prediction. itanium has the latter and x86 has the former. (bad decision in itanium if you ask me.) so i was talking outta my... i mean i was talking nonsense.
> > the mechanism for conditional branch speculation is that stuff is executed
> > in parallel
> > on both branches inside the pipeline. the branch that makes it is
> > committed. the other
> > is retired without getting to write to the register file or memory.
>
> Actualy AFAIK no current x86 processor *execute* both branches. What does
> happen is the instruction cache will *prefetch* both branches, so that when
> the BTB decides which way to go it has the instruction data ready.
that's right eh. i stand corrected. what i said happens on itanium.
> But it will still cost you a whole pipeline flush if the prediction was
> wrong.
>
>
> >> So the point is that you cant make the common path any faster unless you
> >> actualy *inline* the speculated method. In fact if you dont inline you
> >> are
> >> most probably making the situation worse because you are replacing
> >> this...
> >
> > you are right here tho for the wrong reasons :) yeah speculation is good
> > if there are
> > a few good chunky instructions to eat while speculating. if it's a
> > function call that in
> > turn is just a ret... the results are nothing to write home about. as it's
> > been shown.
>
> No.. erm NO... and NOOooOOOO!!!!
>
> ;-)
>
> Speculation is good if it allows you to inline the method and chop out a
> whole bunch of register shuffling, stack setup, and entry / exit code.
>
> It's got naff all to do with "having shit to do" while you're speculating.
> Just like it's got naff all to do with conditional branches being faster /
> better predicted than indirect calls.
hey hey... watch your language :) otherwise i agree.
More information about the Digitalmars-d
mailing list