mirror of
https://github.com/intel/compute-runtime.git
synced 2026-01-03 23:03:02 +08:00
refactor: move handle batched dispatch implicit flush code to function
Related-To: NEO-7824 Signed-off-by: Kamil Kopryk <kamil.kopryk@intel.com>
This commit is contained in:
committed by
Compute-Runtime-Automation
parent
eea0a7db61
commit
7b689aa464
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2018-2023 Intel Corporation
|
||||
* Copyright (C) 2018-2024 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
@@ -275,6 +275,8 @@ class CommandStreamReceiverHw : public CommandStreamReceiver {
|
||||
ImmediateFlushData &flushData,
|
||||
LinearStream &csrStream);
|
||||
|
||||
inline void handleBatchedDispatchImplicitFlush(uint64_t globalMemorySize, bool implicitFlush);
|
||||
|
||||
HeapDirtyState dshState;
|
||||
HeapDirtyState iohState;
|
||||
HeapDirtyState sshState;
|
||||
|
||||
@@ -699,28 +699,7 @@ CompletionStamp CommandStreamReceiverHw<GfxFamily>::flushTask(
|
||||
}
|
||||
|
||||
if (this->dispatchMode == DispatchMode::batchedDispatch) {
|
||||
// check if we are not over the budget, if we are do implicit flush
|
||||
if (getMemoryManager()->isMemoryBudgetExhausted()) {
|
||||
if (this->totalMemoryUsed >= device.getDeviceInfo().globalMemSize / 4) {
|
||||
implicitFlush = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (debugManager.flags.PerformImplicitFlushEveryEnqueueCount.get() != -1) {
|
||||
if ((taskCount + 1) % debugManager.flags.PerformImplicitFlushEveryEnqueueCount.get() == 0) {
|
||||
implicitFlush = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (this->newResources) {
|
||||
implicitFlush = true;
|
||||
this->newResources = false;
|
||||
}
|
||||
implicitFlush |= checkImplicitFlushForGpuIdle();
|
||||
|
||||
if (implicitFlush) {
|
||||
this->flushBatchedSubmissions();
|
||||
}
|
||||
handleBatchedDispatchImplicitFlush(device.getDeviceInfo().globalMemSize, implicitFlush);
|
||||
}
|
||||
|
||||
++taskCount;
|
||||
@@ -2244,4 +2223,30 @@ CompletionStamp CommandStreamReceiverHw<GfxFamily>::handleImmediateFlushSendBatc
|
||||
}
|
||||
}
|
||||
|
||||
template <typename GfxFamily>
|
||||
inline void CommandStreamReceiverHw<GfxFamily>::handleBatchedDispatchImplicitFlush(uint64_t globalMemorySize, bool implicitFlush) {
|
||||
// check if we are not over the budget, if we are do implicit flush
|
||||
if (getMemoryManager()->isMemoryBudgetExhausted()) {
|
||||
if (this->totalMemoryUsed >= globalMemorySize / 4) {
|
||||
implicitFlush = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (debugManager.flags.PerformImplicitFlushEveryEnqueueCount.get() != -1) {
|
||||
if ((taskCount + 1) % debugManager.flags.PerformImplicitFlushEveryEnqueueCount.get() == 0) {
|
||||
implicitFlush = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (this->newResources) {
|
||||
implicitFlush = true;
|
||||
this->newResources = false;
|
||||
}
|
||||
implicitFlush |= checkImplicitFlushForGpuIdle();
|
||||
|
||||
if (implicitFlush) {
|
||||
this->flushBatchedSubmissions();
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace NEO
|
||||
|
||||
Reference in New Issue
Block a user