Commit Graph

1464 Commits

Author SHA1 Message Date
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
Harshil Patel
5658eec958 tests: update mocking for tests
- After removal of the ClientWrapper class, the mocking of clients needs
  to be changed to _create_client function.
- Commented failing tests due to persistence issues.
  The persistence is being caused as the new mocked clients
  not being used as the older clients are persisting over
  the tests.

Change-Id: Ie342c9fc8103504dd12f49ae30b3bf62d189ce1d
2024-04-23 16:26:44 -07:00
Bobby R. Bruce
52a7218bd8 stdlib,tests: Fix test resources entry for to new schema
Change-Id: I77c263315d3e7f15df6f7fd83ab4ad9280faf777
2024-04-18 17:33:30 -07:00
Bobby R. Bruce
b80a04e146 stdlib,tests: Fix mocked_resquest_post - add kwargs
Change-Id: I1c080d42b6f238d2f716c500913dc7576dc13ed6
2024-04-18 17:33:30 -07:00
Bobby R. Bruce
e4ff5df35a tests,stdlib: Fix pyunit tests - Workload -> ShadowResource
Change-Id: I307439334c93851ebe3a78d3a80d048374a0900a
2024-04-18 17:33:30 -07:00
Yu-Cheng Chang
6b4dbdcedb tests,arch-riscv: update bitmanip asmtest binaries (#931)
Gem5 resource update: https://github.com/gem5/gem5-resources/pull/25
Gem5 issue: https://github.com/gem5/gem5/issues/883

Change-Id: I1892d7591d6fa49d0563623fd90292e0d38d9ba3
2024-04-16 09:51:32 -07:00
Bobby R. Bruce
504005da87 scons,tests: Add 'USE_TEST_OBJECTS' kconfig
This has the SimObjects defined in "src/test_objects" only be compiled
into the gem5 binary if the Kconfig 'USE_TEST_OBJECTS" == 'y'. This
happens in two cases:

1. When 'ALL/gem5' is compiled via "build_opts".
2. When tests are run via "./tests/main.py".

Change-Id: I2330008fd7c7900de5f4de142b8ac89ef4e351ce
2024-04-04 13:04:21 -07:00
Bobby R. Bruce
2771061207 stdlib,tests: Add StatTester SimObject and Scalar tests
This SimObject can be used to quickly test the statistics are
functioning correctly. The SimObject schedules a single event which sets
the statistics to values dependent on the SimObject params.

With this commit the "Scalar" stats have a StatTester subclass that can
be used for testing. More can be added as required.

Tests are included to check our Scalar SimStat functionality.

Change-Id: I78fa5d9a0c3fc7115bd6c6d3410a5436aaa47f55
2024-04-04 13:04:20 -07:00
Harshil Patel
76965c6431 tests: Update tests to use specific resource versions (#901)
This update modifies the test configuration to specify the versions of
resources used, rather than automatically using the latest versions.
Previously, if a resource was updated for a change, it could potentially
cause tests to fail if those tests were incompatible with the new
version of the resource.
Now, with this change, tests are tied to specific versions of resources,
ensuring that any updates to resources will require corresponding
updates to the tests to maintain compatibility.

Change-Id: I9633b1749f6c6c82af6aa6697b7e7656020f62fa
2024-03-21 09:03:46 -07:00
Giacomo Travaglini
058dd7e195 configs, tests: Amend stdlib configs to use WalkCache hierarchy
As X86 and RISCV are relying on a Table Walker cache, we
change their stdlib configs to use the newly defined

PrivateL1PrivateL2WalkCacheHierarchy

Change-Id: I63c3f70a9daa3b2c7a8306e51af8065bf1bea92b
Signed-off-by: Giacomo Travaglini <giacomo.travaglini@arm.com>
2024-03-18 09:42:05 +00:00
Yu-Cheng Chang
521a7c1de0 tests: Exit riscv_asmtest script with simulator status code (#891)
It will be helpful to check if the instruction simulate well

Change-Id: I5faa435fad79601682126ee7978d8444093df900
2024-02-26 10:31:18 -08:00
Harshil Patel
0f79b15b2f tests: Update checkpoint tests to new checkpoints (#888)
Change-Id: I1bf6d47017bcf77a4f93341c73de355372e1dea7
2024-02-21 16:37:28 -08:00
Suraj Shirvankar
44aaebc49a tests: Allow pyunit tests to run on specific directories (#847)
This change allows pyunit tests to be run on specific directories
instead of the default `pyunit` directory.
You can pass in the directory as follows. I have built gem5.opt for
RISCV however it should work the same with other builds
```
./build/RISCV/gem5.opt tests/run_pyunit.py --directory tests/pyunit/gem5/
```
The default path works as it is currently 
```
./build/RISCV/gem5.opt tests/run_pyunit.py
```

Change-Id: Id9cc17498fa01b489de0bc96a9c80fc6b639a43f

Signed-off-by: Suraj Shirvankar <surajshirvankar@gmail.com>
2024-02-06 09:32:12 -08:00
Harshil Patel
d1fca18eb3 tests: Added tests for suites (#676)
Change-Id: I69db8e82e9373d659d125d3bd48a69de12b32390
2024-01-29 10:52:33 -08:00
Matthew Poremba
9b89149142 tests,ext: Remove GCN3 tags, update tests to Vega
Change-Id: I782b6e61cd43b51cfbe80161d4dc1cee125f7f64
2024-01-17 11:13:50 -06:00
Jason Lowe-Power
bab8af44fb Revert "tests: Fix garnet and memcheck tests to use X86"
This reverts commit b22ca02a65.
2023-12-20 15:32:57 -08:00
Bobby R. Bruce
b22ca02a65 tests: Fix garnet and memcheck tests to use X86
These tests previously used "build/NULL" but due to changes in the
"Ruby" and "garnet_synth_traffic.py" scripts, "NULL" fails as the script
exists "X86TimingSimple" with MESI_Two_Level.

This change fixes the tests by compiling and using the correct
compilation of gem5. It shouldn't affect the tests in any negative way.
As far as I'm aware it does not matter what ISA is used for these tests.

Change-Id: I8ae84b49f65968e97bef4904268de5a455f06f5c
2023-12-18 14:39:28 -08:00
Harshil Patel
bc12e7269d tests: fix gapbs and npb tests (#671)
Change-Id: I6090bde7903e302e501319b545fb4b06ef3e3df9
2023-12-12 12:33:22 -08:00
Bobby R. Bruce
569e21f798 configs,stdlib,tests: Remove get_runtime_isa() (#241)
`get_runtime_isa()` has been deprecated for some time. It is a leftover
piece of code from when gem5 was compiled to a single ISA and that ISA
used to configure the simulated system to use that ISA. Since multi-ISA
compilations are possible, `get_runtime_isa()` should not be used.
Unless the gem5 binary is compiled to a single ISA, a failure will
occur.

The new proceedure for specify which ISA to use is by the setting of the
correct `BaseCPU` implementation. E.g., `X86SimpleTimingCPU` of
`ArmO3CPU`.

This patch removes the remaining `get_runtime_isa()` instances and
removes the function itself. The `SimpleCore` class has been updated to
allow for it's CPU factory to return a class, needed by scripts in
"configs/common".

The deprecated functionality in the standard library, which allowed for
the specifying of an ISA when setting up a processor and/or core has
also been removed. Setting an ISA is now manditory.

Fixes #216.
2023-12-04 09:53:35 -08:00
Bobby R. Bruce
d11c40dcac misc: Run pre-commit run --all-files
This ensures `isort` is applied to all files in the repo.

Change-Id: Ib7ced1c924ef1639542bf0d1a01c5737f6ba43e9
2023-11-29 22:06:41 -08:00
Roger Chang
5b21233491 tests: Update Gem5Fixture to compatible of Kconfig system
Used after the build system changed to Kconfig

Change-Id: I699b36f09691dc821da8ee80fe5b60f30fe2179c
2023-11-23 08:26:11 +08:00
Ivana Mitrovic
45df1dbb55 docker-images: Changed path from Google Registry to GitHub
Replaced all instances of the Google Docker registry
(gcr.io/gem5-test/) with the GitHub Docker registry (ghcr.io/gem5/).
2023-10-16 11:53:27 -07:00
Kaustav Goswami
68af3f45c9 tests: updated the nightly tests to use SST 13.0.0 (#441)
PR https://github.com/gem5/gem5/pull/396 updates the gem5 SST bridge to
use StandardMem in SST. This change updates the nightly tests to use SST
13.0.0 instead of SST 11.1.0. It also updates the dockerfile.

Change-Id: I5c109c40379d2f09601a1c9f19c51dd716c6582e

---------

Signed-off-by: Kaustav Goswami <kggoswami@ucdavis.edu>
Co-authored-by: Bobby R. Bruce <bbruce@ucdavis.edu>
2023-10-13 14:31:35 -07:00
Bobby R. Bruce
298119e402 misc,python: Run pre-commit run --all-files
Applies the `pyupgrade` hook to all files in the repo.

Change-Id: I9879c634a65c5fcaa9567c63bc5977ff97d5d3bf
2023-10-10 21:47:07 -07:00
Bobby R. Bruce
3f5d7d647a misc: Run pre-commit autoupdate (#419)
1. Runs `pre-commit autoupdate`.
2. Runs `pre-commit run --all-files`.
3. Adds (2.) to ".git-blame-ignore-rev".
2023-10-10 21:41:33 -07:00
Bobby R. Bruce
d559c24ac2 stdlib: Improve handing of errors in Atlas request failures (#404)
Now:

* The Atlas Client will attempt a connection 4 times, using an
exponential backoff approach between attempts.
* When a failure does arise a rich output is given so problems can be
easily diagnosed.

Addresses: #340
2023-10-10 21:34:24 -07:00
Harshil Patel
bbc301f2f0 stdlib, tests: Fixed bugs and tests
- Fixed bugs rekated to retrying on request faliure.
- Updated the pyunit tests.

Change-Id: Ia484690267bf27018488324f3408f7e47c59bef3
2023-10-10 15:54:20 -07:00
Bobby R. Bruce
ddf6cb88e4 misc: Run pre-commit run --all-files
This is reflect the updates made to black when running `pre-commit
autoupdate`.

Change-Id: Ifb7fea117f354c7f02f26926a5afdf7d67bc5919
2023-10-10 14:01:58 -07:00