kfdtest: Add event-based synchronization mechanism to queues

Wait4PacketConsumption now can accept an event to wait all packets subbmitted
to be processed.

Change-Id: I1497b7704e892b04d05811b8d3e4742237c1be57
Signed-off-by: xinhui pan <xinhui.pan@amd.com>


[ROCm/ROCR-Runtime commit: 9c7cfc0df2]
This commit is contained in:
xinhui pan
2018-08-27 14:56:48 +08:00
committed by Xinhui Pan
parent 094073ff74
commit 718af9febc
6 changed files with 44 additions and 2 deletions
@@ -34,6 +34,15 @@ class SDMAQueue : public BaseQueue {
// @brief Update queue write pointer and set the queue doorbell to the queue write pointer
virtual void SubmitPacket();
/** Wait for all the packets submitted to the queue to be consumed. (i.e. wait until RPTR=WPTR).
* Note that all packets being consumed is not the same as all packets being processed.
* If event is set, wait all packets being processed.
* And we can benefit from that as it has
* 1) Less CPU usage (process can sleep, waiting for interrupt).
* 2) Lower latency (GPU only updates RPTR in memory periodically).
*/
virtual void Wait4PacketConsumption(HsaEvent *event = NULL);
protected:
// @ return Write pointer modulo queue size in dwords
virtual unsigned int Wptr();