Commit Graph

21851 Commits

Author SHA1 Message Date
Jarvis Jia
ccdfe00998 gpu-compute: Added functions to choose replacement policies for GPU
Adding RP_choose functions to change replacement policies among
TreePLRU, LRU, FIFO, LFU, LIP, MRU, NRU, RRIP, SecondChance AND ShiPMem replacement
policies for TCC, TCP and SQC caches for GPU

Change-Id: If84a13babf1006ad41a557747c45d48ce2ce22a9
2024-06-10 16:22:41 -05:00
Jarvis Jia
3c8c783bc3 gpu-compute: Added functions to choose replacement policies for GPU
Adding RP_choose functions to change replacement policies among
TreePLRU, LRU, FIFO, LFU, LIP, MRU, NRU, RRIP, SecondChance AND ShiPMem replacement
policies for TCC, TCP and SQC caches for GPU
2024-06-10 15:13:21 -05:00
Jarvis Jia
c158ce22bf gpu-compute: Added functions to choose replacement policies for GPU
Adding RP_choose function to change replacement policies among
TreePLRU, LRU, FIFO, LFU, LIP, MRU, NRU, RRIP, SecondChance AND ShiPMem replacement
policies  for TCC, TCP and SQC caches for GPU
2024-06-10 15:11:17 -05:00
Jarvis Jia
7c410797d1 Adding functions to choose replacement policies for GPU
Adding RP_choose functions to change replacement policies among
TreePLRU, LRU, FIFO, LFU, LIP, MRU, NRU, RRIP, SecondChance AND ShiPMem replacement
policies  for TCC, TCP and SQC caches for GPU
2024-06-10 14:09:09 -05:00
Jarvis Jia
5b44eca64e Adding functions to choose replacement policies for GPU
Adding RP_choose functions to change replacement policies among
TreePLRU, LRU, FIFO, LFU, LIP, MRU, NRU, RRIP, SecondChance AND ShiPMem replacement
policies  for TCC, TCP and SQC caches for GPU
2024-06-10 13:58:24 -05:00
Alexander Richardson
3cfc550fc0 arch-arm,mem: Don't hardcode secure mode accesses for semihosting (#1200)
When accessing memory using functionalAccess(), the MMU could tell us to
use a nonsecure access even though the CPU is operating in secure mode.
I noticed this while trying to run a simple semihosting hello world with
the MMU+caches enabled and the semihosting calls ended up reading from
memory instead of the caches due to an S/NS mismatch.

See also https://github.com/gem5/gem5/pull/1198 which happens to also
mask the issue I saw, but I believe both changes are needed.

