mirror of
https://github.com/intel/compute-runtime.git
synced 2025-12-20 08:53:55 +08:00
Optimize flushTask.
Move Batching code under batching if to not call not required functions. Update task level only if level is closed. 70ns gain. Signed-off-by: Michal Mrozek <michal.mrozek@intel.com>
This commit is contained in:
committed by
Compute-Runtime-Automation
parent
8132503b87
commit
809abb005f
@@ -627,6 +627,7 @@ CompletionStamp CommandStreamReceiverHw<GfxFamily>::flushTask(
|
|||||||
|
|
||||||
this->wasSubmittedToSingleSubdevice = dispatchFlags.useSingleSubdevice;
|
this->wasSubmittedToSingleSubdevice = dispatchFlags.useSingleSubdevice;
|
||||||
|
|
||||||
|
if (this->dispatchMode == DispatchMode::BatchedDispatch) {
|
||||||
// check if we are not over the budget, if we are do implicit flush
|
// check if we are not over the budget, if we are do implicit flush
|
||||||
if (getMemoryManager()->isMemoryBudgetExhausted()) {
|
if (getMemoryManager()->isMemoryBudgetExhausted()) {
|
||||||
if (this->totalMemoryUsed >= device.getDeviceInfo().globalMemSize / 4) {
|
if (this->totalMemoryUsed >= device.getDeviceInfo().globalMemSize / 4) {
|
||||||
@@ -646,9 +647,10 @@ CompletionStamp CommandStreamReceiverHw<GfxFamily>::flushTask(
|
|||||||
}
|
}
|
||||||
implicitFlush |= checkImplicitFlushForGpuIdle();
|
implicitFlush |= checkImplicitFlushForGpuIdle();
|
||||||
|
|
||||||
if (this->dispatchMode == DispatchMode::BatchedDispatch && implicitFlush) {
|
if (implicitFlush) {
|
||||||
this->flushBatchedSubmissions();
|
this->flushBatchedSubmissions();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
++taskCount;
|
++taskCount;
|
||||||
DBG_LOG(LogTaskCounts, __FUNCTION__, "Line: ", __LINE__, "taskCount", peekTaskCount());
|
DBG_LOG(LogTaskCounts, __FUNCTION__, "Line: ", __LINE__, "taskCount", peekTaskCount());
|
||||||
@@ -659,7 +661,9 @@ CompletionStamp CommandStreamReceiverHw<GfxFamily>::flushTask(
|
|||||||
this->taskLevel,
|
this->taskLevel,
|
||||||
flushStamp->peekStamp()};
|
flushStamp->peekStamp()};
|
||||||
|
|
||||||
this->taskLevel += levelClosed ? 1 : 0;
|
if (levelClosed) {
|
||||||
|
this->taskLevel++;
|
||||||
|
}
|
||||||
|
|
||||||
return completionStamp;
|
return completionStamp;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -32,3 +32,9 @@ TEST(MemoryManagerTest, givenAllocationWithNullCpuPtrThenMemoryCopyToAllocationR
|
|||||||
|
|
||||||
EXPECT_FALSE(memoryManager.copyMemoryToAllocation(&allocation, offset, nullptr, 0));
|
EXPECT_FALSE(memoryManager.copyMemoryToAllocation(&allocation, offset, nullptr, 0));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TEST(MemoryManagerTest, givenDefaultMemoryManagerWhenItIsAskedForBudgetExhaustionThenFalseIsReturned) {
|
||||||
|
MockExecutionEnvironment executionEnvironment(defaultHwInfo.get());
|
||||||
|
MockMemoryManager memoryManager(false, false, executionEnvironment);
|
||||||
|
EXPECT_FALSE(memoryManager.isMemoryBudgetExhausted());
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user