Lesson 6--Branches Flashcards
Types of branches
- -Unconditional (ends of loops, etc.)
- -Indirect (indirect jumps, case statements, etc.)
- -Conditional (if then else, loops, etc.)
- -Function (function calls)
How to mitigate branch delays
Speculation: Predicting branches, executing in anticipation.
Predication: Removing branches, converting code into one that depends on outcome of a condition for a commit.
3 Components of a branch
- -Whether to take the branch
- -Where to go
- -When to go
Two Step Branching
- -separates comparison(whether) from branch instructions(where/when)
- -Store the comparison results in branch/condition registers
- -Delay can be filled with useful operation between compare and branch
Three Step Branching
- -Decouple the address computation from the branch
- -Branch target register stores the results of the target address and comparison
- -The compiler can move the compare and offset computations in any order
True or False: Unbundling increases code size.
True: 2 step leads to 14% code growth. 3 step leads to 28% growth.
True or False: In a VLIW architecture with unbundled branches, the branch targets must be computed once for all clusters
False. The branch will be executed in one cluster, not all.
True or False: The branch condition is computed in one cluster and broadcast to all other clusters
True
True or False: If the branch condition is taken, each cluster transfers control to one branch target.
False. Clusters only need to be notified of which branch is taken, but they do not affect control of other clusters.
True or False: All branch targets correspond to the same logical block
True.
Describe conservative techniques used in speculation
Unless legality of reordering can be proven, always serialize operations
Speculation
Executes branch ahead based on probabilistic assumptions, and fixes the execution if speculation is wrong.
Control speculation
Removes control dependence
How many additional instructions are generated for 2 step branching
1
How many additional instructions are generated for 3 step branching
2