SWDEV-491375 - Limit the SW batch size

Applications may submit commands withoout waits
for GPU. That causes a growth of SW unreleased commands.
Make sure runtime flushes SW queue, if it grows over some
threshold, controlled by DEBUG_CLR_MAX_BATCH_SIZE.

Change-Id: Ia4d85c24210ef91c394f638ab6b53b14323a0396
This commit is contained in:
German Andryeyev
2024-10-15 15:03:47 -04:00
parent df9ae754a4
commit 8657a77029
4 ha cambiato i file con 19 aggiunte e 8 eliminazioni
+12 -4
Vedi File
@@ -246,7 +246,7 @@ class HostQueue : public CommandQueue {
Command* getLastQueuedCommand(bool retain);
//! Get the submitted batch
Command* GetSubmittionBatch() const { return head_; }
Command* GetSubmissionBatch() const { return head_; }
//! Insert a command into the linked list of submitted commands
void FormSubmissionBatch(Command* command) {
@@ -257,6 +257,7 @@ class HostQueue : public CommandQueue {
tail_->setNext(command);
tail_ = command;
}
size_++;
command->setStatus(CL_SUBMITTED);
command->retain();
// @note: runtime needs double retain in order to maintain the batch,
@@ -278,8 +279,14 @@ class HostQueue : public CommandQueue {
lastEnqueueCommand_ = command;
}
//! Flushes submitted commands if the batch size significantly grew
void FlushSubmissionBatch(Command* command) {
if (size_ > DEBUG_CLR_MAX_BATCH_SIZE) {
command->notifyCmdQueue();
}
}
//! Reset the command batch list
void ResetSubmissionBatch() { head_ = nullptr; }
void ResetSubmissionBatch() { head_ = nullptr; size_ = 0; }
//! Set queue status
void SetQueueStatus() { isActive_ = true; }
@@ -288,8 +295,9 @@ class HostQueue : public CommandQueue {
bool GetQueueStatus() { return isActive_; }
private:
Command* head_; //!< Head of the batch list
Command* tail_; //!< Tail of the batch list
Command* head_; //!< Head of the batch list
Command* tail_; //!< Tail of the batch list
size_t size_ = 0; //!< The current batch size
//! True if this command queue is active
bool isActive_;