thiagoissao/yags
Folders and files
| Name | Name | Last commit date | ||
|---|---|---|---|---|
Repository files navigation
#!/bin/bash # README # Computer Architecture - Lab 7: Branch Prediction # Derek Chiou # Alex Hsu, Chirag Sakhuja, Tommy Huynh # Spring 2016 # This project contains all the code necessary to write your branch predictor # as well as input sets to test your branch predictors against. # * README * # Current file with the instructions to start the project; you can run this # file as a script to quickly set everything up: `source ./README` You can find # the lab instructions are online. # * bp * # You will implement your branch predictors in bp_2bit.cpp, bp_gap.cpp, and # bp_custom.cpp. bp_helper.h is for any common helper code that you might need # across your branch predictors. bp.h implements the infrastructure and wraps # Pin in order to support the branch predictor. # * test * # This directory contains the test code for you to benchmark your branch # predictors. The test program is an implementation of the A* algorithm with two # input sets included: small and big. A compiled 64-bit Linux binary is also # included along with the source for this binary. Please use this compiled # binary and the big input set when checking the accuracy thresholds. # * makefile * # The makefile for this project; more information below. # * pin * # This project is built on Pin to allow you to run your branch predictors on # real programs. Pin is downloaded and extracted when you run this script. # * branch_trace.out * # This file is generated by the branch prediction program and contains a trace # of the branches as well as your predictions to help you debug. Which branches # are recorded can be adjusted in the code. You can also add your own debug # output. Dumping this trace will significantly increase the time it takes to # execute your code. # * stats.out * # This file is generated by the branch prediction program and contains the # statistics from your branch predictor and the instruction stream of your test # program. Please pay attention to the accuracy metrics. # 1. Download Pin from: https://software.intel.com/en-us/articles/pintool-downloads wget http://software.intel.com/sites/landingpage/pintool/downloads/pin-3.0-76991-gcc-linux.tar.gz # 2. Uncompress the tarball and name the directory pin. tar xzvf pin-3.0-76991-gcc-linux.tar.gz && mv pin-3.0-76991-gcc-linux pin && rm pin-3.0-76991-gcc-linux.tar.gz # 3. Setup your paths. export PIN_ROOT=$(pwd)/pin export PATH=$PIN_ROOT:$PATH echo -e "\n# environment variables for branch prediction lab" >> ~/.profile echo "export PIN_ROOT=$PIN_ROOT" >> ~/.profile echo 'export PATH=$PIN_ROOT:$PATH' >> ~/.profile # 4. Test build. # There are four predictors and you can toggle between them with an argument to make. # Run the command `make BP=btfn` to build the BTFN predictor. # The branch predictors you are writing are BP=2bit, BP=gap, and BP=custom. make BP=btfn # 5. Test run. # pin -t obj-intel64/<bp>.so -- <program> # <bp> - the branch predictors (e.g. bp_btfn.so) # <program> - any executable file # Results are in stats.out. pin -t obj-intel64/bp_btfn.so -- test/astar test/small.data # 6. Write your branch predictor and beat your friends!