Wk 6 Branching Flashcards
What is the problem to be solved with branching?
We could potentially be wasting work and cycles on a branch that is never taken
What’s the best branching assumption to make on loops over large numbers? What’s another option and why doesn’t it always work?
Assume I’m not going to branch, as 90% of the time, I won’t. Won’t pay the price as often as I’ll receive the benefits for guessing correctly.
I can also send the branch data back to the stage that need it, but I’ll always be losing something and the more stages the pipeline has, the less this helps.
Branching should be avoided (rel performance) whenever possible. What is one way to eliminate a branch by replacing it with a different instruction? How do we do that in C?
conditional moves. Since they’re really an assembly thing, you can force it by moving from a move imperative to a more functional style…. See note card.
What are the High Performance Tenets summary from Lecture 3 (Bryant Chapter 5)
Good compiler and flags
Don’t do anything stupid:
- poor algorithm
- compiler friendly code
- –no optimiz blockers (proc calls, mem ref’s)
- look carefully at inner most loops
Tune code for machine
- exploit ILP
- avoid unpredictable branches
- make code cache friendly
What would an ideal data-flow machine look like?
All data is immediately computed and set to wait until the next computation needs it, its immediately available, versus the opposite where computations are waiting for data to become avail. In the real world, sometimes data is avail and sometimes not.
How does a store buffer depend affect critical paths?
Any load operation, before actually performing the load, must check and see if the data is waiting to be stored.
How could the same program have different data dependency with the same code?
a memory pointer could point to the same place and ending up with the data dependency in the assembly. If it’s only stores, though, stores never have a data dependency and can be sped up with loop unrolling.