@@ -1729,14 +1729,14 @@ HWTEST2_F(CommandListCreateTests, givenPlatformNotSupportsSharedHeapsWhenImmedia
1729
1729
1730
1730
using PrimaryBatchBufferCmdListTest = Test<PrimaryBatchBufferCmdListFixture>;
1731
1731
1732
- HWTEST_F (PrimaryBatchBufferCmdListTest, givenForcedPrimaryBatchBufferWhenRegularAndImmediateObjectCreatedThenRegularSetPrimaryFlagAndImmediateNot ) {
1732
+ HWTEST_F (PrimaryBatchBufferCmdListTest, givenForcedPrimaryBatchBufferWhenRegularAndImmediateObjectCreatedThenRegularAndImmediateSetPrimaryFlag ) {
1733
1733
EXPECT_TRUE (commandList->dispatchCmdListBatchBufferAsPrimary );
1734
1734
EXPECT_TRUE (commandQueue->dispatchCmdListBatchBufferAsPrimary );
1735
1735
1736
- EXPECT_FALSE (commandListImmediate->dispatchCmdListBatchBufferAsPrimary );
1736
+ EXPECT_TRUE (commandListImmediate->dispatchCmdListBatchBufferAsPrimary );
1737
1737
ASSERT_NE (nullptr , commandListImmediate->cmdQImmediate );
1738
1738
auto immediateCmdQueue = static_cast <L0::ult::CommandQueue *>(commandListImmediate->cmdQImmediate );
1739
- EXPECT_FALSE (immediateCmdQueue->dispatchCmdListBatchBufferAsPrimary );
1739
+ EXPECT_TRUE (immediateCmdQueue->dispatchCmdListBatchBufferAsPrimary );
1740
1740
}
1741
1741
1742
1742
HWTEST_F (PrimaryBatchBufferCmdListTest, givenPrimaryBatchBufferWhenAppendingKernelAndClosingCommandListThenExpectAlignedSpaceForBatchBufferStart) {
@@ -1851,6 +1851,46 @@ HWTEST_F(PrimaryBatchBufferCmdListTest, givenRegularCmdListWhenFlushingThenPassS
1851
1851
EXPECT_TRUE (ultCsr->latestFlushedBatchBuffer .hasStallingCmds );
1852
1852
}
1853
1853
1854
+ HWTEST_F (PrimaryBatchBufferCmdListTest, givenRegularCmdListWhenNoPreambleExpectedAndForceBbStartThenDispatchBbStart) {
1855
+ using MI_BATCH_BUFFER_START = typename FamilyType::MI_BATCH_BUFFER_START;
1856
+
1857
+ ze_group_count_t groupCount{1 , 1 , 1 };
1858
+ CmdListKernelLaunchParams launchParams = {};
1859
+ auto result = commandList->appendLaunchKernel (kernel->toHandle (), groupCount, nullptr , 0 , nullptr , launchParams, false );
1860
+ EXPECT_EQ (ZE_RESULT_SUCCESS, result);
1861
+ result = commandList->close ();
1862
+ EXPECT_EQ (ZE_RESULT_SUCCESS, result);
1863
+ auto cmdListHandle = commandList->toHandle ();
1864
+
1865
+ auto regularCmdBufferAllocation = commandList->getCmdContainer ().getCommandStream ()->getGraphicsAllocation ();
1866
+
1867
+ // 1st dispatch can carry state preamble
1868
+ result = commandQueue->executeCommandLists (1 , &cmdListHandle, nullptr , true , nullptr );
1869
+ EXPECT_EQ (ZE_RESULT_SUCCESS, result);
1870
+
1871
+ auto &queueStream = commandQueue->commandStream ;
1872
+
1873
+ auto offsetBefore = queueStream.getUsed ();
1874
+ commandQueue->triggerBbStartJump ();
1875
+ result = commandQueue->executeCommandLists (1 , &cmdListHandle, nullptr , true , nullptr );
1876
+ EXPECT_EQ (ZE_RESULT_SUCCESS, result);
1877
+ auto offsetAfter = queueStream.getUsed ();
1878
+
1879
+ GenCmdList cmdList;
1880
+ ASSERT_TRUE (FamilyType::Parse::parseCommandBuffer (
1881
+ cmdList,
1882
+ ptrOffset (queueStream.getCpuBase (), offsetBefore),
1883
+ offsetAfter - offsetBefore));
1884
+ ASSERT_NE (0u , cmdList.size ());
1885
+
1886
+ auto firstCmdIt = cmdList.begin ();
1887
+ auto bbStartCmd = genCmdCast<MI_BATCH_BUFFER_START *>(*firstCmdIt);
1888
+ ASSERT_NE (nullptr , bbStartCmd);
1889
+
1890
+ EXPECT_EQ (regularCmdBufferAllocation->getGpuAddress (), bbStartCmd->getBatchBufferStartAddress ());
1891
+ EXPECT_EQ (MI_BATCH_BUFFER_START::SECOND_LEVEL_BATCH_BUFFER::SECOND_LEVEL_BATCH_BUFFER_FIRST_LEVEL_BATCH, bbStartCmd->getSecondLevelBatchBuffer ());
1892
+ }
1893
+
1854
1894
HWTEST2_F (PrimaryBatchBufferCmdListTest, givenRelaxedOrderingAndRegularCmdListAndSubmittedToImmediateWhenFlushingThenPassStallingCmdsInfo, IsAtLeastXeHpcCore) {
1855
1895
DebugManagerStateRestore restore;
1856
1896
debugManager.flags .DirectSubmissionRelaxedOrdering .set (1 );
0 commit comments