Commit Graph

14336 Commits

Author SHA1 Message Date
Bobby R. Bruce
7aa896fe8f cpu-minor: Separate the reg_index of VecClassReg and VecElemReg (#225)
In the RISC-V system, we need to VecClassReg to run RISC-V vector
instruction, and VecElemReg is not applicable because the element length
of vector can be resizable via vset\*vl\* instruction.

The change will seperate the reg_index for VecReg and VecElemReg to
ensure that have the space for VecReg when VecElemReg is not applicable.
2023-08-24 10:13:21 -07:00
Giacomo Travaglini
56a8ab3f3c sim: provide a signal constructor with an init_state (#210)
The current SignalSinkPort and SignalSourcePort have no ways to assign
the init value of the state. Add a new constructor for them with the
param init_state

Bug: 293410800
Test: boot to linux
Change-Id: Idde0a12aa0ddd0c9c599ef47059674fb12aa5d68
Reviewed-on:
https://soc-sim-external-review.googlesource.com/c/gem5/gem5/+/13159
Gem5-Virtual-Platform-Presubmit-Ready: Johnny Ko <johnnyko@google.com>
Reviewed-by: Yu-hsin Wang <yuhsingw@google.com>
Perf-Presubmit-Ready: Johnny Ko <johnnyko@google.com>
Gem5-Virtual-Platform-Verified: kokoro <noreply+kokoro@google.com>
Perf-Verified: kokoro <noreply+kokoro@google.com>
2023-08-24 18:06:21 +01:00
Bobby R. Bruce
e77666d9e8 mem-ruby: fix CHI Evict race condition (#217)
When an Evict request is received from upstream for a shared line and
the line is no longer cached locally (or on any other upstream cache),
we need to also send an Evict downstream. In this case we need to wait
until our outgoing Evict completes before completing the Evict from
upstream in order be able to resolve race conditions with incoming
snoops. E.g.: while our outgoing Evict is pending we may receive a snoop
requesting data, but we won't be able to complete this snoop if we have
already completed all upstream Evicts and we no longer have the line.
2023-08-24 10:04:28 -07:00
Roger Chang
5c28113a06 cpu-minor: Separate the reg_index of VecClassReg and VecElemReg
In the RISC-V system, we need to VecClassReg to run RISC-V vector
instruction, and VecElemReg is not applicable because the element
length of vector can be resizable via vset*vl* instruction.

The change will seperate the reg_index for VecReg and VecElemReg to
ensure that have the space for VecReg when VecElemReg is not
applicable.

Change-Id: I99a82dec273baeee31df89a0ee0f5e87f3ff187c
2023-08-24 13:27:27 +08:00
Matthew Poremba
90a518e885 gpu-compute,arch-vega: Fix ALU-only LDS counters
There are a few LDS instructions that perform local ALU operations and
writeback which are marked as loads. These are marked as loads because
they fit in the pipeline logic better, according to a several year old
comment. In the VEGA ISA these instructions (swizzle, permute, bpermute)
are not decrementing the LDS load counter. As a result, the counter will
gradually increase over time. Since wavefront slots are persistent, this
can cause applications with a few thousand kernels to eventually hang
thinking there are not enough resources.

This changeset fixes this by decrementing the LDS load counter for these
instructions. This fix was already integrated in the GCN3 ISA in the
exact same way. This changeset moves it near a similar comment about
scheduling register file writes.

Change-Id: Ife5237a2cae7213948c32ef266f4f8f22917351c
2023-08-23 19:30:24 -05:00
Reiley Jeyapaul
c9ff54677f mem-ruby: fix CHI Evict race condition
When an Evict request is received from upstream for a shared line
and the line is no longer cached locally (or on any other upstream
cache), we need to also send an Evict downstream. In this case we need
to wait until our outgoing Evict completes before completing the Evict
from upstream in order be able to resolve race conditions with incoming
snoops. E.g.: while our outgoing Evict is pending we may receive a
snoop requesting data, but we won't be able to complete this snoop if
we have already completed all upstream Evicts and we no longer have the
line.

Change-Id: I23ac4f0a9c4ddd81e2425376c8d1e1c7fb66d107
Signed-off-by: Tiago Mück <tiago.muck@arm.com>
2023-08-23 15:49:51 -05:00
Johnny
76fe71ebd0 sim: provide a signal constructor with an init_state
Add more description to the code

Change-Id: Iff8fb20762baa0c9d0b7e5f24fb8769d7e198b5c
2023-08-23 10:49:15 +08:00
Johnny
6acb687975 sim: provide a signal constructor with an init_state
1. The current SignalSinkPort and SignalSourcePort have no
   ways to assign the init value of the state. Add a new constructor
   for them with the param init_state
2. After the source and sink are bound, the state at both side should
   be the same. Set the the state of sink to the state of source in the
   bind() function.

Change-Id: Idde0a12aa0ddd0c9c599ef47059674fb12aa5d68
2023-08-23 10:12:41 +08:00
Jason Lowe-Power
e3414c7098 base: Make 'findLsbSetFallback' constexpr to fix gcc-8 comp (#203)
Compilation bug found on:
https://github.com/gem5/gem5/actions/runs/5899831222/job/16002984553

In gcc Version 8 and below the following error is received:

```
src/base/bitfield.hh: In function ‘constexpr int gem5::findLsbSet(uint64_t)’:
src/base/bitfield.hh:365:34: error: call to non-‘constexpr’ function ‘int gem5::{anonymous}::findLsbSetFallback(uint64_t)’
         return findLsbSetFallback(val);
                ~~~~~~~~~~~~~~~~~~^~~~~
scons: *** [build/ALL/kern/linux/events.o] Error 1
```

`findLsbSet` cannot be `constexr` as it calls non-constexpr function
`findLsbSetFallback`. `findLsbSetFallback`. The problematic function is
the `count` on the std::bitset.

This patch changes this to a constexpr.
2023-08-22 11:23:59 -07:00
Bobby R. Bruce
709f632730 base: Make 'findLsbSetFallback' constexpr to fix gcc-8 comp
Compilation bug found on:
https://github.com/gem5/gem5/actions/runs/5899831222/job/16002984553

In gcc Version 8 and below the following error is received:

```
src/base/bitfield.hh: In function ‘constexpr int gem5::findLsbSet(uint64_t)’:
src/base/bitfield.hh:365:34: error: call to non-‘constexpr’ function ‘int gem5::{anonymous}::findLsbSetFallback(uint64_t)’
         return findLsbSetFallback(val);
                ~~~~~~~~~~~~~~~~~~^~~~~
scons: *** [build/ALL/kern/linux/events.o] Error 1
```

`findLsbSet` cannot be `constexr` as it calls non-constexpr function
`findLsbSetFallback`. `findLsbSetFallback`. The problematic function is
the `count` on the std::bitset.

This patch changes this to a constexpr.

Change-Id: I48bd15d03e4615148be6c4d926a3c9c2f777dc3c
2023-08-21 14:04:36 -07:00
Hoa Nguyen
9e007e5bd7 mem-cache: fix wrong function call
Change-Id: I924ede89f373ec21557faf25c96b36f4bc8430dd
Signed-off-by: Hoa Nguyen <hn@hnpl.org>
2023-08-19 22:56:55 +00:00
Hoa Nguyen
f442846d9d mem-cache: Fix another typo
Change-Id: Ib2051f9bda6e6d9002d3be1dbf0b890299098201
Signed-off-by: Hoa Nguyen <hn@hnpl.org>
2023-08-19 22:50:53 +00:00
Hoa Nguyen
7b897a30fa mem-cache: Fix syntax error
Change-Id: I1360879c13d377661e9eeeddf345b785c01efeb6
Signed-off-by: Hoa Nguyen <hn@hnpl.org>
2023-08-19 21:27:53 +00:00
Hoa Nguyen
98daec7d99 mem-cache: Allow clflush's uncacheable requests on classic cache
When a linux kernel changes a page property, it flushes the related cache
lines. The kernel might change the page property before flushing the
cache lines. This results in the clflush might occur in an uncacheable region.

Currently, an uncacheable request must be a read or a write. However,
clflush request is neither of them.

This change aims to allow clflush requests to work on uncacheable regions.
Since there is no straightforward way to check if a packet is from a clflush
instruction, this change permits all Clean Invalidate Requests, which is
the type of request produced by clflush, to work on uncacheable regions.

Change-Id: Ib3ec01d9281d3dfe565a0ced773ed912edb32b8f
Signed-off-by: Hoa Nguyen <hn@hnpl.org>
2023-08-19 18:20:16 +00:00
Bobby R. Bruce
30ab2c19b1 stdlib: Allow passing of func as Exit Event generator (#195)
In this case the function is turned into a generator with the "yield" of
the generator the return the function's execution.

Translation of this stale Gerrit Change:
https://gem5-review.googlesource.com/c/public/gem5/+/62872
2023-08-18 10:55:50 -07:00
Bobby R. Bruce
c0216dbe48 stdlib: Allow passing of func as Exit Event generator
In this case the function is turned into a generator with the
"yield" of the generator the return the function's execution.

Change-Id: I4b06d64c5479638712a11e3c1a2f7bd30f60d188
2023-08-17 16:48:33 -07:00
Jason Lowe-Power
22c52f4fba Fix reporting traps (faults) to GDB in SE mode (#166)
This addresses #123
2023-08-17 16:08:49 -07:00
Jan Vrany
3564348eec arch-riscv: Report traps to GDB in SE mode
This commit add code to report illegal instruction and breakpoint traps
to GDB (if connected). This merely follows what POWER does.
2023-08-17 15:55:04 +01:00
Jan Vrany
546b3eac7d arch-riscv: Do not advance PC when handling faults in SE mode
On RISC-V when trap occurs the contents of PC register contains the
address of instruction that caused that trap (as opposed to the address
of instruction following it in instruction stream). Therefore this commit
does not advance the PC before reporting trap in SE mode.

Change-Id: I83f3766cff276312cefcf1b4ac6e78a6569846b9
2023-08-17 15:55:04 +01:00
Jan Vrany
fde58a4365 arch-power: Fix reporting traps to GDB
Due to inverted logic in POWER fault handlers, unimplemented opcode and
trap faults did not report trap to GDB (if connected). This commit fixes
the problem.

While at it, I opted to use `if (! ...) { panic(...) }` rather than
`panic_if(...)`. I find it easier to understand in this case.

Change-Id: I6cd5dfd5f6546b8541d685e877afef21540d6824
2023-08-17 15:55:04 +01:00
Roger Chang
fe142f485a arch-riscv: Add missing vector required check for vmem instructions
The mem instructions usually executed from initiateAcc. We also need
to check vector required in those instructions

Change-Id: I97b4fec7fada432abb55ca58050615e12e00d1ca
2023-08-17 09:53:30 +08:00
Roger Chang
35a6fe6f3d arhc-riscv: Check vill in vector mem instructions
Any vector instructions using vtype should check vill flag is set

Change-Id: Ia9a2695f3005a176422da78e6f413cc789116faa
2023-08-17 09:53:30 +08:00
Bobby R. Bruce
3ff6fe0e90 arch-x86,cpu-kvm: Fix gem5.fast due to unused variable (#189)
Detected via this failing workload:
https://github.com/gem5/gem5/actions/runs/5861958237

Ir caused the following compilation error to be thrown:

```
src/arch/x86/kvm/x86_cpu.cc:1462:22: error: unused variable ‘rv’ [-Werror=unused-variable]
 1462 |                 bool rv = isa->cpuid->doCpuid(tc, function, idx, cpuid);
      |                      ^~
```

`rv` is unused in the .fast compilation as it's only used in the
`assert` statement immediately after.

To fix this, the `[[maybe_unused]]` annotation is used.
2023-08-16 12:52:44 -07:00
Bobby R. Bruce
c835c9faa3 arch-x86,cpu-kvm: Fix gem5.fast due to unused variable
Detected via this failing workload:
https://github.com/gem5/gem5/actions/runs/5861958237

It caused the following compilation error to be thrown:

```
src/arch/x86/kvm/x86_cpu.cc:1462:22: error: unused variable ‘rv’ [-Werror=unused-variable]
 1462 |                 bool rv = isa->cpuid->doCpuid(tc, function, idx, cpuid);
      |                      ^~
```

`rv` is unused in the .fast compilation as it's only used in the
`assert` statement immediately after.

 To fix this, the `[[maybe_unused]]` annotation is used

Change-Id: Ib98dd859c62f171c8eeefae93502f92a8f133776
2023-08-16 10:06:39 -07:00
Matthew Poremba
bc9bbc10f0 gpu-compute: Change kernel-based exit location (#184)
The previous exit event occurs when the dispatcher sends a completion
signal for a kernel, but gem5 does some kernel-based stats updates after
the signal is sent. Therefore, if these exit events are used as a way to
dump per-kernel stats, some of the stats for the kernel that just ended
will be in the next kernel's stat dump which is misleading.

This patch moves the exit event to where the stats are updated and only
exits if the dispatcher has requested a stat dump to prevent situations
where stats are updated mid-kernel.

Change-Id: I74dc1cad5fc90382a2a80564764b3e7c9fb65521
2023-08-16 07:38:12 -07:00
Andreas Sandberg
f6d44ac7b3 fastmodel: Add option to retry licence server connection. (#183)
We're seeing some occasional connection timeouts in CI, possibly when we
aggressively hit the license server, so let's add a parameter to retry
the connection a few times.

Also, print the time required to connect to the server to help debug
issues.
2023-08-16 10:08:59 +01:00
Bobby R. Bruce
9ee400ff92 mem: Port trace in xbar when address error (#180)
When xbar encounters the address error, print out the port trace in the
packet for user to debug if the port trace is enabled.

To gain the packet of the access, the parameter of findPort() function
is changed from AddrRange to PacketPtr.

When running gem5 with "--debug-flags=PortTrace", we can see the full
path of the unexpected access when xbar cannot find the destination of
the address.
2023-08-15 23:27:17 -07:00
Mahyar Samani
d869018226 mem: Fixing memory size type issue in port proxy.
This patch changes the data type used for image size from int
to uint64_t. Current version allows initializing AbstractMemory
types with a maximum binary size of 2GiB. This will be limiting
in many studies.

Change-Id: Iea3bbd525d4a67aa7cf606f6311aef66c9b4a52c
2023-08-15 12:40:45 -07:00
Matthew Poremba
df4739929d gpu-compute: Change kernel-based exit location
The previous exit event occurs when the dispatcher sends a completion
signal for a kernel, but gem5 does some kernel-based stats updates after
the signal is sent. Therefore, if these exit events are used as a way to
dump per-kernel stats, some of the stats for the kernel that just ended
will be in the next kernel's stat dump which is misleading.

This patch moves the exit event to where the stats are updated and only
exits if the dispatcher has requested a stat dump to prevent situations
where stats are updated mid-kernel.

Change-Id: I74dc1cad5fc90382a2a80564764b3e7c9fb65521
2023-08-15 11:06:26 -05:00
Nicolas Boichat
3ea7a792b0 fastmodel: Add option to retry licence server connection.
We're seeing some occasional connection timeouts in CI, possibly
when we aggressively hit the license server, so let's add a
parameter to retry the connection a few times.

Also, print the time required to connect to the server to help
debug issues.

Change-Id: I804af28f79f893fcdca615d7bf82dd9b8686a74c
2023-08-15 10:47:32 +00:00
Yan Lee
96d80a41d2 mem: dump out port trace when address decode error
1. Add findPort(PacketPtr pkt) for getting the port trace from the Packet.
   Keep the findPort(AddrRange addr_range) for recvMemBackdoorReq(...)
2. With the debug flag `PortTrace` enabled, user can see the full path of
   the packet with the corresponding address when address error in xbar.

Change-Id: Iaf43ee2d7f8c46b9b84b2bc421a6bc3b02e01b3e
2023-08-15 00:41:42 -07:00
Yan Lee
b01590fdf4 mem: port: add getTraceInString() method
Return the whole port trace of the packet as a string.

Change-Id: I7b1b1fef628a47a6ce147cb5fb75af81948c1d89
2023-08-15 00:40:29 -07:00
Yan Lee
5edb760414 mem: port: add address value in the port trace
Add the address value from the packet with the request port name.

Change-Id: I3d4c75f48ca6fbdbd5656e594d5f85f9e5626be8
2023-08-15 00:38:29 -07:00
Bobby R. Bruce
77e63b6a6c cpu-o3: bugfix of rename squash when SMT (#172)
In an SMT CPU, upon a squash, the mis-predicted(squashing) instructions
can still be executing at IEW and own phys registers. If these registers
are added back to the rename freelist on this Tick, the registers may be
renamed to be used by other SMT thread(s). This causes register
ownership hazards, which may eventually freeze the CPU. This problem
seems to date back to 2014
(https://www.mail-archive.com/gem5-users@gem5.org/msg10180.html).

This patch delays the freelist update to avoid the hazard.

I tested that this patch does not cause any performance impact for my
set of benchmarks on default non-SMT O3CPU.
2023-08-10 15:29:51 -07:00
He, Wenjian
03c2b4692c cpu-o3: bugfix of rename squash when SMT
In an SMT CPU, upon a squash, the phys regs used by
mispredicted instructions can still be owned by executing
instructions in IEW. If the regs are added back to freelist
on this tick, the reg may be renamed to be used by another
SMT thread. This causes reg ownership hazard, which may
eventually freeze the CPU.

This patch delays the freelist update to avoid the hazard.

Change-Id: I993b3c7d357269f01146db61fc8a7b83a989ea45
2023-08-10 21:43:09 +08:00
Roger Chang
f54777419d cpu: Fix ?: error due to different type
Change-Id: I35c50fbba047fe05cc0cc29c631002a9b68795fd
2023-08-10 14:36:26 +08:00
rogerchang23424
81e3bfcdc3 cpu: Update src/cpu/pred/bpred_unit.cc
Change-Id: I0cf177676d0f9fb9db4b127d5507ba66904739c4
Co-authored-by: Jason Lowe-Power <jason@lowepower.com>
2023-08-10 14:36:12 +08:00
Roger Chang
97e55fc173 cpu: Fix segment fault when using debug flags Branch
Change-Id: I36624b93f53aa101a57d51f3b917696cb2809136
2023-08-10 07:36:50 +08:00
Roger Chang
42c2ed6c2d arch-riscv: Add condition for setting misa and mstatus CSR
Change-Id: I7e03b60d0de32fe8169dd79ded485d560aca64aa
2023-08-09 19:32:04 +08:00
Roger Chang
43adc5309a arch-riscv: Add Illegal Instruction Fault Condition for RVV Config
Check the status.vs and misa.rvv CSR registers before executing
RVV instructions

Change-Id: I0355b94ea8ee4018be11a75aab8c19b10cb36126
2023-08-09 19:31:58 +08:00
Roger Chang
85549842c7 arch-riscv: Add Illegal Instruction Fault Condition for Mem RVV
Check the status.vs and misa.rvv CSR registers before executing
RVV instructions

Change-Id: If1f6a440713612b9a044de4f320997e99722c06c
2023-08-09 19:22:32 +08:00
Roger Chang
c18e43a0ab arch-riscv: Add Illegal Instruction Fault Condition for Arith RVV
Check the status.vs and misa.rvv CSR registers before executing
RVV instructions

Change-Id: Idc143e1ba90320254926de9fa7a7b343bb96ba88
2023-08-09 19:20:53 +08:00
zmckevitt
14c25a383c arch-riscv: Implemented zicbom/zicboz extensions for RISC V
Change-Id: I79d0e6059a2dbb5a0057c4f7489b999f9e803684
2023-08-04 10:05:15 +08:00
Jason Lowe-Power
0ff485f7d0 stdlib, resources: fixed style issue in isa.hh (#149)
Changed "rv_type" to "rvType".

Change-Id: I7432a87d7a37324777385707854aefba2475b98c
2023-08-03 16:52:52 -07:00
Bobby R. Bruce
2bef8efb94 stdlib, resources: Fixed keyerror: 'is_zipped' bug (#153)
Change-Id: I68fffd880983ebc225ec6fc8c7f8d509759b581d
2023-08-03 16:01:07 -07:00
Harshil Patel
23f5535ef5 Merge branch 'develop' into riscv-fix-style 2023-08-03 13:32:53 -07:00
Harshil Patel
5cfac2cc94 stdlib: Fixed stype issue pcstate.hh
- Changed _rv_type to _rvType.
- Changed rv_type to rvType.

Change-Id: I27bdf342b038f5ebae78b104a29892684265584a
2023-08-03 13:04:17 -07:00
Harshil Patel
a25ca04851 stdlib, resources: Fixed keyerror: 'is_zipped' bug
Change-Id: I68fffd880983ebc225ec6fc8c7f8d509759b581d
2023-08-03 10:59:11 -07:00
Jason Lowe-Power
5eda9fe2ca arch-riscv: Relation chain on RVV support (#83)
This merges initial support for RVV. Currently, only the simple CPUs are supported.
The decoder stalls for every vsetvl instruction.

In the future, we will implement vsetvl as a control instruction as described in #144
2023-08-03 07:31:08 -07:00
Harshil Patel
51d492487e stdlib: stlye fix rv_type to _rvType in isa.hh and isa.cc
Change-Id: I68e2b1be9150e6528693e68fb73470d158838885
2023-08-02 14:06:30 -07:00