mirror of
https://github.com/intel/compute-runtime.git
synced 2025-09-15 13:01:45 +08:00
optimize batching
- removes redundant MI_BATCH_BUFFER_START when target is within same command buffer - this way we do not have jump in command buffer Signed-off-by: Michal Mrozek <michal.mrozek@intel.com>
This commit is contained in:

committed by
Compute-Runtime-Automation

parent
c389db6f1c
commit
65396fd2e5
@ -702,7 +702,9 @@ inline bool CommandStreamReceiverHw<GfxFamily>::flushBatchedSubmissions() {
|
||||
if (DebugManager.flags.FlattenBatchBufferForAUBDump.get()) {
|
||||
flatBatchBufferHelper->registerCommandChunk(primaryCmdBuffer.get()->batchBuffer, sizeof(MI_BATCH_BUFFER_START));
|
||||
}
|
||||
|
||||
while (nextCommandBuffer && nextCommandBuffer->inspectionId == primaryCmdBuffer->inspectionId) {
|
||||
|
||||
//noop pipe control
|
||||
if (currentPipeControlForNooping) {
|
||||
if (DebugManager.flags.AddPatchInfoCommentsForAUBDump.get()) {
|
||||
@ -718,7 +720,16 @@ inline bool CommandStreamReceiverHw<GfxFamily>::flushBatchedSubmissions() {
|
||||
flushStampUpdateHelper.insert(nextCommandBuffer->flushStamp->getStampReference());
|
||||
auto nextCommandBufferAddress = nextCommandBuffer->batchBuffer.commandBufferAllocation->getGpuAddress();
|
||||
auto offsetedCommandBuffer = (uint64_t)ptrOffset(nextCommandBufferAddress, nextCommandBuffer->batchBuffer.startOffset);
|
||||
addBatchBufferStart((MI_BATCH_BUFFER_START *)currentBBendLocation, offsetedCommandBuffer, false);
|
||||
auto cpuAddressForCommandBufferDestination = ptrOffset(nextCommandBuffer->batchBuffer.commandBufferAllocation->getUnderlyingBuffer(), nextCommandBuffer->batchBuffer.startOffset);
|
||||
auto cpuAddressForCurrentCommandBufferEndingSection = alignUp(ptrOffset(currentBBendLocation, sizeof(MI_BATCH_BUFFER_START)), MemoryConstants::cacheLineSize);
|
||||
|
||||
//if we point to exact same command buffer, then batch buffer start is not needed at all
|
||||
if (cpuAddressForCurrentCommandBufferEndingSection == cpuAddressForCommandBufferDestination) {
|
||||
memset(currentBBendLocation, 0u, ptrDiff(cpuAddressForCurrentCommandBufferEndingSection, currentBBendLocation));
|
||||
} else {
|
||||
addBatchBufferStart((MI_BATCH_BUFFER_START *)currentBBendLocation, offsetedCommandBuffer, false);
|
||||
}
|
||||
|
||||
if (DebugManager.flags.FlattenBatchBufferForAUBDump.get()) {
|
||||
flatBatchBufferHelper->registerCommandChunk(nextCommandBuffer->batchBuffer, sizeof(MI_BATCH_BUFFER_START));
|
||||
}
|
||||
@ -726,6 +737,7 @@ inline bool CommandStreamReceiverHw<GfxFamily>::flushBatchedSubmissions() {
|
||||
currentBBendLocation = nextCommandBuffer->batchBufferEndLocation;
|
||||
lastTaskCount = nextCommandBuffer->taskCount;
|
||||
nextCommandBuffer = nextCommandBuffer->next;
|
||||
|
||||
commandBufferList.removeFrontOne();
|
||||
}
|
||||
surfacesForSubmit.reserve(resourcePackage.size() + 1);
|
||||
|
Reference in New Issue
Block a user