Commit Graph

21336 Commits

Author SHA1 Message Date
Daniel Kouchekinia
0fd73f4e05 Merge branch 'develop' into missing-tcc-transition 2024-02-27 16:46:30 -06:00
Richard Cooper
4e12f2486b util: update list_changes.py to support multiple Change-Ids (#861)
The original version of `list_changes.py` assumed no more than one
`Change-Id` tag per commit. However, since transitioning to GitHub, the
repository now contains some merge commits containing multiple
`Change-Id`s.

This patch updates `list_changes.py` to support commits with any number
of `Change-Id` tags.
2024-02-27 11:10:31 -08:00
Giacomo Travaglini
e5eea7efcc mem: QoS q_policy assertions fix (#889)
Fix QoS Memory Queue Policies

* Fix assertions in LRG policy to correctly assert requestor and list
validity
* Fix `selectPacket()` in LIFO Queue Policy to correctly return the end
of the `deque` backing store for its packet queue
2024-02-27 13:32:19 +00:00
Hristo Belchev
e78a6b71fe Merge branch 'develop' into qos-qpolicy-assertions-fix 2024-02-27 09:38:34 +00:00
Harshil Patel
920497c19f tests: Add compiler test for gcc 13 (#858)
Change-Id: I41bdf3ab7ffff21c4148ef17fc5229b5597ec953
2024-02-26 18:03:14 -05:00
Daniel Kouchekinia
6374697a20 mem-ruby: Add missing transition for SLC writes to VIPER TCC
Bypassed write though requests on invalid lines in the TCC should be
written though to the directory. This transition was previously
missing.

Change-Id: I16b117c4e085ce6be0ed5297aa0129d52cd35a51
2024-02-26 13:13:06 -06:00
Nicholas Mosier
1990186170 configs: Ensure m5ops base doesn't overlap physical mem in KVM (#875)
Fix #874, in which running se.py with 4GB or more memory (via option
--mem-size=4GB) causes all KVM programs to crash or hang. This occurred
because the m5ops address range (set to 0xFFFF0000-0x100000000)
overlapped with physical memory under such a configuration.

This patch fixes the bug by moving the m5ops address range if phyiscal
memory is >=4GB.

Change-Id: Ic8a004517bc2be2c27860ed314460be749a11dc1
2024-02-26 10:33:48 -08:00
Yu-Cheng Chang
bcf455755e arch-riscv,dev: Update the PLIC implementation (#886)
Update the PLIC based on the
[riscv-plic-spec](https://github.com/riscv/riscv-plic-spec) in the PR:
- Support customized PLIC hardID and privilege mode configuration
- Backward compatable with the n_contexts parameter, will generate the
config like {0,M}, {0,S}, {1,M} ...

Change-Id: Ibff736827edb7c97921e01fa27f503574a27a562
2024-02-26 10:32:53 -08: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
Ivana Mitrovic
61ee36eee6 mem-ruby: Fix possible dirty line loss in CHI when ReadShared hit on UD line (#791)
In case ReadShared hit on a UD line and there's no sharers, this chage
makes the downstream passes Dirty to the requestor whenever possible
even though it doesn't deallocate the line. This will make the requestor
to SD and the downstream to UD_RSD.
In the previous implementation, loosely exclusive intermediate cache can
cause loss of dirty data. Example error condition is as below.
   
Configurations
L2 cache: Roughly inclusive to L1 without back-invalidation
- dealloc_on_* = false
- dealloc_backinv_* = false
L3 cache: Roughly exclusive to L2 without back-invalidation
- alloc_on_readshared = tue
- alloc_on_readunique = false
- dealloc_on_shared = false
- dealloc_on_unique = true
- dealloc_backinv_* = false
- is_HN = false
LLC: Same clusivity as L3 except is_HN = true
For all caches, allow_SD = true and fwd_unique_on_readshared = false
    
Example problem sequence:
1. L1 sends ReadUnique then becomes UD. L2 is UC_RU. L3 and LLC are RU.
2. L1 evicts the line to L2 by WriteBackFull (UD_PD). L2 becomes UD.
3. L2 evicts the line to L3 using WriteBackFull (UD_PD). L3 becomes UD.
4. L1 reads the line with ReadShared which misses on L2.
5. L2 reads the line with ReadShared which hits on L3. L3 becomes UD_RSC
because it doesn't deallocate the line (dataToBeInvalid=false)
6. L3 evicts the line to LLC by WriteCleanFull (UD_PD) because L3
doesn't back-invalidate and still has sharer. The local cache line is
invalidated by Deallocate_CacheBlock. L3 becomes RUSC and LLC becomes
UD_RU.
7. When UD_RU is evicted at LLC, the UD_RU line is dropped expecting the
upstream to writeback, causing loss of dirty data
2024-02-26 10:06:17 -08:00
wmin0
00ed1d30cf python,util: Fix SimObjectParams default constructor and destructor (#880)
The empty constructor prevent zero-initialization working correctly. In
this change we fix the issue by removing the unwanted empty constructor.
We also change the default destructor specification with c++11 style.

Change-Id: I869a93ca5283f811c2aa58406f1478459e0d7022
2024-02-26 06:42:27 -08:00
Yu-Cheng Chang
47f3ad45d3 stdlib: Add get_last_exit_event_code to get m5 exit status code (#890)
Change-Id: I7319437dff24e31f343e71b6b8993f833b62147c
2024-02-23 09:09:28 -08:00
Hristo Belchev
2138a4ec92 mem: Fix LIFO q_policy and add assetions
* Fix selectPacket() in LIFO Queue Policy to correctly return the end of
  the `deque` backing store for its packet queue
* Move selectPacket() implementations for FIFO and LIFO queues into
  `q_policy.cc` file

Change-Id: I8c35e5fc83dc380b19f52be14c18b1f414f9e141
2024-02-22 21:57:08 +00:00
Yu-Cheng Chang
816ef46c78 arch-riscv: Fix fflags behavior of float inst. in O3 CPU (#868)
According to the RISC-V spec [1]. Any float-point instructions
accumulate FFLAGS register rather than write it to reflect the CSR
behavior.

In the previous implementation. We read the FFLAGS, set the exception
flags, and write the result back to the FFLAGS. This works in the gem5
simple and minor CPU model as they are actually written to `regFile`
after executing the instructions. However, in the gem5 O3 CPU model, it
will record in the `destMiscReg` buffer until the commit stage when
writing to the `miscReg` in the execution stage. The next instruction
will get the old FFLAGS and cause the incorrect result.

The CL introduced the `MISCREG_FFLAGS_EXE` and used the same size of
`miscRegFile` because the `MISCREG_FFLAGS_EXE` and `MISCREG_FFLAGS`
shared the same space. When executing the float-pointing instruction,
any exception flags should be updated via `MISCREG_FFLAGS_EXE` to
accumulate the FFLAGS in `setMiscReg` method. For the MISCREG_FFLAGS, it
should only be called in the CSROp.

[1] Syntactic Dependencies: Appendix A

c80ecada1c/src/mm-eplan.adoc (syntactic-dependencies-rules-9-11)

gem5 issue: https://github.com/gem5/gem5/issues/755

Change-Id: Ib7f13d95b8a921c37766a54a217a5a4b1ef17c6f
2024-02-22 08:33:34 -08:00
Hristo Belchev
f20ac07dde mem: Fix assertions in LRG Q policy
Fix assertions in LRG Queue Policy to correctly assert requestor and
list validity

Change-Id: I84e3f5b8936b74e7ac675faf7a3e6b9999026781
2024-02-22 14:16:20 +00:00
Harshil Patel
0f79b15b2f tests: Update checkpoint tests to new checkpoints (#888)
Change-Id: I1bf6d47017bcf77a4f93341c73de355372e1dea7
2024-02-21 16:37:28 -08:00
Jason Lowe-Power
c719ea960a arch-arm: Add FEAT_FGT trapping for debug registers (#873)
We already implemented FEAT_FGT but we were missing trapping
capabilities for trapping debug registers accesses
2024-02-21 11:27:43 -08:00
Nicholas Mosier
7ac9733199 arch-x86, cpu-kvm: initialize x87 FCW (#877)
Fix #876. The x87 floating-point control word (FCW) was not initialized
at process startup in syscall emulation mode. This resulted in floating
point exceptions in KVM mode when executing x87 floating-point
instructions.

This patch fixes the bug by initializing FCW to its reset value, 0x37F.

Change-Id: Idd1573c6951524ef59466cc5c9f1e640ea7658ae
2024-02-20 07:46:44 -08:00
wmin0
4e75e35a33 dev-arm: Remove the dependency of Platform for ArmSigInterruptPin (#878)
ArmSigInterruptPin don't send the interrupt to GIC. Instead it sends the
interrupt to the irq specified in Param. When using ArmSigInterruptPin,
we shouldn't ask users to provide "Platform" since it doesn't need it.
To reduce the confusion, this change removes the dependency of Platform
for ArmSigInterruptPin.

Change-Id: I0ee507ed1c08b4fa6d3e384e28732f3acb4f6892
2024-02-20 08:50:27 +00:00
Giacomo Travaglini
8759131df3 cpu-o3, arch: Fix SMT bug arising from v23.0 and make gem5 more robust with SMT (#828)
This PR is fixing https://github.com/gem5/gem5/issues/668. It fixes it
for all ISAs other than Arm with the first commit, which is setting the
number of architectural Matrix registers to 0 for those ISA which are
not using them.

It then partly fixes it for Arm as well with the 2nd commit: by removing
RenameMap::numFreeEntries we don't stall renaming unless a matrix
instruction is encountered... This means most binaries will run with SMT
as long as they don't use FEAT_SME instructions. Please note: this is
not simply a SMT fix, it will generally address a shortcoming in the way
we were renaming instructions.

If an Arm binary wants to use SMT with FEAT_SME, the 4th commit will
make sure the lack of physical registers is notified explicitly at the
beginning of simulation, rather than silently blocking renaming
2024-02-19 08:52:31 +00:00
Richard Cooper
308fef6b46 mem-cache: Fix possible crash in base prefetcher (#871)
When processing memory Packets for prefetch, the `PrefetchInfo` class
constructor will attempt to copy the `Packet` data. In cases where the
`Packet` under consideration does not contain data, an assertion will be
triggered in the Packet's `getConstPtr` method, causing the simulation
to crash.

This problem was first exposed by Bug #580 when processing an
`UpgradeReq` memory packet.

This patch addresses the problem by suppressing the copying of the
`Packet` data during construction of a `PrefetchInfo` object in cases
where the `Packet` has no data.

This patch addresses Bug #580 [1], which was exposed by PR #564 [2],
subsequently reverted by PR #581 [3]

[1] https://github.com/gem5/gem5/issues/580
[2] https://github.com/gem5/gem5/pull/564
[3] https://github.com/gem5/gem5/pull/581

Change-Id: Ic1e828c0887f4003441b61647440c8e912bf0fbc
Reviewed-by: Andreas Sandberg <andreas.sandberg@arm.com>
2024-02-17 14:14:57 -08:00
Giacomo Travaglini
2c0cc0040b arch-arm: Implement FEAT_FGT Debug trapping
Change-Id: I30af2b49ee604bcaa43fd419f6bc69e9ee6d9350
Signed-off-by: Giacomo Travaglini <giacomo.travaglini@arm.com>
Reviewed-by: Richard Cooper <richard.cooper@arm.com>
2024-02-15 15:58:34 +00:00
Giacomo Travaglini
683007c6ca arch-arm: Add FEAT_FGT Debug Read/Write registers
Those are supposed to control trapping for accesses to debug registers

Change-Id: I4a25a379e718ea6d5ea8ae22ac7edbeb452d1836
Signed-off-by: Giacomo Travaglini <giacomo.travaglini@arm.com>
Reviewed-by: Richard Cooper <richard.cooper@arm.com>
2024-02-15 15:58:34 +00:00
Harshil Patel
47c4dad869 arch-riscv: Remove unnecessary assert (#866)
`assert(interruptID >=0)` is always true as `interruptID` is an unsigned
int.

This was causing compilation tests failures in GCC-8 with the following
error:

```sh
src/arch/riscv/interrupts.cc:47:32: error: comparison is always true due to limited range of data type [-Werror=type-limits]
             assert(interruptID >= 0);
```

Change-Id: I356be78d7f75ea5d20d34768fb8ece0f746be2fc
2024-02-13 08:30:18 -08:00
Arnabjyoti Kalita
b826d96f40 cpu-o3: add PerThreadUnifiedThreadMap to O3 CPU (#842)
Github issue: https://github.com/gem5/gem5/issues/373

Change-Id: I1c8aba9bc5ea4e45faa6c174780904b8bd618604
2024-02-12 09:26:31 -08:00
Matt Sinclair
a840dda23a arch-vega,gpu-compute,mem-ruby: SQC Invalidation Support (#852)
This PR adds support for SQC (GPU I-cache) invalidation to the GPU
model. It does this by updating the GPU-VIPER-SQC protocol to support
flushes, the sequencer model to send out invalidates and the gpu compute
model to send invalidates and handle responses. It also adds support for
S_ICACHE_INV, a VEGA ISA instruction that invalidates the entire GPU
I-cache. Additionally, the PR modifies the kernel start behavior to
invalidate the I-cache too. It previously invalidated only the L1
D-cache.
2024-02-09 17:29:56 -06:00
Vishnu Ramadas
8054459df6 arch-vega: Add support for S_ICACHE_INV instruction
Previously, the S_ICACHE_INV instruction was unimplemented and
simulation panicked if it was encountered. This commit adds support for
executing the instruction by injecting a memory barrier in the scalar
pipeline and invalidating the ICACHE (or SQC)

Change-Id: I0fbd4e53f630a267971a23cea6f17d4fef403d15
2024-02-09 12:19:08 -06:00
Vishnu Ramadas
85680ea58e gpu-compute: Remove unused and redundant functions
In ComputeUnit, a previous commit added a  SystemHubEvent event class to
the SQCPort. This was found to be unnecessary during the review process
and is removed in this commit. Similarly, invBuf() which was added in
FetchUnit as part of an earlier commit was found to be redundant. This
commit removes it

Change-Id: I6ee8d344d29e7bfade49fb9549654b71e3c4b96f
2024-02-09 12:17:24 -06:00
Vishnu Ramadas
690b2b9462 gpu-compute, mem-ruby: Add comments and reformat code
Change-Id: Id2b3886dce347fdcfcad22009a42b92febc00a6c
2024-02-09 12:17:24 -06:00
Vishnu Ramadas
7dae25e881 configs, gpu-compute: Add parameter in shader for CUs per SQC
Change-Id: If0ae0db1b6ccc08a92f169a271b137f69f410f7b
2024-02-09 12:17:24 -06:00
Vishnu Ramadas
0e93e6142a arch-vega, gpu-compute, mem-ruby: Remove extra empty lines
Change-Id: I18770ec7e38c4a992a0ae6de95b0be49ab4426c2
2024-02-09 12:17:24 -06:00
Vishnu Ramadas
440409d807 gpu-compute: Add Icache invalidation at kernel start
Previously, the data caches were invalidated at the start of each
kernel. This commit adds support for invalidating instruction cache at
kernel launch time

Change-Id: I32e50f63fa1442c2514d4dd8f9d7689759f503d3
2024-02-09 12:16:41 -06:00
Vishnu Ramadas
03838afce0 gpu-compute: Add support for injecting scalar memory barrier
This commit adds support for injecting a scalar memory barrier in the
GPU. The barrier will primarily be used to invalidate the entire SQC
cache. The commit also invalidates all buffers and decrements related
counters upon completion of the invalidation request

Change-Id: Ib8e270bbeb8229a4470d606c96876ba5c87335bf
2024-02-09 12:14:57 -06:00
Vishnu Ramadas
23dc98ea72 mem-ruby: Add SQC cache invalidation support to GPU VIPER
This commit adds support for cache invalidation in GPU VIPER protocol's
SQC cache. To support this, the commit also adds L1 cache invalidation
framework in the Sequencer such that the Sequencer sends out an
invalidation request for each line in the cache and declares completion
once all lines are evicted.

Change-Id: I2f52eacabb2412b16f467f994e985c378230f841
2024-02-09 12:14:57 -06:00
Hristo Belchev
fd3aac1518 mem-cache: Fix circular dependency in QoS mem (#857)
This PR removes a circular dependency between `QoSMemSinkCtrl` and
`QoSMemSinkInterface` that prevented the `controller()` function of
`QoSMemSinkInterface` from being used by removing the default value for
`QoSMemSinkCtrl.interface`.

Change-Id: I4ecc39b974e239be1a2e9285e1f6f8ea873c018d
2024-02-09 11:32:16 +00:00
Saúl
7d80658a39 arch-riscv: fix vl in mask load/store (i.e vlm.v/vsm.v) (#830)
The vlm.v and vsm.v unit-stride mask load/store instructions are
constructed with an incorrect VL when the current one is larger than
than VLEN/EEW (i.e. when LMUL > 1). This commit fixes the issue for both
instructions.
2024-02-08 14:06:49 -08:00
Bobby R. Bruce
7fe1588546 arch-riscv: Fix load and store to use EEW instead of SEW (#859)
Vector unit-stride instructions have an EEW encoded directly in the
instruction, We should use that instead of SEW in vtype.

Ref:

https://github.com/riscv/riscv-v-spec/blob/master/v-spec.adoc#73-vector-loadstore-width-encoding
2024-02-08 12:14:11 -08:00
Bobby R. Bruce
b2d13ee63a util: Remove action runner add-apt-repo git-core/ppa (#856)
We were having some difficulty on a server running this
`apt-apt-repository` command due to suspected firewall issues. On
further inspection is appear to be superfluous as git can be obtained
easily through `apt-get` without adding this repository.
2024-02-08 12:13:12 -08:00
Saúl
804f137325 arch-riscv: add unit-stride fault-only-first loads (i.e. vle*ff) (#794)
This patch provides unit-stride fault-only-first loads (i.e. vle*ff) for
the RISC-V architecture.

They are implemented within the regular unit-stride load (i.e. vle*). A
snippet named `fault_code` is inserted with templating to change their
behaviour to fault-only-first.

A part from this, a new micro based on the vset\*vl\* instructions
(VlFFTrimVlMicroOp) is inserted as the last micro in the macro
constructor to trim the VL to it's corresponding length based on the
faulting index.

This trimming micro waits for the load micros to finish (via data
dependency) and has a reference to the other micros to check whether
they faulted or not. The new VL is calculated with the VL of each micro,
stopping on the first faulting one (if there's such a fault).

I've tested this with VLEN=128,256,...,16384 and all the corresponding
SEW+LMUL configurations.


Change-Id: I7b937f6bcb396725461bba4912d2667f3b22f955
2024-02-08 09:15:58 -08:00
Minje Jun
db5c71a919 mem-ruby: Pass UD on ReadShared hit only if SD is not allowed
This commit allows CompData_SD be sent when ReadShared hits on UD line and
the local cache keeps the line, unless the request doesn't allow SD.

Change-Id: I337f24c871cc4c19c5b5fb11f9b35c0a8eb7911c
2024-02-08 18:47:44 +09:00
Minje Jun
628be390a0 mem-ruby: Fix ReadShared hit handling on UD line
In case ReadShared hit on a UD line and there's no sharers, this chage
makes the downstream respond with Unique even though it doesn't deallocate
the line. This will make the requestor to UD and the downstream to UD_RU.
In the previous implementation, loosely exclusive intermediate cache can
cause loss of dirty data. Example sequence is as below.

Configurations
L2 cache: Roughly inclusive to L1 without back-invalidation
- dealloc_on_* = false
- dealloc_backinv_* = false
L3 cache: Roughly exclusive to L2 without back-invalidation
- alloc_on_readshared = tue
- alloc_on_readunique = false
- dealloc_on_shared = false
- dealloc_on_unique = true
- dealloc_backinv_* = false
- is_HN = false
LLC: Same clusivity as L3 except is_HN = true
For all caches, allow_SD = true and fwd_unique_on_readshared = false

Example problem sequence:
1. L1 sends ReadUnique then becomes UD. L2 is UC_RU. L3 and LLC are RU.
2. L1 evicts the line to L2 by WriteBackFull (UD_PD). L2 becomes UD.
3. L2 evicts the line to L3 using WriteBackFull (UD_PD). L3 becomes UD.
4. L1 reads the line with ReadShared which misses on L2.
5. L2 reads the line with ReadShared which hits on L3. L3 becomes UD_RSC
   because it doesn't deallocate the line (dataToBeInvalid=false)
6. L3 evicts the line to LLC by WriteCleanFull (UD_PD) because L3 doesn't
   back-invalidate and still has sharer. The local cache line is
   invalidated by Deallocate_CacheBlock.
   L3 becomes RUSC and LLC becomes UD_RU.
7. When UD_RU is evicted at LLC, the UD_RU line is dropped expecting the
   upstream to writeback, causing loss of dirty data.

Change-Id: Ic9bee27f2ec8906dd5df8bd3be60e5a9a76c782f
2024-02-08 18:47:44 +09:00
Minje Jun
1b5d92ee9c mem-ruby: Revert Writeback CHI UD_RU line at local evict
This reverts commit d613d814a431525e122552a667eed653a057f2be.

Change-Id: I50e218b7debf3a2836ce12515d8fcb6c0b38df53
2024-02-08 18:47:44 +09:00
Minje Jun
e141d9e4d0 mem-ruby: Writeback CHI UD_RU line at local evict
In Ruby CHI protocol UD_RU state means the line is in UD state in
the local cache and the upstream may have it in UD or UC state.
In the previous implementation UD_RU line was just dropped without
WriteBack which can cause loss of dirty data when the upstream has it
in UC state.
This commit fixes it by performing WriteBack when evciting UD_RU line.

Change-Id: I1db9b4f95cc576e71dcef38b01de24775df514ba
2024-02-08 18:47:44 +09:00
QQeg
e685c072d1 arch-riscv: Remove micro_elems in VleMicro template
Change-Id: I91267de8b1142075aa2873bfcedfd8b15c6863d4
2024-02-08 07:24:55 +00:00
QQeg
7eeac98b8d arch-riscv: Fix load and store to use EEW instead of SEW
Vector unit-stride instructions have an EEW encoded directly in the instruction,
We should use that instead of SEW in vtype.

Change-Id: I282041ce8ed57fbcca899f7497ef6c6fb2dfcf85
2024-02-07 21:11:28 +00:00
Jason Lowe-Power
4aecf9d35c stdlib: fix typo in error message (#855)
Change-Id: I28f1881d207caa36c6101eef221ef4cdd229da57

Signed-off-by: Jason Lowe-Power <jason@lowepower.com>
2024-02-06 09:50:01 -08:00
Robert Hauser
f289f9e8b5 arch-riscv: adding support for local interrupts (#813)
Besides the standard RISC-V interrupts software, timer, and external
interrupt, the RISC-V specification also offers the possibility to
implement local interrupts. With this patch, we contribute an extension
of RiscvInterrupts that enables connecting interrupt sources to the
local interrupt controller. We assigned the local interrupts to
machine-level and gave them the highest priority. If two local
interrupts are pending, there exception code will be the tie-breaker
(higher ID > lower ID). 32 Bit systems only recognize the local
interrupts 16 to 31, 64 Bit systems 16 to 63.

Change-Id: Iff8d34e740b925dce351c0c6f54f4bd37a647e0c

---------

Co-authored-by: Robert Hauser <robert.hauser@uni-rostock.de>
2024-02-06 09:38:50 -08:00
Harshil Patel
de0342128c tests: move to obtain-resources from wget (#845) 2024-02-06 09:34:03 -08:00
Bobby R. Bruce
c7426f9427 misc: Add 'workflow_dispatch' to daily tests (#850)
This allows us to manually trigger daily test runs rather than wait for
the scheduled time. This can be useful in cases where a fix for a broken
test is pushed and we wish to verify it works as intended ASAP.
2024-02-06 09:32:31 -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