How can I know what are the optional choices for the gem5 command line options such as --cpu-type?

506 views Asked by At

There are many possible and optional choices in gem5. For example,I can through the command of --debug-help show all the possible debug options for --debug-flags assignment. But how can I know the optional choices for --cpu-type assignment Are there some command like --cpu-type-help to show the optional assignment for --cpu-type? I ran the command of gem5.opt help,I didn't see the introduction about --cpu-type.

2

There are 2 answers

0
Ciro Santilli On

For --cpu-type, if you type any wrong value on the CLI e.g.:

--cpu-type adsf

the error message prints the possible choices:

fs.py: error: option --cpu-type: invalid choice: 'asfd' (choose from 'O3_ARM_v7a_3', 'AtomicSimpleCPU', 'TraceCPU', 'ex5_big', 'DerivO3CPU', 'MinorCPU', 'HPI', 'ex5_LITTLE', 'NonCachingSimpleCPU', 'TimingSimpleCPU')

This can also be easily seen from the source (configs/common/Options.py) as well:

    parser.add_option("--cpu-type", type="choice", default="AtomicSimpleCPU",
                      choices=ObjectList.cpu_list.get_names(),

where cpu_list is defined as (configs/common/ObjectList.py):

cpu_list = CPUList(getattr(m5.objects, 'BaseCPU', None))

from which we deduce that valid choices are BaseCPU derived classes.

gem5 6bc2111c9674d0c8db22f6a6adcc00e49625aabd.

1
Daniel Carvalho On

In addition to Ciro's answer, multiple times there is a command that lists the possible values for the object type without the need to provide a random value. For example, in the case of --cpu-type, there is a --list-cpu-types that does exactly what you want without requiring an extra (random) argument.

In general, these commands follow the format --list-x-types, and their function callbacks are defined at the beginning of the file configs/common/Options.py (e.g., for CPU types it is _listCpuTypes).

Adding more lists is as easy as adding a respective ObjectList (configs/common/ObjectList.py) instance for a selected base class. For example, this patch ported the previous code for prefetchers to use ObjectList.