Jump to content

Branch target predictor: Difference between revisions

From Wikipedia, the free encyclopedia
Content deleted Content added
m top: unreferenced to refimprove
Azl371 (talk | contribs)
m Minor edits for concision and grammar
 
(11 intermediate revisions by 9 users not shown)
Line 1: Line 1:
{{Short description|Part of a computer processor}}
{{Multiple issues|
{{refimprove|date=October 2007}}
{{refimprove|date=October 2007}}
{{Update|date=March 2017}}
{{Update|inaccurate=yes|date=March 2017}}
{{Update|inaccurate=yes|date=March 2017}}
}}
In [[computer architecture]], a '''branch target predictor''' is the part of a processor that predicts the target, i.e., the address of the instruction that is executed next, of a taken [[conditional branch]] or unconditional branch instruction before the [[jump target (computing)|target of the branch instruction]] is computed by the execution unit of the processor.


Branch target prediction is not the same as [[branch prediction]], which guesses whether a conditional branch will be taken or not-taken in a binary manner.
In [[computer architecture]], a '''branch target predictor''' is the part of a processor that predicts the target of a taken [[conditional branch]] or an unconditional branch instruction before the [[jump target (computing)|target of the branch instruction]] is computed by the execution unit of the processor.


In more [[parallel processor]] designs, as the [[instruction cache]] latency grows longer and the fetch width grows wider, branch target extraction becomes a bottleneck. The recurrence is:
Branch target prediction is not the same as [[branch prediction]] which attempts to guess whether a conditional branch will be taken or not-taken (i.e., sequential).

In more [[parallel processor]] designs, as the [[instruction cache]] latency grows longer and the fetch width grows wider, branch target extraction becomes a bottleneck. The recurrence is:


* Instruction cache fetches block of instructions
* Instruction cache fetches block of instructions
Line 32: Line 33:


== Further reading==
== Further reading==
* {{cite |title=Accurate Indirect Branch Prediction |author-last1=Driesen |author-last2=Hölzle |date=1992}}
* {{citation |title=Accurate Indirect Branch Prediction |author-last1=Driesen |author-last2=Hölzle |date=1992}}
* {{cite |title=The Behavior of Efficient Virtual Machine Interpreters on Modern Architectures |author-last1=Ertl |author-last2=Gregg |date=2001}}
* {{citation |title=The Behavior of Efficient Virtual Machine Interpreters on Modern Architectures |author-last1=Ertl |author-last2=Gregg |date=2001}}


== External links ==
== External links ==
* {{cite web |url=http://www-ee.eng.hawaii.edu/~tep/EE461/Notes/ILP/buffer.html |title=Branch Target Buffers}} (EE461)
* {{cite web |url=http://www-ee.eng.hawaii.edu/~tep/EE461/Notes/ILP/buffer.html |title=Branch Target Buffers}} (EE461)
* {{cite web |author-last=Fog |author-first=Agner |title=The microarchitecture of Intel, AMD and VIA CPUs |url=http://www.agner.org/optimize/microarchitecture.pdf |access-date=2017-08-09}}
* {{cite web |author-last=Fog |author-first=Agner|author-link=Agner Fog |title=The microarchitecture of Intel, AMD and VIA CPUs |url=http://www.agner.org/optimize/microarchitecture.pdf |access-date=2017-08-09}}

{{Comp-sci-stub}}


[[Category:Instruction processing]]
[[Category:Instruction processing]]


{{Comp-sci-stub}}

Latest revision as of 00:41, 16 October 2024

In computer architecture, a branch target predictor is the part of a processor that predicts the target, i.e., the address of the instruction that is executed next, of a taken conditional branch or unconditional branch instruction before the target of the branch instruction is computed by the execution unit of the processor.

Branch target prediction is not the same as branch prediction, which guesses whether a conditional branch will be taken or not-taken in a binary manner.

In more parallel processor designs, as the instruction cache latency grows longer and the fetch width grows wider, branch target extraction becomes a bottleneck. The recurrence is:

  • Instruction cache fetches block of instructions
  • Instructions in block are scanned to identify branches
  • First predicted taken branch is identified
  • Target of that branch is computed
  • Instruction fetch restarts at branch target

In machines where this recurrence takes two cycles, the machine loses one full cycle of fetch after every predicted taken branch. As predicted branches happen every 10 instructions or so, this can force a substantial drop in fetch bandwidth. Some machines with longer instruction cache latencies would have an even larger loss. To ameliorate the loss, some machines implement branch target prediction: given the address of a branch, they predict the target of that branch. A refinement of the idea predicts the start of a sequential run of instructions given the address of the start of the previous sequential run of instructions.

This predictor reduces the recurrence above to:

  • Hash the address of the first instruction in a run
  • Fetch the prediction for the addresses of the targets of branches in that run of instructions
  • Select the address corresponding to the branch predicted taken

As the predictor RAM can be 5–10% of the size of the instruction cache, the fetch happens much faster than the instruction cache fetch, and so this recurrence is much faster. If it were not fast enough, it could be parallelized, by predicting target addresses of target branches.

See also

[edit]

Further reading

[edit]
  • Driesen; Hölzle (1992), Accurate Indirect Branch Prediction
  • Ertl; Gregg (2001), The Behavior of Efficient Virtual Machine Interpreters on Modern Architectures
[edit]