Docsity
Docsity

Prepare for your exams
Prepare for your exams

Study with the several resources on Docsity


Earn points to download
Earn points to download

Earn points by helping other students or get them with a premium plan


Guidelines and tips
Guidelines and tips

Homework 4 Problems - Computer Architecture | CS 538, Assignments of Computer Architecture and Organization

Material Type: Assignment; Professor: Archer; Class: COMP ARCHITECTURE; Subject: Computer Science; University: Portland State University; Term: Spring 2007;

Typology: Assignments

Pre 2010

Uploaded on 08/17/2009

koofers-user-e75
koofers-user-e75 🇺🇸

10 documents

1 / 1

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
CS538 Homework 4 Spring, 2007
1. Branch prediction buffers are indexed using the low-order address bits of the
branch instruction. Assume now that some other subset of address bits is chosen.
Discuss the effects on buffer operation.
2. Increasing the size of a branch-prediction buffer means that it is less likely that two
branches in a program will share the same predictor. A single predictor predicting a
single branch instruction is generally more accurate than if the predictor serves
more than one branch (which we call aliasing).
a. List a sequence of branch taken and not taken actions to show a simple
example of 1- bit predictor sharing that reduces misprediction rate
b. List a sequence of branch taken and not taken actions that show a simple
example of how sharing a 1-bit predictor increases misprediction.
c. Discuss why sharing branch predictors can be expected to increase
misprediction for long instruction sequences of actual programs.
3. The routine samples in the code below is called many times. Consider the execution of
the code on three systems, each system using one of the branch predictors below. All
predictors use a 214-entry branch history table (BHT). (The global predictor does not
need its BHT for predicting branch direction.) The three predictors are:
System B: bimodal
System G: global, history length 10. (Accuracy can be approximated.)
System L: local, history length 10.
void samples(int& x, int& y, char **string_array )
{// Loop 5-xor
for( int i = 0; i < 5; i++ )
x = x ^ i;
// Loop 5-len
for( int i = 0; i < 5; i++ )
if( strlen( string_array[i] ) < 20 )
return; // Never executes. <- Important.
// Loop 100-xor
for( int i = 0; i < 100; i++ )
y = y ^ i;}
a. Determine the amount of memory (in bits) needed to implement each predictor.
b. For each loop in samples determine the accuracy of the loop branch (the one that
tests the value of i) after warmup on each system. The accuracy for the global
predictor can be approximated, the others must be determined exactly.
c. Why would solving the problem above be impossible, or at least tedious, if the
BHT size were about 23 entries?

Partial preview of the text

Download Homework 4 Problems - Computer Architecture | CS 538 and more Assignments Computer Architecture and Organization in PDF only on Docsity!

CS538 Homework 4 Spring, 2007

  1. Branch prediction buffers are indexed using the low-order address bits of the

branch instruction. Assume now that some other subset of address bits is chosen. Discuss the effects on buffer operation.

  1. Increasing the size of a branch-prediction buffer means that it is less likely that two

branches in a program will share the same predictor. A single predictor predicting a single branch instruction is generally more accurate than if the predictor serves more than one branch (which we call aliasing). a. List a sequence of branch taken and not taken actions to show a simple example of 1- bit predictor sharing that reduces misprediction rate b. List a sequence of branch taken and not taken actions that show a simple example of how sharing a 1-bit predictor increases misprediction. c. Discuss why sharing branch predictors can be expected to increase misprediction for long instruction sequences of actual programs.

  1. The routine samples in the code below is called many times. Consider the execution of

the code on three systems, each system using one of the branch predictors below. All predictors use a 2^14 -entry branch history table (BHT). (The global predictor does not need its BHT for predicting branch direction.) The three predictors are: System B: bimodal System G: global, history length 10. (Accuracy can be approximated.) System L: local, history length 10.

void samples(int& x, int& y, char **string_array ) {// Loop 5-xor for( int i = 0; i < 5; i++ ) x = x ^ i; // Loop 5-len for( int i = 0; i < 5; i++ ) if( strlen( string_array[i] ) < 20 ) return; // Never executes. <- Important. // Loop 100-xor for( int i = 0; i < 100; i++ ) y = y ^ i;}

a. Determine the amount of memory (in bits) needed to implement each predictor.

b. For each loop in samples determine the accuracy of the loop branch (the one that tests the value of i) after warmup on each system. The accuracy for the global predictor can be approximated, the others must be determined exactly.

c. Why would solving the problem above be impossible, or at least tedious, if the BHT size were about 2^3 entries?