Add batch tracking for direct dispatch

Make sure the logic updates the command status when it's done in
HW, but not on submission.
Add the last command tracking, otherwise queue sync logic in the HIP
upper layer may skip synchronization, assuming the queue is empty.

Change-Id: I2d046792553e74df090a10f7d7a78914610f6df2
Этот коммит содержится в:
German Andryeyev committed 2020-12-04 10:16:17 -05:00
1 родитель b334911a58
Коммит 5b31c69a95
3 files changed
+73 -18

No files matched your search

+11 -7
Просмотреть файл
@@ -258,17 +258,21 @@ void Command::enqueue() {
}
ClPrint(LOG_DEBUG, LOG_CMD, "command is enqueued: %p", this);
// Direct dispatch logic below will submit the command immediately, but the command status
// update will occur later after flush() with a wait
if (AMD_DIRECT_DISPATCH) {
// The batch update must be lock protected to avoid a race condition
// when multiple threads submit/flush/update the batch at the same time
ScopedLock sl(queue_->lock());
queue_->FormSubmissionBatch(this);
if (type() == CL_COMMAND_MARKER || type() == 0) {
setStatus(CL_SUBMITTED);
queue_->vdev()->flush();
retain();
setStatus(CL_COMPLETE);
// Flush the current batch and wait for the results, since it's a marker.
// @todo: The condition requires a reevaluation to determine if any marker needs a wait.
queue_->vdev()->flush(queue_->GetSubmittionBatch());
queue_->ResetSubmissionBatch();
} else {
setStatus(CL_SUBMITTED);
submit(*queue_->vdev());
retain();
setStatus(CL_COMPLETE);
}
} else {
queue_->append(*this);