From be3bcd16293b33f6f6d25b582d324aebf2035356 Mon Sep 17 00:00:00 2001 From: Kyle Roarty Date: Tue, 15 Sep 2020 08:57:39 -0500 Subject: [PATCH] gpu-compute: Fix deadlock in fetch_unit after branch instruction The following deadlock was occuring in fetch_unit w/timingSim: 1. exec() is called, a wave is ready to fetch, so it sets pendingFetch 2. A packet is sent to ITLB to fetch for that wave 3. The wave executes a branch, causing the fetch buffer to be cleared 4. The packet is handled, and fetch() is called. However, because the fetch buffer was cleared, it returns doing nothing. 5. exec() gets called again, but the wave will never be scheduled to fetch, as pendingFetch is still set to true. This patch clears pendingFetch (and dropFetch) before returning in fetch() when the fetch buffer has been cleared. dropFetch needed to be cleared otherwise gem5 would crash. Change-Id: Iccbac7defc4849c19e8b17aa2492da641defb772 Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/34555 Reviewed-by: Jason Lowe-Power Reviewed-by: Matt Sinclair Reviewed-by: Anthony Gutierrez Maintainer: Anthony Gutierrez Tested-by: kokoro --- src/gpu-compute/fetch_unit.cc | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/gpu-compute/fetch_unit.cc b/src/gpu-compute/fetch_unit.cc index 4e4259e74..098b783a9 100644 --- a/src/gpu-compute/fetch_unit.cc +++ b/src/gpu-compute/fetch_unit.cc @@ -240,6 +240,8 @@ FetchUnit::fetch(PacketPtr pkt, Wavefront *wavefront) * pending, in the same cycle another instruction is trying to fetch. */ if (!fetchBuf.at(wavefront->wfSlotId).isReserved(pkt->req->getVaddr())) { + wavefront->dropFetch = false; + wavefront->pendingFetch = false; return; } -- 2.30.2