Docsity

Wide I-Fetch Design: Cache Alignment and Branch Prediction, Study notes of Computer Architecture and Organization

Toggle sidebar
bg1
Wide I-Fetch Design
Wide I-Fetch Design attempts:
- I-cache alignment
- Branch Prediction Adaptation
Instruction
Cache
Branch
Predictor
Pre-
decoding
Logic
Que
Length Decoder
Instruction Input Buffer
Decoder Decoder Decoder
Micro-Ops
S
u
p
p
l
e
m
e
n
t
e
d
b
y
T
r
a
c
e
C
a
c
h
e
- Determine current
dependencies
- Grouping
- Set Instruction
Boundaries
- Instructions could be
various # of bytes
- On X86, this is 1 to 15
bytes
pf3
pf4
pf5
pf8

Partial preview of the text

Download Wide I-Fetch Design: Cache Alignment and Branch Prediction and more Study notes Computer Architecture and Organization in PDF only on Docsity!

Wide I-Fetch Design

Wide I-Fetch Design attempts:

  • I-cache alignment
  • Branch Prediction Adaptation

Instruction Cache

Branch Predictor

Pre- decoding Logic

Que

Length Decoder

Instruction Input Buffer

Decoder Decoder Decoder

Micro-Ops

S

up

pl

em

en

te

d

by

T ra

ce

C

ac

he

  • Determine current dependencies
  • Grouping
  • Set Instruction Boundaries
  • Instructions could be various # of bytes
  • On X86, this is 1 to 15 bytes

Possible Areas of Concern:

  • Fetching across multiple cache blocks
  • Short distance predict taken branch
  • Long distance predict taken branch
  • Back edge branch.

C

A B

D E

Bank 0 Bank 1

F

Tag

Tag + 1

X X A B C D E F

Mask out unwanted bits and switch banks if necessary.

  • We need size of block to at least match issue rate of machine, this is a minimal requirement.
  • If we want to issue n instructions, we need 2(n-1) sized blocks. This is necessary to guarantee no wrap around back to the same block. (See top of next slide for diagram.)

Multi-Block Fetch

X

Y

Z

X

Y

Z

Taken

Taken

Trace Cache

X Y Z

Store Instructions in the order they were executed.

Trace Cache:

In this example, 3 cache lines to be fetched and assembled.

A Worse Case Scenario

A

A

B

B

C

C

This will require sophisticated logic to put everything back in order.

In this example, we need to use banks and fetch and assemble 6 cache lines.

Bank 0 Bank 1

Fetch Pipeline

Trace Cache Fetch Address

Trace Path Targets Multiple Branch Predictor

Trace Next Fetch Address

Note: The trace occupies one cache line. Also, there is only one trace in the cache that starts at a given address..

To the left is a diagram representing several blocks of code with possible branches. The blocks that are circled represent the trace.

X

A Y

B C Z W

It is possible for the multiple branch predictor to fail. In this case, our options are:

  • Partial Matching - In this case we take the part of the trace that does match the prediction and throw the rest away.
  • Inactive Issue - Issue the block that isn’t predicted, this will be beneficial only if the prediction was wrong.
  • Consider it as no hit and don’t use any of the trace
  • Path Associativity
    • Take multiple traces from the same addresses
    • Use set associtivity
    • Not much performance gain

BTB - generate the path and all alternate targets. A target contains only the taken branch target.

Pentium IV uses:

  • Precoded Micro-Ops
  • No Path Associativety
  • Partial Matching
  • Fills Pipeline in 20 cycles.