The Subconscious Mind of a Branch Predictorcseweb.ucsd.edu/~swanson/WACI-VI/docs/01_slides.pdf ·...

14
The Subconscious Mind of a Branch Predictor Daniel A. Jiménez Departments of Computer Science The University of Texas at San Antonio and Rutgers, The State University of New Jersey

Transcript of The Subconscious Mind of a Branch Predictorcseweb.ucsd.edu/~swanson/WACI-VI/docs/01_slides.pdf ·...

Page 1: The Subconscious Mind of a Branch Predictorcseweb.ucsd.edu/~swanson/WACI-VI/docs/01_slides.pdf · 2008. 3. 14. · The Subconscious Mind of a Branch Predictor Daniel A. Jiménez Departments

The Subconscious Mind of a Branch Predictor

Daniel A. Jiménez

Departments of Computer ScienceThe University of Texas at San Antonio

andRutgers, The State University of New Jersey

Page 2: The Subconscious Mind of a Branch Predictorcseweb.ucsd.edu/~swanson/WACI-VI/docs/01_slides.pdf · 2008. 3. 14. · The Subconscious Mind of a Branch Predictor Daniel A. Jiménez Departments

2

Branch Prediction

Instruction fetchInstruction decodeExecuteMemory accessWrite back

A branch predictor allows the processor to speculatively fetch and execute instructions down the predicted path.

Speculative execution

Page 3: The Subconscious Mind of a Branch Predictorcseweb.ucsd.edu/~swanson/WACI-VI/docs/01_slides.pdf · 2008. 3. 14. · The Subconscious Mind of a Branch Predictor Daniel A. Jiménez Departments

3

Branch Predictor Dreams

◆ In bed at night, a branch predictor has dreams

◆ Rather than accepting external input, the branch predictor 

dreams that all of its predictions are correct

◆ This talk illustrates a few branch predictor dreams with a 

somewhat surprising result

Page 4: The Subconscious Mind of a Branch Predictorcseweb.ucsd.edu/~swanson/WACI-VI/docs/01_slides.pdf · 2008. 3. 14. · The Subconscious Mind of a Branch Predictor Daniel A. Jiménez Departments

4

Methodology

◆ Used traces from the 403.gcc benchmark on x86

◆ Simulated a wide variety of conditional branch predictors

◆ Simulated a perfect branch target buffer

◆ Run the benchmark a random number of branches, then begin 

recording a “dream” for 64K predictions where the branch 

predictor believes all of its predictions

Page 5: The Subconscious Mind of a Branch Predictorcseweb.ucsd.edu/~swanson/WACI-VI/docs/01_slides.pdf · 2008. 3. 14. · The Subconscious Mind of a Branch Predictor Daniel A. Jiménez Departments

5

Observations

◆ Dreams have two phases:◆ A prelude of apparently random behavior

◆ A period that repeats a cycle over and over

◆ You might think that the lengths of the period and prelude 

would be correlated with the accuracy of the predictor◆ Not so much

Page 6: The Subconscious Mind of a Branch Predictorcseweb.ucsd.edu/~swanson/WACI-VI/docs/01_slides.pdf · 2008. 3. 14. · The Subconscious Mind of a Branch Predictor Daniel A. Jiménez Departments

6

Prelude and Period Lengths

Ordered from least to most accurate

Page 7: The Subconscious Mind of a Branch Predictorcseweb.ucsd.edu/~swanson/WACI-VI/docs/01_slides.pdf · 2008. 3. 14. · The Subconscious Mind of a Branch Predictor Daniel A. Jiménez Departments

7

Dreamscapes

◆ Using the graph visualization tool VCG we can see the shapes of the control­flow graphs induced by branch predictor dreams

◆ The graphs have been compressed a bit to make them easier to draw – see me after the talk to find out how if you’re really interested

◆ For each predictor, the most interesting dreamscapes are shown

Page 8: The Subconscious Mind of a Branch Predictorcseweb.ucsd.edu/~swanson/WACI-VI/docs/01_slides.pdf · 2008. 3. 14. · The Subconscious Mind of a Branch Predictor Daniel A. Jiménez Departments

8

BiMode Predictor Dream

Page 9: The Subconscious Mind of a Branch Predictorcseweb.ucsd.edu/~swanson/WACI-VI/docs/01_slides.pdf · 2008. 3. 14. · The Subconscious Mind of a Branch Predictor Daniel A. Jiménez Departments

9

Piecewise Linear Branch Predictor Dream

Page 10: The Subconscious Mind of a Branch Predictorcseweb.ucsd.edu/~swanson/WACI-VI/docs/01_slides.pdf · 2008. 3. 14. · The Subconscious Mind of a Branch Predictor Daniel A. Jiménez Departments

10

L­TAGE Predictor Dream

Page 11: The Subconscious Mind of a Branch Predictorcseweb.ucsd.edu/~swanson/WACI-VI/docs/01_slides.pdf · 2008. 3. 14. · The Subconscious Mind of a Branch Predictor Daniel A. Jiménez Departments

11

BiMode Nightmare

In a “nightmare,” all the predictions are wrong

Page 12: The Subconscious Mind of a Branch Predictorcseweb.ucsd.edu/~swanson/WACI-VI/docs/01_slides.pdf · 2008. 3. 14. · The Subconscious Mind of a Branch Predictor Daniel A. Jiménez Departments

12

Actual Control Flow Graph

Page 13: The Subconscious Mind of a Branch Predictorcseweb.ucsd.edu/~swanson/WACI-VI/docs/01_slides.pdf · 2008. 3. 14. · The Subconscious Mind of a Branch Predictor Daniel A. Jiménez Departments

13

Questions

◆ What can we learn from this?

◆ Can predictors learn something by dreaming in idle periods?

◆ Why do PLBP and L­TAGE, two very accurate predictors, 

dream so differently?

◆ Why does BiMode, not particularly accurate, have the most 

interesting dreams?

Page 14: The Subconscious Mind of a Branch Predictorcseweb.ucsd.edu/~swanson/WACI-VI/docs/01_slides.pdf · 2008. 3. 14. · The Subconscious Mind of a Branch Predictor Daniel A. Jiménez Departments

14

The End