Skip to content

Commit 6255dbf

Browse files
Add test for batching optimization
Signed-off-by: Lukasz Jobczyk <lukasz.jobczyk@intel.com>
1 parent b2bbb05 commit 6255dbf

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

opencl/test/unit_test/command_queue/enqueue_kernel_1_tests.cpp

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -909,6 +909,30 @@ HWTEST_F(EnqueueKernelTest, givenCommandStreamReceiverInBatchingModeWhenFlushIsC
909909
EXPECT_EQ(1, mockCsr->flushCalledCount);
910910
}
911911

912+
HWCMDTEST_F(IGFX_XE_HP_CORE, EnqueueKernelTest, givenTwoEnqueueProgrammedWithinSameCommandBufferWhenBatchedThenNoBBSBetweenThem) {
913+
auto mockCsr = new MockCsrHw2<FamilyType>(*pDevice->executionEnvironment, pDevice->getRootDeviceIndex(), pDevice->getDeviceBitfield());
914+
mockCsr->overrideDispatchPolicy(DispatchMode::BatchedDispatch);
915+
mockCsr->useNewResourceImplicitFlush = false;
916+
mockCsr->useGpuIdleImplicitFlush = false;
917+
pDevice->resetCommandStreamReceiver(mockCsr);
918+
919+
auto mockedSubmissionsAggregator = new mockSubmissionsAggregator();
920+
mockCsr->overrideSubmissionAggregator(mockedSubmissionsAggregator);
921+
922+
HardwareParse hwParse;
923+
924+
MockKernelWithInternals mockKernel(*pClDevice);
925+
size_t gws[3] = {1, 0, 0};
926+
pCmdQ->enqueueKernel(mockKernel.mockKernel, 1, nullptr, gws, nullptr, 0, nullptr, nullptr);
927+
pCmdQ->enqueueKernel(mockKernel.mockKernel, 1, nullptr, gws, nullptr, 0, nullptr, nullptr);
928+
pCmdQ->flush();
929+
930+
hwParse.parseCommands<FamilyType>(*pCmdQ);
931+
auto bbsCommands = findAll<typename FamilyType::MI_BATCH_BUFFER_START *>(hwParse.cmdList.begin(), hwParse.cmdList.end());
932+
933+
EXPECT_EQ(bbsCommands.size(), 1u);
934+
}
935+
912936
HWTEST_F(EnqueueKernelTest, givenCsrInBatchingModeWhenFinishIsCalledThenBatchesSubmissionsAreFlushed) {
913937
auto mockCsr = new MockCsrHw2<FamilyType>(*pDevice->executionEnvironment, pDevice->getRootDeviceIndex(), pDevice->getDeviceBitfield());
914938
mockCsr->overrideDispatchPolicy(DispatchMode::BatchedDispatch);

0 commit comments

Comments
 (0)