Synchronize switching command buffers for all partitions

Signed-off-by: Zbigniew Zdanowicz <zbigniew.zdanowicz@intel.com>
This commit is contained in:
Zbigniew Zdanowicz
2021-09-06 22:29:47 +00:00
committed by Compute-Runtime-Automation
parent 6b062a62b8
commit cd4f3c221a
35 changed files with 271 additions and 112 deletions

View File

@ -319,7 +319,7 @@ HWTEST_F(AubFileStreamTests, givenAubCommandStreamReceiverWhenCallingInsertAubWa
auto aubExecutionEnvironment = getEnvironment<MockAubCsr<FamilyType>>(true, true, true);
auto aubCsr = aubExecutionEnvironment->template getCsr<MockAubCsr<FamilyType>>();
ASSERT_FALSE(aubCsr->pollForCompletionCalled);
aubCsr->waitForTaskCountWithKmdNotifyFallback(0, 0, false, false);
aubCsr->waitForTaskCountWithKmdNotifyFallback(0, 0, false, false, 1, 0);
EXPECT_TRUE(aubCsr->pollForCompletionCalled);
}

View File

@ -434,6 +434,24 @@ HWTEST_F(UltCommandStreamReceiverTest, givenComputeOverrideDisableWhenComputeSup
EXPECT_FALSE(startInContext);
}
HWTEST_F(UltCommandStreamReceiverTest, givenSinglePartitionWhenCallingWaitKmdNotifyThenExpectImplicitBusyLoopWaitCalled) {
auto &commandStreamReceiver = pDevice->getUltCommandStreamReceiver<FamilyType>();
commandStreamReceiver.callBaseWaitForCompletionWithTimeout = false;
commandStreamReceiver.returnWaitForCompletionWithTimeout = false;
commandStreamReceiver.waitForTaskCountWithKmdNotifyFallback(0, 0, false, false, 1, 0);
EXPECT_EQ(2u, commandStreamReceiver.waitForCompletionWithTimeoutTaskCountCalled);
}
HWTEST_F(UltCommandStreamReceiverTest, givenMultiplePartitionsWhenCallingWaitKmdNotifyThenExpectExplicitBusyLoopWaitCalled) {
auto &commandStreamReceiver = pDevice->getUltCommandStreamReceiver<FamilyType>();
commandStreamReceiver.callBaseWaitForCompletionWithTimeout = false;
commandStreamReceiver.returnWaitForCompletionWithTimeout = false;
commandStreamReceiver.waitForTaskCountWithKmdNotifyFallback(0, 0, false, false, 2, 8);
EXPECT_EQ(2u, commandStreamReceiver.waitForCompletionWithTimeoutTaskCountExplicitCalled);
}
typedef UltCommandStreamReceiverTest CommandStreamReceiverFlushTests;
HWTEST_F(CommandStreamReceiverFlushTests, WhenAddingBatchBufferEndThenBatchBufferEndIsAppendedCorrectly) {

View File

@ -579,19 +579,24 @@ HWTEST_F(BcsTests, whenBlitFromHostPtrCalledThenCallWaitWithKmdFallback) {
using UltCommandStreamReceiver<FamilyType>::UltCommandStreamReceiver;
void waitForTaskCountWithKmdNotifyFallback(uint32_t taskCountToWait, FlushStamp flushStampToWait,
bool useQuickKmdSleep, bool forcePowerSavingMode) override {
bool useQuickKmdSleep, bool forcePowerSavingMode,
uint32_t partitionCount, uint32_t offsetSize) override {
waitForTaskCountWithKmdNotifyFallbackCalled++;
taskCountToWaitPassed = taskCountToWait;
flushStampToWaitPassed = flushStampToWait;
useQuickKmdSleepPassed = useQuickKmdSleep;
forcePowerSavingModePassed = forcePowerSavingMode;
partitionCountPassed = partitionCount;
offsetSizePassed = offsetSize;
}
uint32_t taskCountToWaitPassed = 0;
FlushStamp flushStampToWaitPassed = 0;
uint32_t taskCountToWaitPassed = 0;
uint32_t waitForTaskCountWithKmdNotifyFallbackCalled = 0;
uint32_t partitionCountPassed = 0;
uint32_t offsetSizePassed = 0;
bool useQuickKmdSleepPassed = false;
bool forcePowerSavingModePassed = false;
uint32_t waitForTaskCountWithKmdNotifyFallbackCalled = 0;
};
auto myMockCsr = std::make_unique<::testing::NiceMock<MyMockCsr>>(*pDevice->getExecutionEnvironment(), pDevice->getRootDeviceIndex(), pDevice->getDeviceBitfield());
@ -625,6 +630,8 @@ HWTEST_F(BcsTests, whenBlitFromHostPtrCalledThenCallWaitWithKmdFallback) {
EXPECT_EQ(myMockCsr->flushStamp->peekStamp(), myMockCsr->flushStampToWaitPassed);
EXPECT_FALSE(myMockCsr->useQuickKmdSleepPassed);
EXPECT_FALSE(myMockCsr->forcePowerSavingModePassed);
EXPECT_EQ(1u, myMockCsr->partitionCountPassed);
EXPECT_EQ(0u, myMockCsr->offsetSizePassed);
}
HWTEST_F(BcsTests, whenBlitFromHostPtrCalledThenCleanTemporaryAllocations) {

View File

@ -229,11 +229,11 @@ HWTEST_F(CommandStreamReceiverWithAubDumpSimpleTest, givenCsrWithAubDumpWhenWait
csrWithAubDump.aubCSR.reset(mockAubCsr);
EXPECT_FALSE(mockAubCsr->pollForCompletionCalled);
csrWithAubDump.waitForTaskCountWithKmdNotifyFallback(1, 0, false, false);
csrWithAubDump.waitForTaskCountWithKmdNotifyFallback(1, 0, false, false, 1, 0);
EXPECT_TRUE(mockAubCsr->pollForCompletionCalled);
csrWithAubDump.aubCSR.reset(nullptr);
csrWithAubDump.waitForTaskCountWithKmdNotifyFallback(1, 0, false, false);
csrWithAubDump.waitForTaskCountWithKmdNotifyFallback(1, 0, false, false, 1, 0);
}
HWTEST_F(CommandStreamReceiverWithAubDumpSimpleTest, givenCsrWithAubDumpWhenCreatingAubCsrThenInitializeTagAllocation) {

View File

@ -361,7 +361,7 @@ HWTEST_F(TbxCommandSteamSimpleTest, givenTbxCsrWhenCallingWaitForTaskCountWithKm
tbxCsr.allocationsForDownload = {&allocation1, &allocation2, &allocation3};
tbxCsr.waitForTaskCountWithKmdNotifyFallback(0u, 0u, false, false);
tbxCsr.waitForTaskCountWithKmdNotifyFallback(0u, 0u, false, false, 1, 0);
std::set<GraphicsAllocation *> expectedDownloadedAllocations = {tbxCsr.getTagAllocation(), &allocation1, &allocation2, &allocation3};
EXPECT_EQ(expectedDownloadedAllocations, tbxCsr.downloadedAllocations);