Change-Id: I9e6b9839b194fbd41938e2225449c74701ea7fee
2024-06-09 14:08:54 -07:00
Saúl
5cfad84a98 arch-riscv: correctly set dynamic VLEN for all arith instructions (#1187)
Some arithmetic instructions of the riscv vector extension where still
using the default VLEN=256 instead of the dynamic one through the
inherited `vlen` attribute. Most of them only use this to calculate the
effective index for the mask element like so:

```
uint32_t ei = i + vtype_VLMAX(vtype, vlen, true) * this->microIdx;
if (this->vm || elem_mask(v0, ei)) {
...
```

This means that instructions will wrongly compute the mask index in the
second and subsequent micro instructions (`microIdx` > 0). This commit
fixes this by adding the corresponding `set_vlen` snippet to the
affected instruction formats.

Change-Id: Ib041de972d6938490741a9fb4c214a6a5172c34e
2024-06-07 22:33:56 -07:00
Alexander Richardson
ec5881ec4e arch-arm: avoid using an uninitialized variable use in MMU walks (#1198)
While running a simple Arm32 binary, I noticed that all memory
transactions were being marked as NS instead of S once I turn on the MMU
(even though the page tables have the NS bit set to zero). The result of
this was that semihosting calls were failing since they were using
functional accesses with the SECURE flag set, but the caches only
contained NS tagged entries so these accesses always read stale values
from DRAM.

Digging through the Arm MMU code it appears that the NS bit lookup was
being keyed of the `secureLookup` flag which is only used for long
descriptors. I believe 0c28712f51 should
have used isSecure instead of secureLookup. To avoid using these
uninitialized values in the future I wrapped the LPAE state in a
std::optional to ensure that it is only accessed once initialized.

Change-Id: Ibc406ed3f4cfa768f470e34a5eca3c1a2bf45cd8
2024-06-07 08:59:28 +01:00
Alexander Richardson
8e5fbcbbbb arch-generic: flush streams after semihosting write calls (#1202)
The SYS_WRITEC and SYS_WRITE0 calls are specified as writing to the
debug channel, so it is a reasonable expectation for these messages to
be visibile immediately after the semihosting call.

Change-Id: I8e6e9a7aab593a59e82ecb9cf4603c18c7a8acbe
2024-06-06 09:57:36 +01:00
Alexander Richardson
abbb94af8b dev-arm: Fix -Wdeprecated-copy warning (#1197)
Clang warns as follows: `warning: definition of implicit copy
constructor for 'TranslResult' is deprecated because it has a
user-declared copy assignment operator`

Change-Id: Ic701d8522aac75d569f4f513f54de91f76a17e48
2024-06-05 12:36:38 +01:00
Ivana Mitrovic
a764b9be1c Revert "arch-x86: Fix TLB Assertion Error on CFLUSH" (#1196)
Reverts gem5/gem5#1080 as it is not a good fix.
2024-06-04 10:26:53 -07:00
Hoa Nguyen
40ef8f3afb dev: Remove an extra file in virtio (#1191)
`src/dev/virtio/VirtIORng 2.py` is identical to
`src/dev/virtio/VirtIORng.py`, and the former does not appear in any
build script.

Change-Id: I9c5f1b1a3809d1c7028b630c32310e540613e232

Signed-off-by: Hoa Nguyen <hn@hnpl.org>
2024-06-04 08:40:41 -07:00
dependabot[bot]
500bdc5302 misc: bump tqdm from 4.66.3 to 4.66.4 (#1192)
Bumps [tqdm](https://github.com/tqdm/tqdm) from 4.66.3 to 4.66.4.

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-06-04 06:35:35 -07:00
dependabot[bot]
8c98dcb7cf misc: bump pre-commit from 3.7.0 to 3.7.1 (#1193)
Bumps [pre-commit](https://github.com/pre-commit/pre-commit) from 3.7.0
to 3.7.1.

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-06-04 06:34:53 -07:00
Lukas Zenick
dad5c7b6f7 arch-x86: Fix TLB Assertion Error on CFLUSH (#1080)
Fixed the assertion statement in the cpu's translation.hh file so that
it doesn't fail the assertion if the cache is clean.

I compile this c code to `test`
```c
#include <stdio.h>

static inline void clflush(volatile void *p) {
    __asm__ volatile ("clflush (%0)" : : "r"(p) : "memory");
}

int main() {
    int data = 42;  // Example variable

    printf("Value before clflush: %d\n", data);

    clflush(&data);

    printf("Value after clflush: %d\n", data);

    return 0;
}
```
And run it with this script
`./build/X86/gem5.opt configs/learning_gem5/part1/two_level.py ./test`
In order to verify that it no longer fails the assertion check.

GitHub Issue: #862 
Change-Id: I6004662e7c99f637ba0ddb07d205d1657708e99f
2024-06-03 10:17:10 -07:00
Yu-Cheng Chang
5d3f1c3316 arch-riscv: Add rvZext to BranchTarget (#1173)
Ensure the upper xlen bits are all zeros

Change-Id: Id81330eced907d21320bc1af85ad38fb6e95f6b1
2024-06-03 10:03:51 -07:00
Ivana Mitrovic
fe8daa85d6 arch-vega: More scratch, accvgpr instructions (#1190)
- Implements the remaining scratch instruction which have corresponding
flat implementations
- Implements the remaining v_accvgpr instructions.
2024-06-03 08:56:32 -07:00
Matthew Poremba
00dcd5b0bc arch-vega: Implement literals for 64b dest operands
This feature has been available since Vega10 but was never implemented.
MI300 adds a few new instructions that make use of this more often
(e.g., v_mov_b64).

Change-Id: Ieeb7834462b76d77c0030f49622d0de09f90c9e4
2024-05-31 13:41:46 -07:00
Matthew Poremba
6c8caf83c6 arch-vega: Implement V_ACCVGPR_MOV_B32 instruction
This instruction is a simple move from accumulation register to
accumulation register. It is essentially a move with the accumulation
offset added to the register index.

Change-Id: Ic93ae72599b75c91213f56ebafe5bbd7b2867089
2024-05-31 09:32:35 -07:00
Matthew Poremba
7cdb69bf21 arch-vega: Fill in scratch insts to match flat/global
Flat, scratch, and global share the same instruction implementation with
different address calculations essentially. These instructions were
already implemented but not added to the decoder. This commit adds the
remaining scratch instructions which have a shared instruction
implementation.

Change-Id: I8f2e9ceb221294dce1b81c45745b642f0592d985
2024-05-31 09:32:34 -07:00
Bobby R. Bruce
fd0e6acc94 misc: Fix daily-tests
1. Typo in container.
2. Add compression level to minimize size of generated artifact.

Change-Id: I854e814162fb434ad50a64e3070b943905e4134b
2024-05-30 10:19:17 -07:00
Bobby R. Bruce
3b7307182f misc: Fix daily-tests
1. Typo in container.
2. Add compression level to minimize size of generated artifact.

Change-Id: I854e814162fb434ad50a64e3070b943905e4134b
2024-05-30 10:15:35 -07:00
Bobby R. Bruce
a0de33110b arch-vega: Fix clang comp error due to constant exp (#1183)
The lines `constexpr int B_I = std::ceil(64.0f / (N * M / H));` caused
the following compilation error in clang Version 16:

```
error: constexpr variable 'B_I' must be initialized by a constant
expression
```

`std::ceil` is not a const expression. Therefore instances of this
expression in instructions.hh have been replaced with a constant
expression friendly alternative.

This is calling our compiler tests to fail:
https://github.com/gem5/gem5/actions/runs/9288296434/job/25559409142

Change-Id: I74da1dab08b335c59bdddef6581746a94107f370
2024-05-30 09:44:34 -07:00
NSurawar
efbfdeabd7 mem-ruby: Reduce handshaking between CorePair and dir (#1117)
Currently when data is downgraded by MOESI_AMD_Base-CorePair (e.g. due
to a replacement) this requires a 4-way handshake between the CorePair
and the dir. Specifically, the CorePair send a message telling the dir
it'd like to downgrade then, the dir sends an ACK back and then, the
CorePair writes the data back, and finally, the dir ACKs the writeback.
This is very inefficient and not representative of how modern protocols
downgrade a request. Accordingly, this commits updates the downgrade
support such that the CorePair writes back the data immediately and then
the dir ACKs it.
Thus, this approach requires only a 2-way handshake.

Change-Id: I7ebc85bb03e8ce46a8847e3240fc170120e9fcd6

Co-authored-by: Neeraj Surawar <neerajs@hyrule.cs.wisc.edu>
2024-05-30 09:36:29 -07:00
Bobby R. Bruce
ef2a9110b7 misc: Merge .github dir develop -> stable (#1189) 2024-05-30 07:48:47 -07:00
Bobby R. Bruce
7c1207d5c4 misc: Another attempt to fix the merge-upload in for daily (#1188)
Change-Id: I6a6064ec3b5be4ac1f7d6cd3c2f6c0ca62d2cfcd
2024-05-30 07:45:35 -07:00
Bobby R. Bruce
bbdaae540c misc: Sync .github dir to stable (#1185) 2024-05-30 04:29:55 -07:00
Bobby R. Bruce
65b86cfac9 misc: Fix daily tests merge-artifacts (#1184) 2024-05-30 04:27:40 -07:00
Bobby R. Bruce
c0a64c4862 stdlib: Move SimStat specific varibale sets out of loop
Change-Id: I6e1f4c01a52ae904e9a6c6582b5b413f94c1cb05
2024-05-30 03:03:29 -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
2d4a213046 stdlib: Make PyStat SimStat inherit from Group
The SimStat Object is nothing more than a group of other SimStats and is
therefore logically a group. With this, functionality can be shared more
easily.

Change-Id: I5dce23a02d5871e640b422654ca063e590b1429a
2024-05-30 02:56:13 -07:00
ylldummy
7fa0342a7c mem-cache: Fix maybe-uninitialized warning (#1179)
When compiler tries to inline a vector construction with a default value
as default constructed ReplaceableEntry. It can complain about the
uninitialized member.

Let's provide basic initialization to the members.

Example codepath:
 SignaturePathV2 constructor
 -> GlobalHistoryEntry() as init_value to AssociativeSet
 -> AssociativeSet initialize vector<Entry> with init_value
2024-05-29 10:41:35 -07:00
Bobby R. Bruce
6d174c43e4 stdlib: Expand and simplify PyStats __init__.py
1. Adds newly added PyStat classes to "__init__.py", ensuring they can
   all be accessed via a `m5.ext.pystats` import.
2. Simplifies the layout out "__init__.py" to just import all classes
   from all files.

Change-Id: I43bfc5e7ff1aec837e661905304c6fb10b00c90e
2024-05-29 08:22:49 -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
b161172f65 arch-arm: Fix memory attributes of table walks (#1180)
This PR is doing the following:

1) Fixing memory attributes of partial translation entries (table walks)
2) Properly setting the cacheability of table walks
2024-05-29 08:07:44 -07:00
Nicholas Mosier
9027d5c3e2 arch-x86: set AF=0 when logical instructions execute (#1171)
Fix #1168. Prevent logical instructions like AND, OR, and TEST from
having input dependencies on the previous value of the Zaps register
(ZF+AF+PF+SF) by having them set AF=0, rather than not modifying AF.
2024-05-29 08:04:44 -07:00
shinezyy
7d339ee79b util: allow to override ARCH in cxx config's Makefile (#1165)
allow to override ARCH in cxx config's Makefile

gem5 issue: #1164
2024-05-29 07:55:48 -07:00
Bobby R. Bruce
ce0bb4655c util-docker,gpu,gpu-compute: Improve GCN-GPU Dockerfile (#1170)
* The GCC used in the GCN-GPU images was increase from version 8 to 
  version 10. This was necessary due to PR #1145 which made GCC require
GCC >=10. This patch was previously part of #1161 but has been merged
into
  this PR.
* A patch has been applied to ROCm-OpenCL-Runtime to fix a linking error
  in which there were multiple definitions of `ret_val`. This issue is
highlighted here:
https://github.com/ROCm/ROCm-OpenCL-Runtime/issues/113.
  This was previously part #1161 but has been moved into this PR.
* The Dockerfile's `RUN` command (built to layers in the Docker image)
  have been refactored so sources and built objects are deleted in the
  same RUN command as where they were built and installed. This reduces
  the size of the image substantially: from 16.3GB down to 6.6GB.
* The `apt upgrade` has been removed. This step (previously at the start
  of the file) did nothing of importance. Removing it saves both time
building the image and reduces the size of the image by a small amount.
* `--depth=1` is used when cloning repositories so the entire commit
tree
  tree is not pulled each time. This saves some time when building the
  image.
* `apt -y update` has been added  where `apt -y install` is used so
  CACHED image layers do not become an issue in the future if the image
  were to be rebuilt.
2024-05-29 07:54:28 -07:00
Nicholas Mosier
a54d3198a8 arch-x86: break 32/64-bit mov's input dependency on prior dest value (#1172)
Fix #1169. Break the input dependency of 32-bit and 64-bit 'mov'
micro-ops on the prior value in the destination register. Such a
dependency is required for 8-bit and 16-bit moves, as they do not
completely overwrite the value in the destination register. However, it
is unnecessary for 32-bit moves (which implicitly zero the upper 32
bits) and 64-bit moves.

This patch implements the fix by adding a new code template field inside
the generated constructors of X86StaticInst's, called `invalidate_srcs`,
which instruction implementations like `mov` can use to conditionally
invalidate particular source registers as needed. In `mov`'s case, this
is when the data size is 32 or 64 bits.

Change-Id: Ib2aef6be6da08752640ea3414b90efb7965be924
2024-05-29 07:54:03 -07:00
Bobby R. Bruce
8404ae276b misc: Sync .github develop -> stable (#1181) 2024-05-29 07:48:13 -07:00
Matthew Poremba
07f6b7c59c dev-amdgpu: Fix pending PCI RLC doorbell (#1157)
SDMA RLC queues do not currently remove their doorbell mapping. This can
cause issues re-registering the queue and prevents the pending doorbells
feature from working. In addition the data value of the doorbell (the
ring buffer rptr) is not saved, leading to UB when this workaround is
used.

This commit removes the doorbell mapping from the gpu device when the
SDMA engine unmaps an RLC queue and copies the next doorbell value to
the pending packet as was originally intended.

Change-Id: Ifd551450f439c065579afcf916f8ff192e7598ab
2024-05-29 07:15:46 -07:00
Giacomo Travaglini
c4ed23a10b arch-arm: Implement HCR_EL2 force broadcast for EL1&0 TLBIs (#1175)
According to the Arm architecture reference manual, it is possible to
force the broadcast of the following TLBIs:

AArch64: TLBI VMALLE1, TLBI VAE1, TLBI ASIDE1, TLBI VAAE1, TLBI VALE1,
TLBI VAALE1, IC IALLU, TLBI RVAE1, TLBI RVAAE1, TLBI RVALE1, and TLBI
RVAALE1.

AArch32: BPIALL, TLBIALL, TLBIMVA, TLBIASID, DTLBIALL, DTLBIMVA,
DTLBIASID, ITLBIALL, ITLBIMVA, ITLBIASID, TLBIMVAA, ICIALLU, TLBIMVAL,
and TLBIMVAAL.

Via the HCR_EL2.FB bit

Change-Id: Ib11aa05cd202fadfbd9221db7a2043051196ecbd

Signed-off-by: Giacomo Travaglini <giacomo.travaglini@arm.com>
2024-05-29 11:54:24 +01:00
Giacomo Travaglini
e9dcb906b4 arch-arm: Set memory attributes for partial table entries
Change-Id: I80adcead410f226c323e4d781adb1ff17a386986
Signed-off-by: Giacomo Travaglini <giacomo.travaglini@arm.com>
2024-05-29 09:30:58 +01:00
Giacomo Travaglini
09f0c20be2 arch-arm: Use HCR_EL2.CD for stage2 table walks
When determining the cacheability of table walks,
SCTLR.C should only be used in stage1 EL1&0 translations.
Stage2 translations should rely on HCR_EL2.CD instead

Change-Id: I1b0830bc3fb5086f68d7a7a1560c7fed5d126d28
Signed-off-by: Giacomo Travaglini <giacomo.travaglini@arm.com>
2024-05-29 09:30:58 +01:00
Giacomo Travaglini
854662f48f arch-arm: Check OSH domain as well for cacheability attribute
Make table walks uncacheable if marked as uncacheable
in either inner or outer shareable domain

Change-Id: I5898a3b91b5b919e0beda6c6fe896394e3ab94df
Signed-off-by: Giacomo Travaglini <giacomo.travaglini@arm.com>
2024-05-29 09:30:58 +01:00
Bobby R. Bruce
4acc20dac1 misc,tests: Download all gem5 bins via one artifact (#1178)
The Daily Tests are failing when downloading artifacts as part of the
`testlib-long-tests` matrix:
https://github.com/gem5/gem5/actions/runs/9250821764/job/25448583827.

It _could_ be that since upgrading to `actions/download@v4`, we're
hitting a limit as the `testlib-long-tests` are downloading every gem5
binary compiled in the `build-gem5` step, each with it's own
`actions/download` step, for every test.

This change adds a small job after `build-gem5` which creates a merged
artifact containing all the gem5 binaries then uses this to lessen the
number of times this action is called in such a short period of time.

Even if the bug still persists, this solution is neater than what was
there previously.
2024-05-28 12:55:30 -07:00
Matthew Poremba
e82cf20150 mem-ruby: Remove VIPER StoreThrough temp cache storage (#1156)
StoreThrough in VIPER when the TCP is disabled, GLC bit is set, or SLC
bit is set will bypass the TCP, but will temporarily allocate a cache
entry seemingly to handle write coalescing with valid blocks. It does
not attempt to evict a block if the set is full and the address is
invalid. This causes a panic if the set is full as there is no spare
cache entry to use temporarily to use for DataBlk manipulation. However,
a cache block is not required for this.

This commit removes using a cache block for StoreThrough with invalid
blocks as there is no existing data to coalesce with. It creates no
allocate variants of the actions needed in StoreThrough and pulls the
DataBlk information from the in_msg instead. Non-invalid blocks do not
have this panic as they have a cache entry already.

Fixes issues with StoreThroughs on more aggressive architectures like
MI300.

Change-Id: Id8687eccb991e967bb5292068cbe7686e0930d7d
2024-05-28 11:02:00 -07:00
Ivana Mitrovic
5ec1acaf5f arch-arm: TLBIs targeting EL2 regime are executable from S state (#1176)
Those AArch64 instructions/registers were labelled as executable
from EL3 only if SCR_EL3.NS == 1. This is not valid anymore
after the introduction of FEAT_SEL2
2024-05-28 10:54:18 -07:00
Matthew Poremba
1dfaa224ff arch-vega: Fix GCC 13 build errors (#1162)
The new static analysis in GCC 13 finds issues with operand.hh. This
commit fixes the error so that gem5 compiles when BUILD_GPU is true.

Change-Id: I6f4b0d350f0cabb6e356de20a46e1ca65fd0da55
2024-05-28 07:58:28 -07:00
Giacomo Travaglini
27c7647fee arch-arm: Use monWrite a shorter version
Change-Id: I8da8a39238eb100315d3df496f55a6bf3da948c6
Signed-off-by: Giacomo Travaglini <giacomo.travaglini@arm.com>
2024-05-28 11:20:52 +01:00