问题
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?
回答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
来源:https://stackoverflow.com/questions/61910993/viewing-the-parameters-of-the-branch-predictor-in-gem5