diff options
author | Gabe Black <gabeblack@google.com> | 2018-11-26 17:51:16 -0800 |
---|---|---|
committer | Gabe Black <gabeblack@google.com> | 2018-11-27 21:58:24 +0000 |
commit | 12311c5540e69750b39f1f2e476546cdf05d1f3e (patch) | |
tree | 56478af783014362be805d560a19d41faed49b65 /src/gpu-compute | |
parent | a66d12c23517a010f5a05efbc2e47d61fba705c9 (diff) | |
download | gem5-12311c5540e69750b39f1f2e476546cdf05d1f3e.tar.xz |
arch, base, cpu, gpu, mem: Replace assert(0 or false with panic.
Neither assert(0) nor assert(false) give any hint as to why control
getting to them is bad, and their more descriptive versions,
assert(0 && "description") and assert(false && "description"), jury
rig assert to add an error message when the utility function panic()
already does that directly with better formatting options.
This change replaces that flavor of call to assert with panic, except
in the actual code which processes the formatting that panic uses (to
avoid infinitely recurring error handling), and in some *.sm files
since I don't know what rules those have to follow and don't want to
accidentaly break them.
Change-Id: I8addfbfaf77eaed94ec8191f2ae4efb477cefdd0
Reviewed-on: https://gem5-review.googlesource.com/c/14636
Reviewed-by: Brandon Potter <Brandon.Potter@amd.com>
Reviewed-by: Jason Lowe-Power <jason@lowepower.com>
Maintainer: Jason Lowe-Power <jason@lowepower.com>
Diffstat (limited to 'src/gpu-compute')
-rw-r--r-- | src/gpu-compute/gpu_dyn_inst.hh | 4 | ||||
-rw-r--r-- | src/gpu-compute/gpu_tlb.cc | 21 | ||||
-rw-r--r-- | src/gpu-compute/gpu_tlb.hh | 2 | ||||
-rw-r--r-- | src/gpu-compute/tlb_coalescer.cc | 3 |
4 files changed, 16 insertions, 14 deletions
diff --git a/src/gpu-compute/gpu_dyn_inst.hh b/src/gpu-compute/gpu_dyn_inst.hh index 0d357de38..9e63c4459 100644 --- a/src/gpu-compute/gpu_dyn_inst.hh +++ b/src/gpu-compute/gpu_dyn_inst.hh @@ -39,6 +39,7 @@ #include <cstdint> #include <string> +#include "base/logging.hh" #include "enums/MemType.hh" #include "enums/StorageClassType.hh" #include "gpu-compute/compute_unit.hh" @@ -407,8 +408,7 @@ class GPUDynInst : public GPUExecContext } else if (isGroupSeg()) { req->setMemSpaceConfigFlags(Request::GROUP_SEGMENT); } else if (isFlat()) { - // TODO: translate to correct scope - assert(false); + panic("TODO: translate to correct scope"); } else { fatal("%s has bad segment type\n", disassemble()); } diff --git a/src/gpu-compute/gpu_tlb.cc b/src/gpu-compute/gpu_tlb.cc index fea6183ed..dbf7d2628 100644 --- a/src/gpu-compute/gpu_tlb.cc +++ b/src/gpu-compute/gpu_tlb.cc @@ -45,6 +45,7 @@ #include "arch/x86/regs/misc.hh" #include "arch/x86/x86_traits.hh" #include "base/bitfield.hh" +#include "base/logging.hh" #include "base/output.hh" #include "base/trace.hh" #include "cpu/base.hh" @@ -1150,16 +1151,16 @@ namespace X86ISA if ((inUser && !tlb_entry->user) || (mode == BaseTLB::Write && badWrite)) { - // The page must have been present to get into the TLB in - // the first place. We'll assume the reserved bits are - // fine even though we're not checking them. - assert(false); + // The page must have been present to get into the TLB in + // the first place. We'll assume the reserved bits are + // fine even though we're not checking them. + panic("Page fault detected"); } if (storeCheck && badWrite) { - // This would fault if this were a write, so return a page - // fault that reflects that happening. - assert(false); + // This would fault if this were a write, so return a page + // fault that reflects that happening. + panic("Page fault detected"); } } @@ -1362,7 +1363,7 @@ namespace X86ISA */ handleTranslationReturn(virtPageAddr, TLB_MISS, pkt); } else { - assert(false); + panic("Unexpected TLB outcome %d", outcome); } } @@ -1607,7 +1608,7 @@ namespace X86ISA { // The CPUSidePort never sends anything but replies. No retries // expected. - assert(false); + panic("recvReqRetry called"); } AddrRangeList @@ -1648,7 +1649,7 @@ namespace X86ISA { // No retries should reach the TLB. The retries // should only reach the TLBCoalescer. - assert(false); + panic("recvReqRetry called"); } void diff --git a/src/gpu-compute/gpu_tlb.hh b/src/gpu-compute/gpu_tlb.hh index 04d9bfce8..9ca478d91 100644 --- a/src/gpu-compute/gpu_tlb.hh +++ b/src/gpu-compute/gpu_tlb.hh @@ -272,7 +272,7 @@ namespace X86ISA virtual void recvFunctional(PacketPtr pkt); virtual void recvRangeChange() { } virtual void recvReqRetry(); - virtual void recvRespRetry() { assert(false); } + virtual void recvRespRetry() { panic("recvRespRetry called"); } virtual AddrRangeList getAddrRanges() const; }; diff --git a/src/gpu-compute/tlb_coalescer.cc b/src/gpu-compute/tlb_coalescer.cc index 68d2689ef..193c44ed8 100644 --- a/src/gpu-compute/tlb_coalescer.cc +++ b/src/gpu-compute/tlb_coalescer.cc @@ -37,6 +37,7 @@ #include <cstring> +#include "base/logging.hh" #include "debug/GPUTLB.hh" #include "sim/process.hh" @@ -335,7 +336,7 @@ TLBCoalescer::CpuSidePort::recvTimingReq(PacketPtr pkt) void TLBCoalescer::CpuSidePort::recvReqRetry() { - assert(false); + panic("recvReqRetry called"); } void |