@@ -62,7 +62,6 @@ using ::testing::_;
6262
6363HWTEST_F (UltCommandStreamReceiverTest, requiredCmdSizeForPreamble) {
6464 auto expectedCmdSize =
65- sizeof (typename FamilyType::MI_LOAD_REGISTER_IMM) +
6665 sizeof (typename FamilyType::PIPE_CONTROL) +
6766 sizeof (typename FamilyType::MEDIA_VFE_STATE) +
6867 PreambleHelper<FamilyType>::getAdditionalCommandsSize (*pDevice);
@@ -700,14 +699,7 @@ HWTEST_F(CommandStreamReceiverFlushTaskTests, flushTaskWithOnlyEnoughMemoryForPr
700699
701700 auto &csrCS = commandStreamReceiver.getCS ();
702701 size_t sizeNeededForPreamble = getSizeRequiredPreambleCS<FamilyType>(MockDevice (commandStreamReceiver.hwInfo ));
703- size_t sizeNeededForStateBaseAddress = sizeof (STATE_BASE_ADDRESS) + sizeof (PIPE_CONTROL);
704- size_t sizeNeededForPipeControl = commandStreamReceiver.getRequiredPipeControlSize ();
705- size_t sizeNeededForPreemption = PreemptionHelper::getRequiredCmdStreamSize<FamilyType>(pDevice->getPreemptionMode (), commandStreamReceiver.lastPreemptionMode );
706- size_t sizeNeeded = sizeNeededForPreamble +
707- sizeNeededForStateBaseAddress +
708- sizeNeededForPipeControl +
709- sizeNeededForPreemption +
710- sizeof (MI_BATCH_BUFFER_END);
702+ size_t sizeNeeded = commandStreamReceiver.getRequiredCmdStreamSize (flushTaskFlags);
711703 sizeNeeded = alignUp (sizeNeeded, MemoryConstants::cacheLineSize);
712704
713705 csrCS.getSpace (csrCS.getAvailableSpace () - sizeNeededForPreamble);
@@ -736,13 +728,7 @@ HWTEST_F(CommandStreamReceiverFlushTaskTests, flushTaskWithOnlyEnoughMemoryForPr
736728 auto &csrCS = commandStreamReceiver.getCS ();
737729 size_t sizeNeededForPreamble = getSizeRequiredPreambleCS<FamilyType>(MockDevice (commandStreamReceiver.hwInfo ));
738730 size_t sizeNeededForStateBaseAddress = sizeof (STATE_BASE_ADDRESS) + sizeof (PIPE_CONTROL);
739- size_t sizeNeededForPipeControl = commandStreamReceiver.getRequiredPipeControlSize ();
740- size_t sizeNeededForPreemption = PreemptionHelper::getRequiredCmdStreamSize<FamilyType>(pDevice->getPreemptionMode (), commandStreamReceiver.lastPreemptionMode );
741- size_t sizeNeeded = sizeNeededForPreamble +
742- sizeNeededForStateBaseAddress +
743- sizeNeededForPipeControl +
744- sizeNeededForPreemption +
745- sizeof (MI_BATCH_BUFFER_END);
731+ size_t sizeNeeded = commandStreamReceiver.getRequiredCmdStreamSize (flushTaskFlags);
746732 sizeNeeded = alignUp (sizeNeeded, MemoryConstants::cacheLineSize);
747733
748734 csrCS.getSpace (csrCS.getAvailableSpace () - sizeNeededForPreamble - sizeNeededForStateBaseAddress);
@@ -1351,46 +1337,6 @@ HWTEST_F(CommandStreamReceiverFlushTaskTests, GivenFlushedCallRequiringDCFlushWh
13511337 retVal = clReleaseMemObject (buffer);
13521338}
13531339
1354- HWTEST_F (CommandStreamReceiverFlushTaskTests, GivenKernelWithSlmWhenPreviousNOSLML3WasSentThenProgramL3WithSLML3Config) {
1355- typedef typename FamilyType::MI_LOAD_REGISTER_IMM MI_LOAD_REGISTER_IMM;
1356- typedef typename FamilyType::PIPE_CONTROL PIPE_CONTROL;
1357- size_t GWS = 1 ;
1358- MockContext ctx (pDevice);
1359- MockKernelWithInternals kernel (*pDevice);
1360- CommandQueueHw<FamilyType> commandQueue (&ctx, pDevice, 0 );
1361- auto commandStreamReceiver = new MockCsrHw<FamilyType>(*platformDevices[0 ]);
1362- pDevice->resetCommandStreamReceiver (commandStreamReceiver);
1363-
1364- auto &commandStreamCSR = commandStreamReceiver->getCS ();
1365-
1366- // Mark Pramble as sent, override L3Config to invalid to programL3
1367- commandStreamReceiver->isPreambleSent = true ;
1368- commandStreamReceiver->lastSentL3Config = 0 ;
1369-
1370- ((MockKernel *)kernel)->setTotalSLMSize (1024 );
1371-
1372- cmdList.clear ();
1373- commandQueue.enqueueKernel (kernel, 1 , nullptr , &GWS, nullptr , 0 , nullptr , nullptr );
1374-
1375- // Parse command list to verify that PC was added to taskCS
1376- parseCommands<FamilyType>(commandStreamCSR, 0 );
1377-
1378- auto itorCmd = findMmio<FamilyType>(cmdList.begin (), cmdList.end (), L3CNTLRegisterOffset<FamilyType>::registerOffset);
1379- ASSERT_NE (cmdList.end (), itorCmd);
1380-
1381- auto cmdMILoad = genCmdCast<MI_LOAD_REGISTER_IMM *>(*itorCmd);
1382- ASSERT_NE (nullptr , cmdMILoad);
1383-
1384- // MI_LOAD_REGISTER should be preceded by PC
1385- EXPECT_NE (cmdList.begin (), itorCmd);
1386- --itorCmd;
1387- auto cmdPC = genCmdCast<PIPE_CONTROL *>(*itorCmd);
1388- ASSERT_NE (nullptr , cmdPC);
1389-
1390- uint32_t L3Config = PreambleHelper<FamilyType>::getL3Config (*platformDevices[0 ], true );
1391- EXPECT_EQ (L3Config, (uint32_t )cmdMILoad->getDataDword ());
1392- }
1393-
13941340HWTEST_F (CommandStreamReceiverFlushTaskTests, givenDefaultCommandStreamReceiverThenRoundRobinPolicyIsSelected) {
13951341 MockCsrHw<FamilyType> commandStreamReceiver (*platformDevices[0 ]);
13961342 EXPECT_EQ (PreambleHelper<FamilyType>::getDefaultThreadArbitrationPolicy (), commandStreamReceiver.peekThreadArbitrationPolicy ());
@@ -1426,51 +1372,6 @@ HWTEST_F(CommandStreamReceiverFlushTaskTests, GivenKernelWithSlmWhenPreviousSLML
14261372 EXPECT_EQ (cmdList.end (), itorCmd);
14271373}
14281374
1429- HWTEST_F (CommandStreamReceiverFlushTaskTests, GivenBlockedKernelWithSlmWhenPreviousNOSLML3WasSentThenProgramL3WithSLML3ConfigAfterUnblocking) {
1430- typedef typename FamilyType::MI_LOAD_REGISTER_IMM MI_LOAD_REGISTER_IMM;
1431- size_t GWS = 1 ;
1432- MockContext ctx (pDevice);
1433- MockKernelWithInternals kernel (*pDevice);
1434- CommandQueueHw<FamilyType> commandQueue (&ctx, pDevice, 0 );
1435- auto commandStreamReceiver = new MockCsrHw<FamilyType>(*platformDevices[0 ]);
1436- pDevice->resetCommandStreamReceiver (commandStreamReceiver);
1437- cl_event blockingEvent;
1438- MockEvent<UserEvent> mockEvent (&ctx);
1439- blockingEvent = &mockEvent;
1440-
1441- auto &commandStreamCSR = commandStreamReceiver->getCS ();
1442-
1443- uint32_t L3Config = PreambleHelper<FamilyType>::getL3Config (*platformDevices[0 ], false );
1444-
1445- // Mark Pramble as sent, override L3Config to SLM config
1446- commandStreamReceiver->isPreambleSent = true ;
1447- commandStreamReceiver->lastSentL3Config = 0 ;
1448-
1449- ((MockKernel *)kernel)->setTotalSLMSize (1024 );
1450-
1451- commandQueue.enqueueKernel (kernel, 1 , nullptr , &GWS, nullptr , 1 , &blockingEvent, nullptr );
1452-
1453- // Expect nothing was sent
1454- EXPECT_EQ (0u , commandStreamCSR.getUsed ());
1455-
1456- // Unblock Event
1457- mockEvent.setStatus (CL_COMPLETE);
1458-
1459- cmdList.clear ();
1460- // Parse command list
1461- parseCommands<FamilyType>(commandStreamCSR, 0 );
1462-
1463- // Expect L3 was programmed
1464- auto itorCmd = findMmio<FamilyType>(cmdList.begin (), cmdList.end (), L3CNTLRegisterOffset<FamilyType>::registerOffset);
1465- ASSERT_NE (cmdList.end (), itorCmd);
1466-
1467- auto cmdMILoad = genCmdCast<MI_LOAD_REGISTER_IMM *>(*itorCmd);
1468- ASSERT_NE (nullptr , cmdMILoad);
1469-
1470- L3Config = PreambleHelper<FamilyType>::getL3Config (*platformDevices[0 ], true );
1471- EXPECT_EQ (L3Config, (uint32_t )cmdMILoad->getDataDword ());
1472- }
1473-
14741375HWTEST_F (CommandStreamReceiverFlushTaskTests, CreateCommandStreamReceiverHw) {
14751376 const HardwareInfo hwInfo = *platformDevices[0 ];
14761377 auto csrHw = CommandStreamReceiverHw<FamilyType>::create (hwInfo);
@@ -1914,6 +1815,7 @@ HWTEST_F(CommandStreamReceiverFlushTaskTests, flushTaskWithPCWhenPreambleSentAnd
19141815
19151816HWTEST_F (CommandStreamReceiverFlushTaskTests, givenCsrWhenPreambleSentThenRequiredCsrSizeDependsOnL3ConfigChanged) {
19161817 typedef typename FamilyType::PIPE_CONTROL PIPE_CONTROL;
1818+ typedef typename FamilyType::MI_LOAD_REGISTER_IMM MI_LOAD_REGISTER_IMM;
19171819 UltCommandStreamReceiver<FamilyType> &commandStreamReceiver = (UltCommandStreamReceiver<FamilyType> &)pDevice->getCommandStreamReceiver ();
19181820 CsrSizeRequestFlags csrSizeRequest = {};
19191821 DispatchFlags flags;
@@ -1929,7 +1831,7 @@ HWTEST_F(CommandStreamReceiverFlushTaskTests, givenCsrWhenPreambleSentThenRequir
19291831
19301832 EXPECT_NE (l3ConfigNotChangedSize, l3ConfigChangedSize);
19311833 auto difference = l3ConfigChangedSize - l3ConfigNotChangedSize;
1932- EXPECT_EQ (sizeof (PIPE_CONTROL), difference);
1834+ EXPECT_EQ (sizeof (PIPE_CONTROL) + sizeof (MI_LOAD_REGISTER_IMM) , difference);
19331835}
19341836
19351837HWTEST_F (CommandStreamReceiverFlushTaskTests, givenCsrWhenPreambleNotSentThenRequiredCsrSizeDoesntDependOnL3ConfigChanged) {
0 commit comments