1491 Commits

Author SHA1 Message Date
Harshil Patel
63d25922a2 tests: Update pyunit tests references to include 24.1 (#1843) 2024-12-07 00:02:57 -08:00
Erin (Jianghua) Le
1e5021c2e3 tests: modify gem5/learning-gem5 ref file to fix failure (#1795)
The test `ruby_test_test-ALL-x86_64-opt-MatchStdout` is currently
failing because the reference file doesn't match the actual output. This
PR changes the reference file to match.
2024-12-02 08:46:10 -08:00
Giacomo Travaglini
44b8f5f422 tests: Write unit-tests for ruby using the CHI-TLM library
This commit is adding two python files:

* ruby_mem_test.py is the canonical gem5 configuration script,
and it is an adaptation of the existing ruby_mem_test.py [1].
The main difference is the use of the TlmController as a
cache controller, and the use of TlmGenerator instead of
the MemTest memory tester. The config is minimally setting up
the system. The extent of the testing is specified in the second
python file:

* read_shared_unit.py: "unit-test" for the CHI ReadShared request
The file should be passed to the ruby_mem_test.py as cmdline
argument:

build/ARM/gem5.opt <>/ruby_mem_test.py <>/read_shared_unit.py

This is a simple testing file. We should ideally generate separate
test files for separate transactions/scenarios.
The test file can have whatever for inside, it only needs to comply
to the minimal interface required by the ruby_mem_test.py, which is
to define the following function:

def test_all(generator):

[1]: https://github.com/gem5/gem5/blob/stable/\
    configs/example/ruby_mem_test.py

Change-Id: I767ede9b8572f3eafe677c84da45fd904d77e319
Signed-off-by: Giacomo Travaglini <giacomo.travaglini@arm.com>
2024-12-02 08:33:11 -08:00
Erin Le
82c8642954 tests: remove protocol=None, add print statement back in
This commit removes the `protocol=None` argument in various
gem5_verify_config()s because protocol is set to None by
default. Also, two print statements that were taken out in
previous commits were put back in with different function calls.
2024-11-19 11:02:15 -08:00
Erin Le
bcfa988a67 tests, scons: Fix Testlib test failures
This commit changes the fs/linux/arm and learning_gem5 tests as
they were previously failing with the Ruby change. The
fs/linux/arm long tests require the addition of a new gem5 build,
ARM_X86, which builds the ARM and X86 ISAs with the
MESI_Two_Level cache hierarchy.
2024-11-19 11:00:37 -08:00
Erin Le
cffc2e6144 tests: modify tests to use ALL build
This commit modifies a number of Testlib tests to use the ALL
build instead of a more specific build.
2024-11-19 11:00:37 -08:00
Erin Le
2ee40f1c11 mem-ruby: changes to MESIThreeLevel, MIExample, OctopiCache
This commit changes MESIThreeLevel, MIExample, and OctopiCache
so they work with this PR. It also adds MESIThreeLevel and
OctopiCache to the testlib tests.
2024-11-19 11:00:37 -08:00
Erin Le
3535fd0449 tests: additional trusted_stats files
This commit adds trusted_stats.json files for CHIL1,
MESI_Three_Level, MIExample, and OctopiCache. These jsons are
used to verify the output of tests from test_memory_traffic_gen.py.
2024-11-19 11:00:37 -08:00
Jason Lowe-Power
6903420310 tests: Add more hierarchies to traffic gen tests
This adds all of the hierarchies supported in the standard library. We
can soon move to using a different build target and run all hierarchies!

Change-Id: Ic065a679ea34c3bb2f71b3b133806d240039fbb5
Signed-off-by: Jason Lowe-Power <jason@lowepower.com>
2024-11-19 11:00:37 -08:00
Jason Lowe-Power
97542c1a4c mem-ruby,scons: Add scons option for multiple protocols
This change does many things, but they must all be atomically done.

**USER FACING CHANGE**: The Ruby protocols in Kconfig have changed names
(they are now the same case as the SLICC file names). So, after this
commit, your build configurations need to be updated. You can do so by
running `scons menuconfig <build dir>` and selecting the right ruby
options. Alternatively, if you're using a `build_opts` file, you can run
`scons defconfig build/<ISA> build_opts/<ISA>` which should update your
config correctly.

Detailed changes are described below.

Kconfig changes:

- Kconfig files in ruby now must all be declared in the ruby/Kconfig
  file
- All of the protocol names are changed to match their slicc file names
  including the case
- A new option is available called "Use multiple protocols" which should
  be selected if multiple protocols are selected. This is only used to
  set the PROTOCOL variable to "MULTIPLE" when in multiple mode.
- The PROTOCOL variable can now be "MULTIPLE" which means it will be
  ignored. If it's not "MULTIPLE" then it holds the "main" protocol,
  which is necessary for backwards compatibility with the Ruby.py files.

Ruby config changes:

To make this change backwards compatible with Ruby.py, this change adds
a new "protocol" config called MULTIPLE.py which is used to allow the
user to set a "--protocol" option on the command line. This is only
needed if you are using a gem5 binary with multiple protocols but need
to use Ruby.py.

stdlib changes:

- Make the coherence protocol file behave like the ISA file
- Add a function to get the coherence protocol from the `CacheHierarchy`
  like we do with the ISA in the `Processor`.
  - Use this function where `get_runtime_coherence_protocol` was used
- Update the requires code to work with the ne CoherenceProtocol
- Fix a typo in the AMD Hammer name and also add the missing MSI
  protocol

Scons changes:

- In Ruby we now gather up all of the protocols and build them all if
  there are multiple protocols
- There's some bending over backwards to tell the user if they are using
  an out of date gem5.build/config file and how to update it
- Note that multiple ruby protocols adds a significant amount of time to
  the build since we have to run slicc twice for each file.

build_opts:

- Update all files with new names
- Add a new NULL_All_Ruby that will be used for testing

Signed-off-by: Jason Lowe-Power <jason@lowepower.com>
2024-11-19 11:00:34 -08:00
Harshil Patel
c91af552d4 tests: move weekly gpu tests to have separate jobs (#1698) 2024-10-24 04:02:23 -07:00
Bobby R. Bruce
709f2c7695 mem-ruby,tests: Add CHI with ISA tests (#1651) 2024-10-23 15:12:37 -07:00
Bobby R. Bruce
2c679bfa04 tests: Fix replacement_policies tests' refs (#1695)
At some point 'system' -> 'board' in the stdlib code the replacement
policy tests used. Due to this the output is slightly different meaning
the refs need updated.

This was causing the Daily Tests to fail.
2024-10-21 12:28:29 -07:00
Bobby R. Bruce
ddaf70b64f Merge branch 'develop' into update-pannotia-tests 2024-10-18 13:40:59 -07:00
Harshil Patel
ae56a31b21 tests: Download only the resources used in ponnotia tests 2024-10-18 17:12:43 +00:00
Bobby R. Bruce
0341c5a502 SE script and tests for risc-v's vector extension (#1542)
This two commits add the SE config and test script, respectively, to run
the rvv tests mentioned in #1246.
2024-10-17 10:26:30 -07:00
Ivana Mitrovic
20965f571b stdlib: Extend AbstractBoard pre_instantiation functionality (#1497)
* Deprecates the setting of FS/SE mode via the `Simulator` module.
* Moved the creation of the `Root` object from the `Simulator` to the
board.
* Moved the setting of `sim_quantum` from the `Simulator` to the
processor.
* Allows for easier development of boards which support both SE and FS
mode simulation by moving board setup function calls to occur after the
set_workload function is call which sets a boards stats `is_fs` status.
2024-10-14 10:12:41 -07:00
Saúl Adserias
f4ffe5f815 tests: add rvv-intrinsic-tests script and config
Change-Id: Ia3fa67bb2a2603dd5cbf665504f85a8b969c2a5e
2024-10-11 17:42:51 +02:00
Bobby R. Bruce
65ba2dcae5 tests: Refactor downloading of pannotia tests (#1653)
With this patch the pannotia tests now:

1. Download the resources to 'gpu-pannotia' in the
'tests/gem5/resources' directory. This is where other test resources are
store.
2. Download thr USA-road-d.NY.gr dataset from Google cloud bucket in a
decompressed state.
2. Avoid re-download the resources if they are already present on the
host machine.
2024-10-10 10:17:32 -07:00
pre-commit-ci[bot]
54487d3bf6 [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
2024-10-09 14:04:56 +00:00
Bobby R. Bruce
3fc21da13c learning-gem5,tests: Update learning-gem5 Ruby Test ref (#1635)
The Daily tests have been failing as the learning-gem5 Ruby test now
exits at tick 9831 instead of tick 9981.

**Note**: The cause of this change is currently unknown. I'm not sure if
this is symptomatic of something bigger but for now I only observe this
bug failure and this patch at least silences the error.
2024-10-07 14:40:45 -07:00
Harshil Patel
a12bef131b tests: update input sizes for pannotia tests 2024-10-04 11:51:58 -07:00
Bobby R. Bruce
4bdcb040d0 stdlib: Move Root obj creation from Simulator to Board
It makes much more sense for the Root Object to be create within the
board and passed where required. Creating it in the Simulator class is
not required.

For this to work the signuature of the `_pre_instantiate` function in
`AbstractBoard` has been updated to return the Root object.
2024-10-04 11:40:13 -07:00
Erin (Jianghua) Le
c10feed524 tests, configs, util, mem, python, systemc: Change base 10 units to base 2 (#1605)
This commit changes metric units (e.g. kB, MB, and GB) to binary units
(KiB, MiB, GiB) in various files. This PR covers files that were missed
by a previous PR that also made these changes.
2024-10-01 11:18:05 -07:00
Erin (Jianghua) Le
e987c60a4c tests: Add Pannotia GPU Tests (#1584)
This PR adds the Pannotia GPU tests.
2024-09-26 14:39:39 -07:00
Bobby R. Bruce
1a637e6d94 tests: test_requires.py moved to very-long and drop risv
This test required a lot of compilation for what it does. It is now moed
to very-long/weekly and riscv has been dropped as arm and x86 are
sufficient.
2024-09-23 11:34:14 -07:00
Bobby R. Bruce
87daf94c0e tests: 'NULL_MI' -> 'NULL' in test_replacement_policies.py
NULL already compiled to include the MI protocol. This explicit
declaration causes compilation of another binary which is not required.
2024-09-23 11:34:14 -07:00
Bobby R. Bruce
91fb4acd29 tests: Remove 'multi_isa' tests (redundant)
These tests are almost identical to 'stdlib/test_requires.py' tests.
They use all the same functions and tests the functionality.
2024-09-23 11:34:14 -07:00
Bobby R. Bruce
f2f86a3e42 stdlib, python: Add warning message and clarify binary vs metric units (#1479)
This PR changes memory and cache sizes in various parts of the gem5
codebase to use binary units (e.g. KiB) instead of metric units (e.g.
kB). This makes the codebase more consistent, as gem5 automatically
converts memory and cache sizes that are in metric units to binary
units.

This PR also adds a warning message to let users know when an
auto-conversion from base 10 to base 2 units occurs.

There were a few places in configs and in the comments of various files
where I didn't change the metric units, as I couldn't figure out where
the parameters with those units were being used.
2024-09-17 17:32:27 +00:00
Erin Le
39ea74c4ee tests: add test for checking conversion from base 10 to base 2
This commit adds a test that checks that strings representing
base 10 memory sizes or base 10 memory bandwidths are correctly
converted to strings representing base 2 values.

Change-Id: Ie8cac15f06b4ceb1786484fea4e8ba2111f4e8d3
2024-09-11 11:35:17 -07:00
Bobby R. Bruce
f327559ca4 tests,stdlib,python: Add tests for base 10 to 2 SI unit check
**Note**: Erin needs to complete the commit by expanding this test to
properly test the behavior of this change.

To run the pyunit tests:

```sh
scons build/ALL/gem5.opt -j`nproc`
./build/ALL/gem5.opt tests/run_pyunit.py
```

Change-Id: I8cea0fe8b088e03e84072a000444953768bc3151
2024-09-10 15:17:53 -07:00
Ivana Mitrovic
9bd79bc160 tests: Fix gpu-tests (#1515)
This PR resolves the issue with the failing daily tests.

Change-Id: I984b09a6b69701a7a57b36e3346e55245f2fa04a
2024-08-26 09:40:28 -07:00
Erin Le
e1db67c4bd configs, dev, learning-gem5, python, tests: more clarification
This commit contains the rest of the base 2 vs base 10 cache/memory
size clarifications. It also changes the warning message to use
warn(). With these changes, the warning message should now no
longer show up during a fresh compilation of gem5.

Change-Id: Ia63f841bdf045b76473437f41548fab27dc19631
2024-08-23 18:02:42 -07:00
Bobby R. Bruce
6057de452b tests,gpu-compute: Fix incorrect options handling
Change-Id: Ica845ad7c4a49fe2636df3bf184220a33557bc5e
2024-08-22 05:49:07 -07:00
Bobby R. Bruce
f600db4a98 gpu-compute,tests: Move GPU tests to testlib (#1270)
A new host tag `gcn_gpu` has been added. This allows for selection of
those GPU tests which depend upon the gcn-gpu docker image to run.

In addition to this, the square GPU tests has been moved to the CI
tests. This ensures some GPU code is compiled and run on every PR.
2024-08-19 10:58:06 -07:00
Bobby R. Bruce
b471d5f382 stdlib,tests: Update resources to v24.0 in Pyunit test (#1290)
This needs a better fix. I don't like having to update these files for
every release. Though for now, this will mean the tests passing in v24.0
2024-06-27 05:48:48 -07:00
Bobby R. Bruce
25d614e4ce tests: Fix x86_boot_exit_run.py 'set_max_ticks' typo (#1267) 2024-06-20 00:31:23 -07:00
Bobby R. Bruce
1a00ecfaf9 stdlib,configs,tests: Add gem5 MultiSim (MultiProcessing for gem5) (#1167)
This allows for multiple gem5 simulations to be spawned from a single
parent gem5 process, as defined in a simgle gem5 configuration. In this
design _all_ the `Simulator`s are defined in the simulation script and
then added to the mutlisim module. For example:

```py
from gem5.simulate.Simulator import Simulator
import gem5.utils.multisim as multisim

# Construct the board[0] and board[1] as you wish here...

simulator1 = Simulator(board=board[0], id="board-1")
simulator2 = Simulator(board=board[1], id="board-2")

multisim.add_simulator(simulator1)
multisim.add_simulator(simulator2)
```

This specifies that two simulations are to be run in parallel in
seperate threads: one specified by `simulator1` and another by
`simulator2`. They are then added to MultiSim via the
`multisim.add_simulator` function. The user can specify an id via the
Simulator constructor. This is used to give each process a unique id and
output directory name. Given this, the id should be a helpful name
describing the simulation being specified. If not specified one is
automatically given.

To run these simulators we use `<gem5 binary> -m gem5.utils.multisim
<script> -p <num_processes>`. Note: multisim is an executable module in
gem5. This is the same module we input into our scripts to add the
simulators. This is an intentionally modular encapsulated design. When
the module processes a script it will schedule multiple gem5 jobs and,
dependent on the number of processes specified, will create child gem5
processes to processes tjese jobs (jobs are just gem5 simulations in
this case). The `--processes` (`-p`) argument is optional and if not
specified the max number of processes which can be run concurrently will
be the number of available threads on the host system.

The id for each process is used to create a subdirectory inside the
`outputdor` (`m5out`) of that id name. E.g, in the example above the
ID's are `board-1` and `board-2`. Therefore the m5 out directory will
look as follows:

```sh
- m5out
    - board-1
        - stats.txt
        - config.ini
        - config.json
        - terminal.out
    - board-2
        - stats.txt
        - config.ini
        - config.json
        - terminal.out
```

Each simulations output is encapsulated inside the subdirectory of the
id name.

If the multisim configuation script is passed directly to gem5 (like a
traditional gem5 configuraiton script, i.e.: `<gem5 binary> <script>`),
the user may run a single simulation specified in that script by passing
its id as an argument. E.g. `<gem5 binary> <script> board-1` will run
the `board-1` simulation specified in `script`. If no argument is passed
an Exception is raised asking the user to either specify or use the
MultiSim module if multiprocessing is needed.

If the user desires a list of ids of the simulations specified in a
given MultiSim script, they can do so by passing the `--list` (`-l`)
parameter to the config script. I.e., `<gem5 binary> <script> --list`
will list all the IDs for all the simulations specified in`script`.

This change comes with two new example scripts found in
'configs/example/gem5_library/multsim" to demonstrate multisim in both
an SE and FS mode simulation. Tests have been added which run these
scripts as part of gem5' Daily suite of tests.

Notes
=====

* **Bug fixed**: The `NoCache` classic cache hierarchy has been modified
so the Xbar is no longet set with a `__func__` call. This interfered
with MultiProcessing as this structure is not serializable via Pickle.
This was quite bad design anyway so should be changed

* **Change**: `readfile_contents` parameter previously wrote its value
to a file called "readfile" in the output dorectory. This has been
changed to write to a file called "readfile_{hash}" with "{hash}" being
a hash of the `readfile_contents`. This ensures that, during multisim
running, this file is not overwritten by other processes.

* **Removal note**: This implementation supercedes the functionality
outlined in 'src/python/gem5/utils/multiprocessing'. As such, this code
has been removed.

Limitations/Things to Fix/Improve
=================================

* Though each Simulator process has its own output directory (a
subdirectory within m5out, with an ID set by the user unique to that
Simulator), the stdout and stderr are still output to the terminal, not
the output directory. This results in: 1. stdout and stderr data lost
and not recorded for these runs. 2. An incredibly noisy terminal output.
* Each process uses the same cached resources. While there are locks on
resources when downloading, each processes will hash the resources they
require to ensure they are valid. This is very inefficient in cases
where resources are common between processes (e.g., you may have 10
processes each using the same disk image with each processes hashing the
disk images independently to give the same result to validate the
resources).

Change-Id: Ief5a3b765070c622d1f0de53ebd545c85a3f0eee

---------

Signed-off-by: Jason Lowe-Power <jason@lowepower.com>
Co-authored-by: Jason Lowe-Power <jason@lowepower.com>
2024-06-18 09:34:39 -07:00
Bobby R. Bruce
7f0290985f stdlib,tests: Add Pyunit tests to check Pyunit nav, fix bugs
Bigs fixed of note:

1. The 'find' method has been fixed to work. This involved making
   'children' a class implemented per-subclass as required.
2. The 'get_all_stats_of_name' method has been removed. This was not
   working at all correctly and is largely doing what 'find' does.
2. The functionality to get an element in a vector via an attribute call
   (i.e., self.vector1 == self.vector[1]) has been implemented this
   maintaining backwards compatibility with the regular Python stats.

Change-Id: I31a4ccc723937018a3038dcdf491c82629ddbbb2
2024-05-30 03:02:06 -07:00
Bobby R. Bruce
62c1b9f9de tests: move Pystat pyunit tests to their own dir
Change-Id: Ifd3d88deebd4e72bdb8792405966d2e158e6366d
2024-05-29 08:16:38 -07:00
Bobby R. Bruce
c509615ec9 tests: Pretty print Dict when compating for PyStats
Change-Id: I1d93453072d12aa2dd40066f364723de1225b4e0
2024-05-23 14:54:59 -07:00
Bobby R. Bruce
45b26ce465 stdlib: Specialize scalar tests; use 'pystat', not 'simstat'
1. Thests here for the Scalar tasks are named appropriately. Not just
   generic "SimStats tess".
2. We remove 'simstat' terminology. The correct word is "Pystats".

Change-Id: Idebc4e750f4be7f140ad6bff9c6772f580a24861
2024-05-23 14:54:59 -07:00
Bobby R. Bruce
c0a1fa33fe stdlib: Improve PyStat support for SimObject Vectors
Change-Id: Iba0c93ffa5c4b18acf75af82965c63a8881df189
2024-05-23 14:54:59 -07:00
Bobby R. Bruce
178679cbfd stdlib: Add SparseHist to PyStats
This is inclusive of tests to ensure they have implemented correctly.

Change-Id: I5c84d5ffdb7b914936cfd86ca012a7b141eeaf42
2024-05-23 14:54:59 -07:00
Bobby R. Bruce
6ae3692057 stdlib: Add Vector2d to PyStats
Change-Id: Icb2f691abf88ef4bac8d277e421329edb000209b
2024-05-23 14:54:59 -07:00
Bobby R. Bruce
252dbe9c72 stdlib: Add tests for PyStats's Vector and fix bugs
The big thing missing from the Vector stats was that each position in
the vector could have it's own unique id (a str, float, or int) and each
position in the vector can have its own description. Therefore, to add
this the Vector is represented as a dictionary mapping the unique ID to
a Pystat Scaler (whcih can have it's own unique description.

Change-Id: I3a8634f43298f6491300cf5a4f9d25dee8101808
2024-05-23 14:54:59 -07:00
Harshil Patel
a6138777e2 tests: update versions for new checkpoints
Change-Id: I075110b68a7aa762fb060fcae7bb74ee8ec581b0
2024-04-26 09:54:43 -07:00
Harshil Patel
d75afeabb1 tests: fix persistence issue in pyunit tests (#1070)
- Fixed patching/ mocking of functions and global variables to reset for
each test.
- Uncommented tests as they should pass now.
2024-04-25 10:03:10 -07:00
Giacomo Travaglini
01602cdf13 tests: Revert "tests: Move the arm+ruby tests to not use ALL" (#1069)
This reverts commit c1de2b8762. We revert
the commit as Ruby does not use get_runtime_isa anymore after [1]

[1]: https://github.com/gem5/gem5/pull/241

Change-Id: Iaac8d64194bbd53a9b1a57a796ff92f763c75a87
2024-04-24 21:01:53 -07:00
Bobby R. Bruce
b83a53e521 tests: Fix gem5 testlib compilation (#1063)
Prior to this patch the usage of KConfig was creating an empty config in
the case where a protocol was not specified.
2024-04-24 21:01:30 -07:00