gpu-compute: Fix FLAT insts decrementing lgkm count early

FLAT instructions used to decrement lgkm count on execute, while the
GCN3 ISA specifies that lgkm count should be decremented on data being
returned or data being written.

This patch changes it so that lgkm is decremented after initiateAcc (for
stores) and after completeAcc (for loads) to better reflect the ISA
definition.

This fixes a bug where waitcnts would be satisfied even though the
memory access wasn't completed, which lead to instructions using the
wrong data.

Change-Id: I596cb031af9cda8d47a1b5e146e4a4ffd793d36c
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/38696
Reviewed-by: Matt Sinclair <mattdsinclair@gmail.com>
Reviewed-by: Matthew Poremba <matthew.poremba@amd.com>
Maintainer: Matt Sinclair <mattdsinclair@gmail.com>
Tested-by: kokoro <noreply+kokoro@google.com>
This commit is contained in:
Kyle Roarty
2020-12-23 19:30:37 -06:00
committed by Matt Sinclair
parent 3c0769bd25
commit f6ec145fc0
2 changed files with 7 additions and 1 deletions

View File

@@ -130,6 +130,9 @@ GlobalMemPipeline::exec()
DPRINTF(GPUMem, "CU%d: WF[%d][%d]: Completing global mem instr %s\n", DPRINTF(GPUMem, "CU%d: WF[%d][%d]: Completing global mem instr %s\n",
m->cu_id, m->simdId, m->wfSlotId, m->disassemble()); m->cu_id, m->simdId, m->wfSlotId, m->disassemble());
m->completeAcc(m); m->completeAcc(m);
if (m->isFlat() && m->isLoad()) {
w->decLGKMInstsIssued();
}
w->decVMemInstsIssued(); w->decVMemInstsIssued();
if (m->isLoad() || m->isAtomicRet()) { if (m->isLoad() || m->isAtomicRet()) {
@@ -193,6 +196,10 @@ GlobalMemPipeline::exec()
mp->disassemble(), mp->seqNum()); mp->disassemble(), mp->seqNum());
mp->initiateAcc(mp); mp->initiateAcc(mp);
if (mp->isFlat() && mp->isStore()) {
mp->wavefront()->decLGKMInstsIssued();
}
if (mp->isStore() && mp->isGlobalSeg()) { if (mp->isStore() && mp->isGlobalSeg()) {
mp->wavefront()->decExpInstsIssued(); mp->wavefront()->decExpInstsIssued();
} }

View File

@@ -819,7 +819,6 @@ GPUDynInst::resolveFlatSegment(const VectorMask &mask)
if (executedAs() == Enums::SC_GLOBAL) { if (executedAs() == Enums::SC_GLOBAL) {
// no transormation for global segment // no transormation for global segment
wavefront()->execUnitId = wavefront()->flatGmUnitId; wavefront()->execUnitId = wavefront()->flatGmUnitId;
wavefront()->decLGKMInstsIssued();
if (isLoad()) { if (isLoad()) {
wavefront()->rdLmReqsInPipe--; wavefront()->rdLmReqsInPipe--;
} else if (isStore()) { } else if (isStore()) {