mirror of
https://github.com/intel/compute-runtime.git
synced 2026-01-03 06:49:52 +08:00
performance: immediate flush add ending commands to command list buffer
Related-To: NEO-7808 Signed-off-by: Zbigniew Zdanowicz <zbigniew.zdanowicz@intel.com>
This commit is contained in:
committed by
Compute-Runtime-Automation
parent
1067167637
commit
b3ebcfe811
@@ -3813,3 +3813,84 @@ HWTEST2_F(CommandStreamReceiverHwTest,
|
||||
bbStartCmd = hwParserCsr.getCommand<MI_BATCH_BUFFER_START>();
|
||||
ASSERT_EQ(nullptr, bbStartCmd);
|
||||
}
|
||||
|
||||
HWTEST2_F(CommandStreamReceiverHwTest,
|
||||
givenImmediateFlushTaskWhenBlockingCallSelectedThenDispatchPipeControlPostSyncToImmediateBatchBuffer,
|
||||
IsAtLeastXeHpCore) {
|
||||
using PIPE_CONTROL = typename FamilyType::PIPE_CONTROL;
|
||||
using MI_BATCH_BUFFER_END = typename FamilyType::MI_BATCH_BUFFER_END;
|
||||
using COMPUTE_WALKER = typename FamilyType::COMPUTE_WALKER;
|
||||
|
||||
auto &commandStreamReceiver = pDevice->getUltCommandStreamReceiver<FamilyType>();
|
||||
bool additionalSyncCmd = NEO::MemorySynchronizationCommands<FamilyType>::getSizeForSingleAdditionalSynchronization(commandStreamReceiver.peekRootDeviceEnvironment()) > 0;
|
||||
commandStreamReceiver.storeMakeResidentAllocations = true;
|
||||
|
||||
auto startOffset = commandStream.getUsed();
|
||||
auto immediateListCmdBufferAllocation = commandStream.getGraphicsAllocation();
|
||||
*commandStream.getSpaceForCmd<COMPUTE_WALKER>() = FamilyType::cmdInitGpgpuWalker;
|
||||
auto csrTagAllocation = commandStreamReceiver.getTagAllocation();
|
||||
uint64_t postsyncAddress = csrTagAllocation->getGpuAddress();
|
||||
|
||||
immediateFlushTaskFlags.blockingAppend = true;
|
||||
auto completionStamp = commandStreamReceiver.flushImmediateTask(commandStream, startOffset, immediateFlushTaskFlags, *pDevice);
|
||||
EXPECT_EQ(1u, completionStamp.taskCount);
|
||||
EXPECT_EQ(1u, commandStreamReceiver.taskCount);
|
||||
EXPECT_EQ(1u, commandStreamReceiver.latestSentTaskCount);
|
||||
EXPECT_EQ(1u, commandStreamReceiver.latestFlushedTaskCount);
|
||||
|
||||
HardwareParse hwParserCsr;
|
||||
hwParserCsr.parseCommands<FamilyType>(commandStream, 0);
|
||||
auto cmdItor = hwParserCsr.getCommandItor<PIPE_CONTROL>();
|
||||
ASSERT_NE(hwParserCsr.cmdList.end(), cmdItor);
|
||||
auto pipeControlCmd = genCmdCast<PIPE_CONTROL *>(*cmdItor);
|
||||
ASSERT_NE(nullptr, pipeControlCmd);
|
||||
EXPECT_EQ(postsyncAddress, NEO::UnitTestHelper<FamilyType>::getPipeControlPostSyncAddress(*pipeControlCmd));
|
||||
EXPECT_EQ(1u, pipeControlCmd->getImmediateData());
|
||||
|
||||
cmdItor++;
|
||||
ASSERT_NE(hwParserCsr.cmdList.end(), cmdItor);
|
||||
if (additionalSyncCmd) {
|
||||
cmdItor++;
|
||||
ASSERT_NE(hwParserCsr.cmdList.end(), cmdItor);
|
||||
}
|
||||
auto bbEndCmd = genCmdCast<MI_BATCH_BUFFER_END *>(*cmdItor);
|
||||
ASSERT_NE(nullptr, bbEndCmd);
|
||||
|
||||
EXPECT_TRUE(commandStreamReceiver.isMadeResident(csrTagAllocation));
|
||||
EXPECT_TRUE(commandStreamReceiver.isMadeResident(immediateListCmdBufferAllocation));
|
||||
|
||||
startOffset = commandStream.getUsed();
|
||||
EXPECT_EQ(0u, (startOffset % MemoryConstants::cacheLineSize));
|
||||
|
||||
*commandStream.getSpaceForCmd<COMPUTE_WALKER>() = FamilyType::cmdInitGpgpuWalker;
|
||||
|
||||
completionStamp = commandStreamReceiver.flushImmediateTask(commandStream, startOffset, immediateFlushTaskFlags, *pDevice);
|
||||
EXPECT_EQ(2u, completionStamp.taskCount);
|
||||
EXPECT_EQ(2u, commandStreamReceiver.taskCount);
|
||||
EXPECT_EQ(2u, commandStreamReceiver.latestSentTaskCount);
|
||||
EXPECT_EQ(2u, commandStreamReceiver.latestFlushedTaskCount);
|
||||
|
||||
hwParserCsr.tearDown();
|
||||
hwParserCsr.parseCommands<FamilyType>(commandStream, startOffset);
|
||||
cmdItor = hwParserCsr.getCommandItor<PIPE_CONTROL>();
|
||||
ASSERT_NE(hwParserCsr.cmdList.end(), cmdItor);
|
||||
pipeControlCmd = genCmdCast<PIPE_CONTROL *>(*cmdItor);
|
||||
ASSERT_NE(nullptr, pipeControlCmd);
|
||||
EXPECT_EQ(postsyncAddress, NEO::UnitTestHelper<FamilyType>::getPipeControlPostSyncAddress(*pipeControlCmd));
|
||||
EXPECT_EQ(2u, pipeControlCmd->getImmediateData());
|
||||
|
||||
cmdItor++;
|
||||
ASSERT_NE(hwParserCsr.cmdList.end(), cmdItor);
|
||||
if (additionalSyncCmd) {
|
||||
cmdItor++;
|
||||
ASSERT_NE(hwParserCsr.cmdList.end(), cmdItor);
|
||||
}
|
||||
bbEndCmd = genCmdCast<MI_BATCH_BUFFER_END *>(*cmdItor);
|
||||
ASSERT_NE(nullptr, bbEndCmd);
|
||||
|
||||
EXPECT_TRUE(commandStreamReceiver.isMadeResident(csrTagAllocation));
|
||||
EXPECT_TRUE(commandStreamReceiver.isMadeResident(immediateListCmdBufferAllocation));
|
||||
|
||||
startOffset = commandStream.getUsed();
|
||||
EXPECT_EQ(0u, (startOffset % MemoryConstants::cacheLineSize));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user