@@ -570,38 +570,10 @@ CompletionStamp CommandStreamReceiverHw<GfxFamily>::flushTask(
570
570
auto batchBuffer = prepareBatchBufferForSubmission (commandStreamTask, commandStreamStartTask, commandStreamCSR, commandStreamStartCSR,
571
571
dispatchFlags, device, submitTask, submitCSR, hasStallingCmdsOnTaskStream);
572
572
573
- if (submitCSR || submitTask) {
574
- if (this ->dispatchMode == DispatchMode::immediateDispatch) {
575
- auto submissionStatus = flushHandler (batchBuffer, this ->getResidencyAllocations ());
576
- if (submissionStatus != SubmissionStatus::success) {
577
- updateStreamTaskCount (*batchBuffer.stream , taskCount);
578
- CompletionStamp completionStamp = {CompletionStamp::getTaskCountFromSubmissionStatusError (submissionStatus)};
579
- return completionStamp;
580
- }
581
- if (hasStallingCmdsOnTaskStream) {
582
- this ->latestFlushedTaskCount = this ->taskCount + 1 ;
583
- }
584
- } else {
585
- auto commandBuffer = new CommandBuffer (device);
586
- commandBuffer->batchBuffer = batchBuffer;
587
- commandBuffer->surfaces .swap (this ->getResidencyAllocations ());
588
- commandBuffer->batchBufferEndLocation = batchBuffer.endCmdPtr ;
589
- commandBuffer->taskCount = this ->taskCount + 1 ;
590
- commandBuffer->flushStamp ->replaceStampObject (dispatchFlags.flushStampReference );
591
- commandBuffer->pipeControlThatMayBeErasedLocation = currentPipeControlForNooping;
592
- commandBuffer->epiloguePipeControlLocation = epiloguePipeControlLocation;
593
- commandBuffer->epiloguePipeControlArgs = args;
594
- this ->submissionAggregator ->recordCommandBuffer (commandBuffer);
595
- }
596
- } else {
597
- this ->makeSurfacePackNonResident (this ->getResidencyAllocations (), true );
598
- }
573
+ auto completionStamp = handleFlushTaskSubmission (std::move (batchBuffer), dispatchFlags, device, currentPipeControlForNooping, epiloguePipeControlLocation,
574
+ args, submitTask, submitCSR, hasStallingCmdsOnTaskStream, levelClosed, implicitFlush);
599
575
600
- if (this ->dispatchMode == DispatchMode::batchedDispatch) {
601
- handleBatchedDispatchImplicitFlush (device.getDeviceInfo ().globalMemSize , implicitFlush);
602
- }
603
-
604
- return updateTaskCountAndGetCompletionStamp (levelClosed);
576
+ return completionStamp;
605
577
}
606
578
607
579
template <typename GfxFamily>
@@ -1837,6 +1809,54 @@ inline void CommandStreamReceiverHw<GfxFamily>::processBarrierWithPostSync(Linea
1837
1809
}
1838
1810
}
1839
1811
1812
+ template <typename GfxFamily>
1813
+ inline CompletionStamp CommandStreamReceiverHw<GfxFamily>::handleFlushTaskSubmission(BatchBuffer &&batchBuffer,
1814
+ const DispatchFlags &dispatchFlags,
1815
+ Device &device,
1816
+ void *currentPipeControlForNooping,
1817
+ void *epiloguePipeControlLocation,
1818
+ PipeControlArgs &args,
1819
+ bool submitTask,
1820
+ bool submitCSR,
1821
+ bool hasStallingCmdsOnTaskStream,
1822
+ bool levelClosed,
1823
+ bool implicitFlush) {
1824
+
1825
+ if (submitCSR || submitTask) {
1826
+ if (this ->dispatchMode == DispatchMode::immediateDispatch) {
1827
+ auto submissionStatus = flushHandler (batchBuffer, this ->getResidencyAllocations ());
1828
+ if (submissionStatus != SubmissionStatus::success) {
1829
+ updateStreamTaskCount (*batchBuffer.stream , taskCount);
1830
+ CompletionStamp completionStamp = {CompletionStamp::getTaskCountFromSubmissionStatusError (submissionStatus)};
1831
+ return completionStamp;
1832
+ }
1833
+ if (hasStallingCmdsOnTaskStream) {
1834
+ this ->latestFlushedTaskCount = this ->taskCount + 1 ;
1835
+ }
1836
+ } else {
1837
+ auto commandBuffer = new CommandBuffer (device);
1838
+ commandBuffer->batchBufferEndLocation = batchBuffer.endCmdPtr ;
1839
+ commandBuffer->batchBuffer = std::move (batchBuffer);
1840
+ commandBuffer->surfaces .swap (this ->getResidencyAllocations ());
1841
+ commandBuffer->taskCount = this ->taskCount + 1 ;
1842
+ commandBuffer->flushStamp ->replaceStampObject (dispatchFlags.flushStampReference );
1843
+ commandBuffer->pipeControlThatMayBeErasedLocation = currentPipeControlForNooping;
1844
+ commandBuffer->epiloguePipeControlLocation = epiloguePipeControlLocation;
1845
+ commandBuffer->epiloguePipeControlArgs = args;
1846
+ this ->submissionAggregator ->recordCommandBuffer (commandBuffer);
1847
+ }
1848
+ } else {
1849
+ this ->makeSurfacePackNonResident (this ->getResidencyAllocations (), true );
1850
+ }
1851
+
1852
+ if (this ->dispatchMode == DispatchMode::batchedDispatch) {
1853
+ handleBatchedDispatchImplicitFlush (device.getDeviceInfo ().globalMemSize , implicitFlush);
1854
+ }
1855
+
1856
+ CompletionStamp completionStamp = updateTaskCountAndGetCompletionStamp (levelClosed);
1857
+ return completionStamp;
1858
+ }
1859
+
1840
1860
template <typename GfxFamily>
1841
1861
inline CompletionStamp CommandStreamReceiverHw<GfxFamily>::updateTaskCountAndGetCompletionStamp(bool levelClosed) {
1842
1862
0 commit comments