Out of Order Pipelines (Control) Flashcards

1
Q

What 3 factors do speculative execution consist of?

A
  1. Target prediction
  2. Condition prediction (i.e. taken or not taken)
  3. Validation and recovery
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What does a Branch Target Buffer do?

A

Stores the target addresses of previously taken branches/jumps

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

How does a branch target buffer work?

A
  1. An entry is added to the BTB when a branch/jump is first taken
  2. For subsequent branches/jumps, the entry is used early in the pipeline to fetch the predicted path
  3. Branch/jump is resolved in the EXECUTE stage to verify target and update entry
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What is the drawback of target prediction using a branch target buffer?

A

Indirect jumps - the same jump instruction can have multiple targets which leads to mispredictions

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Explain the Return Address Stack (RAS).

A

The RAS is used to store return addresses from jalr instructions, which are in itself used in function calls. When we reach a function call, push the return address on the stack. If we have a function return, pop the return address from the stack

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Describe a drawback of the RAS

A

Mispredicted calls or returns could potentially corrupt the RAS

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

How do we integrate RAS with checkpointing?

A

The RAS top-of-stack-pointer and top-of-stack-content can be added to the branch checkpoint structure

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

What is a target cache (TC) with reference to target prediction?

A

A target cache (TC) is a separate branch target buffer used for indirect jumps. It remembers multiple targets per jr instruction.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

How does a target cache (with reference to target prediction) work?

A

The target cache remembers multiple targets per jr instruction. It uses the branch target history to distinguish between likely targets. A Target History Register (THR) shifts in the low-order bits of the last n jump targets. The THR contents is then XOR’d with the PC. The lower bits of the result of the XOR is used to index the TC with the upper bits acting as the tag

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

List 2 static methods for condition prediction.

A
  1. Predict taken if pc-relative offset is negative (since it might be the bottom of a loop); predict not-taken otherwise
  2. Compiler inserts hint into instruction (maybe in the form of a bit)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

What binary values represent strongly not taken, weakly not taken, weakly taken and strongly taken in the pattern history table?

A

00, 01, 10, 11

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

If I have a pattern history as follows:
1110 1110 1110…
where 1 indicates taken and 0 indicates not-taken, what will be the 2-bit value stored in the
a. 7th index
b. 11th index
c. 14th index
Assume it has already “warmed up” (run enough times to stabilize and not change)

A

a. 00
b. 11
c. 11
Explanation: 7 = 4’b0111. We have a 0 after the 3 1’s so we predict SNT = 00

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

List 2 drawbacks of local predictors.
(Hint: Local predictors store the result of the last n iterations of a branch condition)

A
  1. Aliasing can occur based on low-order PC bits
  2. Aliasing can occur based on same history patterns
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

What are global branch predictors and how do they differ from local predictors?

A

Global predictors detect correlated branch behavior (behavior influenced by other branch decisions). They save the last n branch decisions (of any branch instr) which differs from local predictors since those are PC specific

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

What is the “history table” equivalent in a global branch predictor?

A

Global history register

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

What is gShare?

A

A prediction concept that XOR’s the global history register value (GR) and the PC to index the pattern history table

17
Q

In a perception predictor, state the equation that dictates the prediction (y) and takes into account weights of the inputs.

A

y = w_0 + sum(x_i * w_i)
where x_i is the history bit i from GR

18
Q

What is the purpose of w_0 in the perception prediction equation?

A

Used for strongly biased branches that are not correlated to the prior branches