Skip to content

Commit 4037b36

Browse files
Add test for BCS command buffer task count
Signed-off-by: Lukasz Jobczyk <[email protected]>
1 parent bcd9b2f commit 4037b36

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

opencl/test/unit_test/command_stream/command_stream_receiver_hw_2_tests.cpp

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -311,6 +311,28 @@ HWTEST_F(BcsTests, givenMultipleBlitPropertiesWhenDispatchingThenProgramCommands
311311
EXPECT_EQ(2u, dependenciesFound);
312312
}
313313

314+
HWTEST_F(BcsTests, whenBlitBufferThenCommandBufferHasProperTaskCount) {
315+
auto &csr = pDevice->getUltCommandStreamReceiver<FamilyType>();
316+
317+
cl_int retVal = CL_SUCCESS;
318+
auto buffer = clUniquePtr<Buffer>(Buffer::create(context.get(), CL_MEM_READ_WRITE, 1, nullptr, retVal));
319+
void *hostPtr = reinterpret_cast<void *>(0x12340000);
320+
auto graphicsAllocation = buffer->getGraphicsAllocation(pDevice->getRootDeviceIndex());
321+
322+
auto blitProperties = BlitProperties::constructPropertiesForReadWrite(BlitterConstants::BlitDirection::HostPtrToBuffer,
323+
csr, graphicsAllocation, nullptr, hostPtr,
324+
graphicsAllocation->getGpuAddress(), 0,
325+
0, 0, {1, 1, 1}, 0, 0, 0, 0);
326+
327+
BlitPropertiesContainer blitPropertiesContainer;
328+
blitPropertiesContainer.push_back(blitProperties);
329+
330+
csr.blitBuffer(blitPropertiesContainer, true, false);
331+
332+
EXPECT_EQ(csr.getCS(0u).getGraphicsAllocation()->getTaskCount(csr.getOsContext().getContextId()), csr.peekTaskCount());
333+
EXPECT_EQ(csr.getCS(0u).getGraphicsAllocation()->getResidencyTaskCount(csr.getOsContext().getContextId()), csr.peekTaskCount());
334+
}
335+
314336
HWTEST_F(BcsTests, givenProfilingEnabledWhenBlitBufferThenCommandBufferIsConstructedProperly) {
315337
auto bcsOsContext = std::unique_ptr<OsContext>(OsContext::create(nullptr, 0, pDevice->getDeviceBitfield(), EngineTypeUsage{aub_stream::ENGINE_BCS, EngineUsage::Regular}, PreemptionMode::Disabled, false));
316338
auto bcsCsr = std::make_unique<UltCommandStreamReceiver<FamilyType>>(*pDevice->getExecutionEnvironment(), pDevice->getRootDeviceIndex(), pDevice->getDeviceBitfield());

0 commit comments

Comments
 (0)