dev-amdgpu: Fix SDMA ring buffer wrap around
The current SDMA wrap around handling only considers the ring buffer location as seen by the GPU. Eventually when the end of the SDMA ring buffer is reached, the driver waits until the rptr written back to the host catches up to what the driver sees before wrapping around back to the beginning of the buffer. This writeback currently does not happen at all, causing hangs for applications with a lot of SDMA commands. This changeset first fixes the sizes of the queues, especially RLC queues, so that the wrap around occurs in the correct place. Second, we now store the rptr writeback address and the absoluate (unwrapped) rptr value in each SDMA queue. The absolulte rptr is what the driver sends to the device and what it expects to be written back. This was tested with an application which basically does a few hundred thousand hipMemcpy() calls in a loop. It should also fix the issue with pannotia BC in fullsystem mode. Change-Id: I53ebdcc6b02fb4eb4da435c9a509544066a97069 Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/65351 Maintainer: Jason Lowe-Power <power.jg@gmail.com> Tested-by: kokoro <noreply+kokoro@google.com> Reviewed-by: Jason Lowe-Power <power.jg@gmail.com> Reviewed-by: Matt Sinclair <mattdsinclair@gmail.com> Maintainer: Matt Sinclair <mattdsinclair@gmail.com>
This commit is contained in:
@@ -441,12 +441,17 @@ void
|
||||
PM4PacketProcessor::processSDMAMQD(PM4MapQueues *pkt, PM4Queue *q, Addr addr,
|
||||
SDMAQueueDesc *mqd, uint16_t vmid)
|
||||
{
|
||||
uint32_t rlc_size = 4UL << bits(mqd->sdmax_rlcx_rb_cntl, 6, 1);
|
||||
Addr rptr_wb_addr = mqd->sdmax_rlcx_rb_rptr_addr_hi;
|
||||
rptr_wb_addr <<= 32;
|
||||
rptr_wb_addr |= mqd->sdmax_rlcx_rb_rptr_addr_lo;
|
||||
|
||||
DPRINTF(PM4PacketProcessor, "SDMAMQD: rb base: %#lx rptr: %#x/%#x wptr: "
|
||||
"%#x/%#x ib: %#x/%#x size: %d ctrl: %#x\n", mqd->rb_base,
|
||||
mqd->sdmax_rlcx_rb_rptr, mqd->sdmax_rlcx_rb_rptr_hi,
|
||||
"%#x/%#x ib: %#x/%#x size: %d ctrl: %#x rptr wb addr: %#lx\n",
|
||||
mqd->rb_base, mqd->sdmax_rlcx_rb_rptr, mqd->sdmax_rlcx_rb_rptr_hi,
|
||||
mqd->sdmax_rlcx_rb_wptr, mqd->sdmax_rlcx_rb_wptr_hi,
|
||||
mqd->sdmax_rlcx_ib_base_lo, mqd->sdmax_rlcx_ib_base_hi,
|
||||
mqd->sdmax_rlcx_ib_size, mqd->sdmax_rlcx_rb_cntl);
|
||||
rlc_size, mqd->sdmax_rlcx_rb_cntl, rptr_wb_addr);
|
||||
|
||||
// Engine 2 points to SDMA0 while engine 3 points to SDMA1
|
||||
assert(pkt->engineSel == 2 || pkt->engineSel == 3);
|
||||
@@ -454,7 +459,8 @@ PM4PacketProcessor::processSDMAMQD(PM4MapQueues *pkt, PM4Queue *q, Addr addr,
|
||||
|
||||
// Register RLC queue with SDMA
|
||||
sdma_eng->registerRLCQueue(pkt->doorbellOffset << 2,
|
||||
mqd->rb_base << 8);
|
||||
mqd->rb_base << 8, rlc_size,
|
||||
rptr_wb_addr);
|
||||
|
||||
// Register doorbell with GPU device
|
||||
gpuDevice->setSDMAEngine(pkt->doorbellOffset << 2, sdma_eng);
|
||||
|
||||
Reference in New Issue
Block a user