gpu-compute: Fix deadlock in fetch_unit after branch instruction
authorKyle Roarty <kyleroarty1716@gmail.com>
Tue, 15 Sep 2020 13:57:39 +0000 (08:57 -0500)
committerKyle Roarty <kyleroarty1716@gmail.com>
Thu, 17 Sep 2020 21:24:19 +0000 (21:24 +0000)
commitbe3bcd16293b33f6f6d25b582d324aebf2035356
treecb4643fcce1ba577411cdfe49c1b5fd10a3575e8
parent64a7bcd2c4b7ccfa2837162cab0d4c3fc04256a1
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 <power.jg@gmail.com>
Reviewed-by: Matt Sinclair <mattdsinclair@gmail.com>
Reviewed-by: Anthony Gutierrez <anthony.gutierrez@amd.com>
Maintainer: Anthony Gutierrez <anthony.gutierrez@amd.com>
Tested-by: kokoro <noreply+kokoro@google.com>
src/gpu-compute/fetch_unit.cc