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:
@@ -58,6 +58,8 @@ class SDMAEngine : public DmaVirtDevice
|
||||
Addr _rptr;
|
||||
Addr _wptr;
|
||||
Addr _size;
|
||||
Addr _rptr_wb_addr = 0;
|
||||
Addr _global_rptr = 0;
|
||||
bool _valid;
|
||||
bool _processing;
|
||||
SDMAQueue *_parent;
|
||||
@@ -72,6 +74,8 @@ class SDMAEngine : public DmaVirtDevice
|
||||
Addr wptr() { return _base + _wptr; }
|
||||
Addr getWptr() { return _wptr; }
|
||||
Addr size() { return _size; }
|
||||
Addr rptrWbAddr() { return _rptr_wb_addr; }
|
||||
Addr globalRptr() { return _global_rptr; }
|
||||
bool valid() { return _valid; }
|
||||
bool processing() { return _processing; }
|
||||
SDMAQueue* parent() { return _parent; }
|
||||
@@ -82,22 +86,27 @@ class SDMAEngine : public DmaVirtDevice
|
||||
void
|
||||
incRptr(uint32_t value)
|
||||
{
|
||||
//assert((_rptr + value) <= (_size << 1));
|
||||
_rptr = (_rptr + value) % _size;
|
||||
_global_rptr += value;
|
||||
}
|
||||
|
||||
void rptr(Addr value) { _rptr = value; }
|
||||
void
|
||||
rptr(Addr value)
|
||||
{
|
||||
_rptr = value;
|
||||
_global_rptr = value;
|
||||
}
|
||||
|
||||
void
|
||||
setWptr(Addr value)
|
||||
{
|
||||
//assert(value <= (_size << 1));
|
||||
_wptr = value % _size;
|
||||
}
|
||||
|
||||
void wptr(Addr value) { _wptr = value; }
|
||||
|
||||
void size(Addr value) { _size = value; }
|
||||
void rptrWbAddr(Addr value) { _rptr_wb_addr = value; }
|
||||
void valid(bool v) { _valid = v; }
|
||||
void processing(bool value) { _processing = value; }
|
||||
void parent(SDMAQueue* q) { _parent = q; }
|
||||
@@ -268,7 +277,8 @@ class SDMAEngine : public DmaVirtDevice
|
||||
/**
|
||||
* Methods for RLC queues
|
||||
*/
|
||||
void registerRLCQueue(Addr doorbell, Addr rb_base);
|
||||
void registerRLCQueue(Addr doorbell, Addr rb_base, uint32_t size,
|
||||
Addr rptr_wb_addr);
|
||||
void unregisterRLCQueue(Addr doorbell);
|
||||
void deallocateRLCQueues();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user