1

part question. First, how do I configure the size of a branch predictor?

I can see that I can set the type using the se.py config script and the --bp-type argument. (In my case I'm setting it to LTAGE), but how do I change the size of the tables? And is there an easy way to see the total size of all tables?

My second part, is looking at the code, I don't understand the LTAGE constructor:

LTAGE::LTAGE(const LTAGEParams *params)
  : TAGE(params), loopPredictor(params->loop_predictor)
{

}

The LTAGEParams doesn't appear to be defined anywhere except here:

LTAGE*
LTAGEParams::create()
{
    return new LTAGE(this);
}

How can I see what all the members of LTAGEParams are?

KenArrari
  • 321
  • 1
  • 2
  • 7

1 Answers1

1

About the size, have a look at m5out/config.ini after running a simulation, it contains all SimObject parameters.

In the case of branch predictors, all Python-visible parameters of each implemented predictor will be defined in its respective class declaration at src/cpu/pred/BranchPredictor.py. They also inherit the parameters of their base class. For example, LTAGE has all the parameters of the TAGE class - out of which the tage object is re-assigned to be an instance of LTAGE_TAGE - and a new parameter, loop_predictor, which is a LoopPredictor instance.

You can then just set any of the values in that file from your Python config and they will be used (double check in config.ini after re-running).

The C++ constructor of SimObjects takes a param object like LTAGEParams and that object is autogenerated from the corresponding Python SimObject file, and passes values from Python configs to C++ using pybind11.

gem5 has a lot of code generation, so whenever you can't find a definition, grep inside the build directory. This is also why I recommend setting up Eclipse inside the build directory: How to setup Eclipse IDE for gem5 development?

SimObject autogeneration is described further at: https://cirosantilli.com/linux-kernel-module-cheat/#gem5-python-c-interaction

Daniel Carvalho
  • 473
  • 1
  • 5
  • 17
Ciro Santilli
  • 3,693
  • 1
  • 18
  • 44
  • Giving a heads-up, since I believe you want to incorporate it: the Prefetcher -> BranchPredictor edit got rejected – Daniel Carvalho May 23 '20 at 16:58
  • 1
    @DanielCarvalho a valeu, using that account was an accident, but I thought that would have worked since that account has 2k+ rep. Weird rules. – Ciro Santilli May 23 '20 at 20:25