Analysis of branch misses in Quicksort

Click here to load reader

  • date post

    21-Jul-2015
  • Category

    Science

  • view

    46
  • download

    1

Embed Size (px)

Transcript of Analysis of branch misses in Quicksort

  • Analysis of Branch Misses in Quicksort

    Sebastian Wildwild@cs.uni-kl.de

    based on joint work with Conrado Martnez and Markus E. Nebel

    04 January 2015

    Meeting on Analytic Algorithmics and Combinatorics

    Sebastian Wild Branch Misses in Quicksort 2015-01-04 1 / 15

  • Instruction Pipelines

    Computers do not executeinstructions fully sequentially

    Instead they use an assembly line

    Example:

    424344454647

    41

    48

    ...i := i + 1a := A[i]IF a < p GOTO 42j := j - 1a := A[j]IF a > p GOTO 45

    ...

    each instruction broken in 4 stages

    simpler steps shorter CPU cycles

    one instruction per cycle finished . . .

    . . . except for branches!

    1 undo wrong instructions2 fill pipeline anew

    Pipeline stalls are costly . . . can we avoid (some of) them?

    Sebastian Wild Branch Misses in Quicksort 2015-01-04 2 / 15

  • Instruction Pipelines

    Computers do not executeinstructions fully sequentially

    Instead they use an assembly line

    Example:

    424344454647

    41

    48

    ...i := i + 1a := A[i]IF a < p GOTO 42j := j - 1a := A[j]IF a > p GOTO 45

    ...

    each instruction broken in 4 stages

    simpler steps shorter CPU cycles

    one instruction per cycle finished . . .

    . . . except for branches!

    1 undo wrong instructions2 fill pipeline anew

    Pipeline stalls are costly . . . can we avoid (some of) them?

    Sebastian Wild Branch Misses in Quicksort 2015-01-04 2 / 15

  • Instruction Pipelines

    Computers do not executeinstructions fully sequentially

    Instead they use an assembly line

    Example:

    424344454647

    41

    48

    ...i := i + 1a := A[i]IF a < p GOTO 42j := j - 1a := A[j]IF a > p GOTO 45

    ...

    each instruction broken in 4 stages

    simpler steps shorter CPU cycles

    one instruction per cycle finished . . .

    . . . except for branches!

    1 undo wrong instructions2 fill pipeline anew

    Pipeline stalls are costly . . . can we avoid (some of) them?

    Sebastian Wild Branch Misses in Quicksort 2015-01-04 2 / 15

  • Instruction Pipelines

    Computers do not executeinstructions fully sequentially

    Instead they use an assembly line

    Example:

    424344454647

    41

    48

    ...i := i + 1a := A[i]IF a < p GOTO 42j := j - 1a := A[j]IF a > p GOTO 45

    ...

    each instruction broken in 4 stages

    simpler steps shorter CPU cycles

    one instruction per cycle finished . . .

    . . . except for branches!

    1 undo wrong instructions2 fill pipeline anew

    Pipeline stalls are costly . . . can we avoid (some of) them?

    Sebastian Wild Branch Misses in Quicksort 2015-01-04 2 / 15

  • Instruction Pipelines

    Computers do not executeinstructions fully sequentially

    Instead they use an assembly line

    Example:

    424344454647

    41

    48

    ...i := i + 1a := A[i]IF a < p GOTO 42j := j - 1a := A[j]IF a > p GOTO 45

    ...

    each instruction broken in 4 stages

    simpler steps shorter CPU cycles

    one instruction per cycle finished . . .

    . . . except for branches!

    1 undo wrong instructions2 fill pipeline anew

    Pipeline stalls are costly . . . can we avoid (some of) them?

    Sebastian Wild Branch Misses in Quicksort 2015-01-04 2 / 15

  • Instruction Pipelines

    Computers do not executeinstructions fully sequentially

    Instead they use an assembly line

    Example:

    424344454647

    41

    48

    ...i := i + 1a := A[i]IF a < p GOTO 42j := j - 1a := A[j]IF a > p GOTO 45

    ...

    each instruction broken in 4 stages

    simpler steps shorter CPU cycles

    one instruction per cycle finished . . .

    . . . except for branches!

    1 undo wrong instructions2 fill pipeline anew

    Pipeline stalls are costly . . . can we avoid (some of) them?

    Sebastian Wild Branch Misses in Quicksort 2015-01-04 2 / 15

  • Instruction Pipelines

    Computers do not executeinstructions fully sequentially

    Instead they use an assembly line

    Example:

    424344454647

    41

    48

    ...i := i + 1a := A[i]IF a < p GOTO 42j := j - 1a := A[j]IF a > p GOTO 45

    ...

    each instruction broken in 4 stages

    simpler steps shorter CPU cycles

    one instruction per cycle finished . . .

    . . . except for branches!

    1 undo wrong instructions2 fill pipeline anew

    Pipeline stalls are costly . . . can we avoid (some of) them?

    Sebastian Wild Branch Misses in Quicksort 2015-01-04 2 / 15

  • Instruction Pipelines

    Computers do not executeinstructions fully sequentially

    Instead they use an assembly line

    Example:

    424344454647

    41

    48

    ...i := i + 1a := A[i]IF a < p GOTO 42j := j - 1a := A[j]IF a > p GOTO 45

    ...

    each instruction broken in 4 stages

    simpler steps shorter CPU cycles

    one instruction per cycle finished . . .

    . . . except for branches!

    1 undo wrong instructions2 fill pipeline anew

    Pipeline stalls are costly . . . can we avoid (some of) them?

    Sebastian Wild Branch Misses in Quicksort 2015-01-04 2 / 15

  • Instruction Pipelines

    Computers do not executeinstructions fully sequentially

    Instead they use an assembly line

    Example:

    424344454647

    41

    48

    ...i := i + 1a := A[i]IF a < p GOTO 42j := j - 1a := A[j]IF a > p GOTO 45

    ...

    each instruction broken in 4 stages

    simpler steps shorter CPU cycles

    one instruction per cycle finished . . .

    . . . except for branches!

    1 undo wrong instructions2 fill pipeline anew

    Pipeline stalls are costly . . . can we avoid (some of) them?

    Sebastian Wild Branch Misses in Quicksort 2015-01-04 2 / 15

  • Instruction Pipelines

    Computers do not executeinstructions fully sequentially

    Instead they use an assembly line

    Example:

    424344454647

    41

    48

    ...i := i + 1a := A[i]IF a < p GOTO 42j := j - 1a := A[j]IF a > p GOTO 45

    ...

    each instruction broken in 4 stages

    simpler steps shorter CPU cycles

    one instruction per cycle finished . . .

    . . . except for branches!

    1 undo wrong instructions2 fill pipeline anew

    Pipeline stalls are costly . . . can we avoid (some of) them?

    Sebastian Wild Branch Misses in Quicksort 2015-01-04 2 / 15

  • Instruction Pipelines

    Computers do not executeinstructions fully sequentially

    Instead they use an assembly line

    Example:

    424344454647

    41

    48

    ...i := i + 1a := A[i]IF a < p GOTO 42j := j - 1a := A[j]IF a > p GOTO 45

    ...

    each instruction broken in 4 stages

    simpler steps shorter CPU cycles

    one instruction per cycle finished . . .

    . . . except for branches!

    1 undo wrong instructions2 fill pipeline anew

    Pipeline stalls are costly . . . can we avoid (some of) them?

    Sebastian Wild Branch Misses in Quicksort 2015-01-04 2 / 15

  • Instruction Pipelines

    Computers do not executeinstructions fully sequentially

    Instead they use an assembly line

    Example:

    424344454647

    41

    48

    ...i := i + 1a := A[i]IF a < p GOTO 42j := j - 1a := A[j]IF a > p GOTO 45

    ...

    each instruction broken in 4 stages

    simpler steps shorter CPU cycles

    one instruction per cycle finished . . .

    . . . except for branches!

    1 undo wrong instructions2 fill pipeline anew

    Pipeline stalls are costly . . . can we avoid (some of) them?

    Sebastian Wild Branch Misses in Quicksort 2015-01-04 2 / 15

  • Instruction Pipelines

    Computers do not executeinstructions fully sequentially

    Instead they use an assembly line

    Example:

    424344454647

    41

    48

    ...i := i + 1a := A[i]IF a < p GOTO 42j := j - 1a := A[j]IF a > p GOTO 45

    ...

    each instruction broken in 4 stages

    simpler steps shorter CPU cycles

    one instruction per cycle finished . . .

    . . . except for branches!

    1 undo wrong instructions2 fill pipeline anew

    Pipeline stalls are costly . . . can we avoid (some of) them?

    Sebastian Wild Branch Misses in Quicksort 2015-01-04 2 / 15

  • Instruction Pipelines

    Computers do not executeinstructions fully sequentially

    Instead they use an assembly line

    Example:

    424344454647

    41

    48

    ...i := i + 1a := A[i]IF a < p GOTO 42j := j - 1a := A[j]IF a > p GOTO 45

    ...

    each instruction broken in 4 stages

    simpler steps shorter CPU cycles

    one instruction per cycle finished . . .

    . . . except for branches!

    1 undo wrong instructions2 fill pipeline anew

    Pipeline stalls are costly . . . can we avoid (some of) them?

    Sebastian Wild Branch Misses in Quicksort 2015-01-04 2 / 15

  • Instruction Pipelines

    Computers do not executeinstructions fully sequentially

    Instead they use an assembly line

    Example:

    424344454647

    41

    48

    ...i := i + 1a := A[i]IF a < p GOTO 42j := j - 1a := A[j]IF a > p GOTO 45

    ...

    each instruction broken in 4 stages

    simpler steps shorter CPU cycles

    one instruction per cycle finished . . .

    . . . except for branches!

    1 undo wrong instructions2 fill pipeline anew

    Pipeline stalls are costly . . . can we avoid (some of) them?

    Sebastian Wild Branch Misses in Quicksort 2015-01-04 2 / 15

  • Instruction Pipelines

    Computers do not executeinstructions fully sequentially

    Instead they use an assembly line

    Example:

    424344454647