Wk 6 Branching Flashcards

1
Q

What is the problem to be solved with branching?

A

We could potentially be wasting work and cycles on a branch that is never taken

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

What’s the best branching assumption to make on loops over large numbers? What’s another option and why doesn’t it always work?

A

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.

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

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?

A

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.

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

What are the High Performance Tenets summary from Lecture 3 (Bryant Chapter 5)

A

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
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What would an ideal data-flow machine look like?

A

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 well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

How does a store buffer depend affect critical paths?

A

Any load operation, before actually performing the load, must check and see if the data is waiting to be stored.

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

How could the same program have different data dependency with the same code?

A

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.

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