GithubHelp home page GithubHelp logo

kbkpbot / branch_predictor Goto Github PK

View Code? Open in Web Editor NEW
1.0 1.0 0.0 35.06 MB

A simple gshare branch predictor writting in Vlang. It is really fast than a C version!

License: MIT License

V 44.60% AMPL 0.53% Makefile 2.73% C 52.13%

branch_predictor's Introduction

branch_predictor

A simple gshare branch predictor writting in Vlang. It is really fast than a C version!

What is this ?

Branch predictor is one of the most import circuit in modern super scalar CPUs. By given a PC, the predictor should provide a suggestion of Taken or Not Taken.

This project provide a branch predictor simualtion framework, which is written in vlang. To demo, it provide a simple gshare implementation of branch predictor.

Also provide some branch instruction traces, which is converted from CBP-16 traces.

How to run ?

You must install zstd in your system:

  apt install libzstd-dev

The project use the cbsl, which need the zstd compress library to work.

  $ git clone https://github.com/kbkpbot/branch_predictor.git
  $ cd branch_predictor
  $ git submodule update --init --recursive
  $ v -prod .
  $ ./branch_predictor

Provided with no args, the branch_predictor will try to read the content of traces/TRACE_LIST.txt, which provide a trace list , one trace per line. You can comment out some traces by a leading '#', like this:

#LONG_MOBILE-1
#LONG_MOBILE-2
LONG_MOBILE-3
LONG_MOBILE-4
SHORT_MOBILE-1
SHORT_MOBILE-2
SHORT_MOBILE-3
SHORT_MOBILE-4
SHORT_MOBILE-24
SHORT_MOBILE-25
SHORT_MOBILE-27
SHORT_MOBILE-28
SHORT_MOBILE-30

You should get result something like this:

====================Summary====================
traces/LONG_MOBILE-1            = 0.556903
traces/LONG_MOBILE-2            = 1.388763
traces/LONG_MOBILE-3            = 7.812431
traces/LONG_MOBILE-4            = 0.006016
traces/SHORT_MOBILE-1           = 2.933743
traces/SHORT_MOBILE-2           = 11.394828
traces/SHORT_MOBILE-24          = 0.000489
traces/SHORT_MOBILE-25          = 0.001764
traces/SHORT_MOBILE-27          = 0.480042
traces/SHORT_MOBILE-28          = 0.007541
traces/SHORT_MOBILE-3           = 3.752000
traces/SHORT_MOBILE-30          = 6.294661
traces/SHORT_MOBILE-4           = 5.163341
===============================================
Total MISPRED_PER_1K_INST               = 39.8

Score = 86(39.8) time cost = 2.94 seconds

MISPRED_PER_1K_INST mean Miss Predictions Per 1000 Instructions.

How to writing my own predictor?

Just modify the predictor.v. You target is try to min the MISPRED_PER_1K_INST.

A C verion of this branch predictor?

Yes, we provide a C version.

  $ make
  $ ./predictor

branch_predictor's People

Contributors

kbkpbot avatar

Stargazers

Delyan Angelov avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.