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
- -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.
Speculation
Ignore branches and move operations above them
Conservative Techniques
Unless legality of reordering can be proven, always serialize operations
Speculative Techniques
Executes ahead based on probabilistic assumptions, and fixes the execution if speculation is wrong.
Control speculation
Removes control dependence