15.01.2013 Views

U. Glaeser

U. Glaeser

U. Glaeser

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Structural mispredictions, on the other hand, stem from properties of the predictor’s hardware organization.<br />

The major structural sources of mispredictions are described below and come from [37].<br />

Destructive PHT and BHT Conflicts<br />

All predictors that track state can suffer when unrelated branches map to the same predictor entry and<br />

interfere with each others’ state. In the predictor’s PHT or in a hybrid predictor’s selector PHT, destructive<br />

conflicts arise when branches map to the same 2-bit PHT counter and these branches go in opposite<br />

directions. In the BHT of a local-history predictor, destructive conflicts arise when branches map to<br />

the same history entry and hence the history of one branch displaces that of another branch. Note that<br />

constructive conflicts can also occur in all these structures when—for reasons of either luck or correlated<br />

behavior—the state of one branch causes a correct prediction by other branches. This means the expected<br />

gain from eliminating conflicts would eliminate both destructive and constructive conflicts, but the<br />

destructive behavior usually outweighs the constructive behavior.<br />

Training Time<br />

Because dynamic predictors work by recognizing patterns of branch behavior, they take time to train.<br />

The training time comes from two sources. First, the predictor must see enough branches to observe any<br />

patterns that exist. Second, the predictor must reach steady state. Consider the simple pattern TN,TN…<br />

in a 6-bit history. After this branch has been seen twice, the history will contain xxxxTN, where “x”<br />

signifies that these history bits contain a random value. Unless by sheer luck the bits in the “xxxx” portion<br />

happen to be TNTN, this pattern is a transient that will not be seen again. This branch must therefore<br />

be seen four more times before the history is fully initialized. In addition, for both types of training, a<br />

pattern must be seen often enough not only to initialize the branch history, but also to put the corresponding<br />

counters in the PHT into the proper state. In the TN,TN…example and assuming two-bit<br />

counters in the PHT, this means that the history TNTNTN must be seen twice in order to ensure that<br />

the two-bit counter has crossed the threshold. (The counter’s initial value might have been 00, but the<br />

correct prediction is T.) The larger the saturating counters, the longer this component of the training time.<br />

The predictor must train not only when a program first starts executing, but must also retrain after<br />

every context switch and also when the program’s behavior changes, either because it enters a new phase,<br />

or the nature of its input changes, etc.<br />

“Wrong” Type of History<br />

Mispredictions can also occur because the predictor does not track the most useful type of history—global<br />

or local—for the branch in question. This has been called wrong history, even though it does not imply<br />

that the actual history bits contain any invalid information. Unfortunately, most programs have some<br />

branches that do well with global history and some branches that do well with local history. A predictor<br />

that only tracks one or the other type of history therefore penalizes some branches in each program.<br />

Evers et al. showed this to be important in [34]. Skadron, Martonosi, and Clark [37] found wrong-history<br />

mispredictions are especially severe in global-history predictors, comprising 35–50% of the total misprediction<br />

rate.<br />

History Length<br />

Mispredictions might also arise even if the predictor tracks the correct type of history but it uses too<br />

short a history. For example, a history length of only two bits may not capture the full behavior of a<br />

pattern longer than 2 bits. Consider the pattern TNNN,TNNN.... A two-bit local history will learn that<br />

TN → N and this is always correct. But the problem arises for the pattern NN. The predictor will first<br />

learn NN → N, but on the fifth occurrence of the branch, this will cause a misprediction. On the other<br />

hand, there exist longer patterns for which short history is still sufficient. Consider two bits of history<br />

and the pattern TNNTT,TNNTT…. Although the overall pattern is longer than 2 bits, none of the distinct<br />

sub-patterns (TN, NT, and TT) are longer than two bits.<br />

Alternatively, the history can also be too long. The problem here is that the history may contain many<br />

bits that are entirely uncorrelated with the behavior of the branch to be predicted. This means that every<br />

© 2002 by CRC Press LLC

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!