test: correct expectations 2/2

Related-To: NEO-13163
Signed-off-by: Kamil Kopryk <kamil.kopryk@intel.com>
This commit is contained in:
Kamil Kopryk
2025-03-26 02:23:45 +00:00
committed by Compute-Runtime-Automation
parent d1d3e34d11
commit 402fc037c3
11 changed files with 88 additions and 18 deletions

View File

@@ -1103,6 +1103,7 @@ HWTEST_F(CommandQueueHwTest, givenCommandQueueWhenDispatchingWorkThenRegisterCsr
}
HWTEST_F(CommandQueueHwTest, givenCsrClientWhenCallingSyncPointsThenUnregister) {
MockKernelWithInternals mockKernelWithInternals(*pClDevice);
auto mockKernel = mockKernelWithInternals.mockKernel;
@@ -1134,7 +1135,11 @@ HWTEST_F(CommandQueueHwTest, givenCsrClientWhenCallingSyncPointsThenUnregister)
clWaitForEvents(1, &e0);
EXPECT_EQ(baseNumClients + 1, csr.getNumClients()); // CSR task count < queue task count
*csr.tagAddress = mockCmdQueueHw.taskCount;
if (csr.isUpdateTagFromWaitEnabled()) {
*csr.tagAddress = mockCmdQueueHw.taskCount + 1;
} else {
*csr.tagAddress = mockCmdQueueHw.taskCount;
}
clWaitForEvents(1, &e0);
EXPECT_EQ(baseNumClients, csr.getNumClients()); // queue ready

View File

@@ -318,7 +318,11 @@ HWTEST_F(DispatchFlagsBlitTests, givenBlitEnqueueWhenDispatchingCommandsWithoutK
eventsRequest, eventBuilder, 0, csrDeps, &bcsCsr, false);
EXPECT_TRUE(mockCsr->passedDispatchFlags.implicitFlush);
EXPECT_TRUE(mockCsr->passedDispatchFlags.guardCommandBufferWithPipeControl);
if (mockCsr->isUpdateTagFromWaitEnabled()) {
EXPECT_FALSE(mockCsr->passedDispatchFlags.guardCommandBufferWithPipeControl);
} else {
EXPECT_TRUE(mockCsr->passedDispatchFlags.guardCommandBufferWithPipeControl);
}
EXPECT_EQ(L3CachingSettings::notApplicable, mockCsr->passedDispatchFlags.l3CacheSettings);
EXPECT_EQ(GrfConfig::notApplicable, mockCsr->passedDispatchFlags.numGrfRequired);
}
@@ -556,6 +560,9 @@ HWTEST_F(DispatchFlagsTests, givenMockKernelWhenSettingAdditionalKernelExecInfoT
}
HWTEST_F(EnqueueHandlerTest, GivenCommandStreamWithoutKernelAndZeroSurfacesWhenEnqueuedHandlerThenProgramPipeControl) {
DebugManagerStateRestore restorer{};
debugManager.flags.ForceL3FlushAfterPostSync.set(0);
std::unique_ptr<MockCommandQueueWithCacheFlush<FamilyType>> mockCmdQ(new MockCommandQueueWithCacheFlush<FamilyType>(context, pClDevice, 0));
mockCmdQ->commandRequireCacheFlush = true;

View File

@@ -1269,7 +1269,13 @@ HWTEST_F(EnqueueKernelTest, givenCsrInBatchingModeWhenWaitForEventsIsCalledWithU
EXPECT_EQ(CL_SUCCESS, status);
EXPECT_TRUE(mockedSubmissionsAggregator->peekCmdBufferList().peekIsEmpty());
EXPECT_EQ(mockCsr->heaplessStateInitialized ? 2u : 1u, mockCsr->flushCalledCount);
auto expectedFlushCalledCount = mockCsr->heaplessStateInitialized ? 2u : 1u;
if (mockCsr->isUpdateTagFromWaitEnabled()) {
expectedFlushCalledCount++;
}
EXPECT_EQ(expectedFlushCalledCount, mockCsr->flushCalledCount);
status = clReleaseEvent(event);
EXPECT_EQ(CL_SUCCESS, status);
@@ -1419,7 +1425,12 @@ HWTEST_F(EnqueueKernelTest, givenInOrderCommandQueueWhenEnqueueKernelReturningEv
EXPECT_FALSE(mockedSubmissionsAggregator->peekCmdBufferList().peekIsEmpty());
auto cmdBuffer = mockedSubmissionsAggregator->peekCmdBufferList().peekHead();
EXPECT_EQ(nullptr, cmdBuffer->pipeControlThatMayBeErasedLocation);
EXPECT_NE(nullptr, cmdBuffer->epiloguePipeControlLocation);
if (mockCsr->isUpdateTagFromWaitEnabled()) {
EXPECT_EQ(nullptr, cmdBuffer->epiloguePipeControlLocation);
} else {
EXPECT_NE(nullptr, cmdBuffer->epiloguePipeControlLocation);
}
clReleaseCommandQueue(inOrderQueue);
clReleaseEvent(event);
@@ -1505,6 +1516,10 @@ HWTEST_F(EnqueueKernelTest, givenCsrInBatchingModeWhenBlockingCallIsMadeThenEven
auto expectedCount = mockCsr->heaplessStateInitialized ? 2u : 1u;
EXPECT_EQ(expectedCount, neoEvent->flushStamp->peekStamp());
if (mockCsr->isUpdateTagFromWaitEnabled()) {
expectedCount++;
}
EXPECT_EQ(expectedCount, mockCsr->flushCalledCount);
auto status = clReleaseEvent(event);

View File

@@ -215,6 +215,9 @@ TEST_F(EventTests, GivenNoEventsWhenEnqueuingKernelThenTaskLevelIsIncremented) {
}
TEST_F(EventTests, WhenEnqueuingMarkerThenPassedEventHasTheSameLevelAsPreviousCommand) {
DebugManagerStateRestore restorer{};
debugManager.flags.ForceL3FlushAfterPostSync.set(0);
cl_uint numEventsInWaitList = 0;
cl_event *eventWaitList = nullptr;
cl_event event = nullptr;

View File

@@ -349,7 +349,12 @@ HWTEST_F(EnqueueMapBufferTest, givenNonBlockingReadOnlyMapBufferOnZeroCopyBuffer
EXPECT_EQ(CL_SUCCESS, retVal);
// wait for event do not sent flushTask
EXPECT_EQ(expectedTaskCount, commandStreamReceiver.peekTaskCount());
if (commandStreamReceiver.isUpdateTagFromWaitEnabled()) {
EXPECT_EQ(expectedTaskCount + 1, commandStreamReceiver.peekTaskCount());
} else {
EXPECT_EQ(expectedTaskCount, commandStreamReceiver.peekTaskCount());
}
EXPECT_EQ(expectedTaskCount, mockCmdQueue.latestTaskCountWaited);
EXPECT_TRUE(neoEvent->updateStatusAndCheckCompletion());
@@ -364,7 +369,12 @@ HWTEST_F(EnqueueMapBufferTest, givenNonBlockingReadOnlyMapBufferOnZeroCopyBuffer
nullptr,
&unmapEventReturned);
EXPECT_EQ(CL_SUCCESS, retVal);
EXPECT_EQ(expectedTaskCount, commandStreamReceiver.peekTaskCount());
if (commandStreamReceiver.isUpdateTagFromWaitEnabled()) {
EXPECT_EQ(expectedTaskCount + 1, commandStreamReceiver.peekTaskCount());
} else {
EXPECT_EQ(expectedTaskCount, commandStreamReceiver.peekTaskCount());
}
auto unmapEvent = castToObject<Event>(unmapEventReturned);
EXPECT_TRUE(CL_COMMAND_UNMAP_MEM_OBJECT == unmapEvent->getCommandType());
@@ -538,8 +548,11 @@ TEST_F(EnqueueMapBufferTest, givenNonBlockingMapBufferAfterL3IsAlreadyFlushedThe
retVal = clWaitForEvents(1, &eventReturned);
EXPECT_EQ(CL_SUCCESS, retVal);
EXPECT_EQ(expectedTaskCount, commandStreamReceiver.peekLatestSentTaskCount());
if (commandStreamReceiver.isUpdateTagFromWaitEnabled()) {
EXPECT_EQ(expectedTaskCount + 1, commandStreamReceiver.peekLatestSentTaskCount());
} else {
EXPECT_EQ(expectedTaskCount, commandStreamReceiver.peekLatestSentTaskCount());
}
retVal = clReleaseMemObject(buffer);
EXPECT_EQ(CL_SUCCESS, retVal);
@@ -602,7 +615,12 @@ HWTEST_F(EnqueueMapBufferTest, GivenBufferThatIsNotZeroCopyWhenNonBlockingMapIsC
commandStreamReceiver.peekTaskCount();
EXPECT_EQ(expectedTaskCount, commandStreamReceiver.peekLatestSentTaskCount());
if (commandStreamReceiver.isUpdateTagFromWaitEnabled()) {
EXPECT_EQ(expectedTaskCount + 1, commandStreamReceiver.peekLatestSentTaskCount());
} else {
EXPECT_EQ(expectedTaskCount, commandStreamReceiver.peekLatestSentTaskCount());
}
EXPECT_EQ(expectedTaskCount, mockCmdQueue.latestTaskCountWaited);
retVal = clReleaseMemObject(buffer);

View File

@@ -392,7 +392,11 @@ HWTEST_F(EnqueueMapImageTest, givenNonReadOnlyMapWithOutEventWhenMappedThenSetEv
retVal = clWaitForEvents(1, &unmapEventReturned);
taskCount = commandStreamReceiver.peekTaskCount();
EXPECT_EQ(expectedTaskCount, taskCount);
if (commandStreamReceiver.isUpdateTagFromWaitEnabled()) {
EXPECT_EQ(expectedTaskCount + 1, taskCount);
} else {
EXPECT_EQ(expectedTaskCount, taskCount);
}
clReleaseEvent(mapEventReturned);
clReleaseEvent(unmapEventReturned);

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2018-2023 Intel Corporation
* Copyright (C) 2018-2025 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -72,7 +72,7 @@ HWTEST_F(GetSizeRequiredTest, WhenEnqueuingMarkerThenHeapsAndCommandBufferAreNot
EXPECT_EQ(CL_SUCCESS, retVal);
size_t expectedStreamSize = 0;
if (pCmdQ->getGpgpuCommandStreamReceiver().peekTimestampPacketWriteEnabled()) {
if (pCmdQ->getGpgpuCommandStreamReceiver().peekTimestampPacketWriteEnabled() && (!pCmdQ->getGpgpuCommandStreamReceiver().isUpdateTagFromWaitEnabled())) {
expectedStreamSize = alignUp(MemorySynchronizationCommands<FamilyType>::getSizeForBarrierWithPostSyncOperation(
pDevice->getRootDeviceEnvironment(), false),
MemoryConstants::cacheLineSize);

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2018-2024 Intel Corporation
* Copyright (C) 2018-2025 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -61,6 +61,10 @@ TYPED_TEST_P(OOQTaskTypedTests, givenNonBlockingCallWhenDoneOnOutOfOrderQueueThe
auto blockingCall = isBlockingCall(TypeParam::Traits::cmdType);
auto taskLevelClosed = blockingCall ? 1u : 0u; // for blocking commands task level will be closed
if (commandStreamReceiver.isUpdateTagFromWaitEnabled()) {
taskLevelClosed = 0u;
}
// for non blocking calls make sure that resources are added to defer free list instaed of being destructed in place
if (!blockingCall) {
*tagAddress = 0;

View File

@@ -620,6 +620,7 @@ HWTEST_F(BcsTests, givenProfilingEnabledWhenBlitBufferThenCommandBufferIsConstru
HWTEST_F(BcsTests, givenProfilingEnabledWhenBlitBufferAndForceTlbFlushAfterCopyThenCommandBufferIsConstructedProperlyAndTlbFlushDetected) {
DebugManagerStateRestore restorer;
debugManager.flags.ForceL3FlushAfterPostSync.set(0);
debugManager.flags.ForceTlbFlushWithTaskCountAfterCopy.set(1);
using MI_FLUSH_DW = typename FamilyType::MI_FLUSH_DW;
auto bcsOsContext = std::unique_ptr<OsContext>(OsContext::create(nullptr, pDevice->getRootDeviceIndex(), 0,
@@ -676,6 +677,7 @@ HWTEST_F(BcsTests, givenProfilingEnabledWhenBlitBufferAndForceTlbFlushAfterCopyT
HWTEST_F(BcsTests, givenProfilingDisabledWhenBlitBufferAndForceTlbFlushAfterCopyThenCommandBufferIsConstructedProperlyAndTlbFlushDetected) {
DebugManagerStateRestore restorer;
debugManager.flags.ForceTlbFlushWithTaskCountAfterCopy.set(1);
debugManager.flags.ForceL3FlushAfterPostSync.set(0);
using MI_FLUSH_DW = typename FamilyType::MI_FLUSH_DW;
auto bcsOsContext = std::unique_ptr<OsContext>(OsContext::create(nullptr, pDevice->getRootDeviceIndex(), 0,
EngineDescriptorHelper::getDefaultDescriptor({aub_stream::ENGINE_BCS, EngineUsage::regular}, pDevice->getDeviceBitfield())));

View File

@@ -690,7 +690,11 @@ HWCMDTEST_F(IGFX_XE_HP_CORE, CommandStreamReceiverHwTestXeHPAndLater, givenBlock
}
EXPECT_TRUE(mockCsr->passedDispatchFlags.blocking);
EXPECT_TRUE(mockCsr->passedDispatchFlags.guardCommandBufferWithPipeControl);
if (mockCsr->isUpdateTagFromWaitEnabled()) {
EXPECT_FALSE(mockCsr->passedDispatchFlags.guardCommandBufferWithPipeControl);
} else {
EXPECT_TRUE(mockCsr->passedDispatchFlags.guardCommandBufferWithPipeControl);
}
EXPECT_EQ(pDevice->getPreemptionMode(), mockCsr->passedDispatchFlags.preemptionMode);
cmdQ0->isQueueBlocked();

View File

@@ -42,7 +42,10 @@ struct BcsBufferTests : public ::testing::Test {
WaitStatus waitForTaskCountWithKmdNotifyFallback(TaskCountType taskCountToWait, FlushStamp flushStampToWait,
bool useQuickKmdSleep, QueueThrottle throttle) override {
EXPECT_EQ(this->latestFlushedTaskCount, taskCountToWait);
if (!this->isUpdateTagFromWaitEnabled()) {
EXPECT_EQ(this->latestFlushedTaskCount, taskCountToWait);
}
EXPECT_EQ(0u, flushStampToWait);
EXPECT_FALSE(useQuickKmdSleep);
EXPECT_EQ(throttle, QueueThrottle::MEDIUM);
@@ -54,7 +57,9 @@ struct BcsBufferTests : public ::testing::Test {
WaitStatus waitForTaskCountAndCleanTemporaryAllocationList(TaskCountType requiredTaskCount) override {
EXPECT_EQ(1u, waitForTaskCountWithKmdNotifyFallbackCalled);
EXPECT_EQ(this->latestFlushedTaskCount, requiredTaskCount);
if (!this->isUpdateTagFromWaitEnabled()) {
EXPECT_EQ(this->latestFlushedTaskCount, requiredTaskCount);
}
waitForTaskCountAndCleanAllocationListCalled++;
return WaitStatus::ready;
@@ -585,6 +590,8 @@ HWTEST_TEMPLATED_F(BcsBufferTests, givenAllEnginesReadyWhenWaitingForEventThenCl
}
HWTEST_TEMPLATED_F(BcsBufferTests, givenAllBcsEnginesReadyWhenWaitingForEventThenClearDeferredNodes) {
DebugManagerStateRestore restorer{};
debugManager.flags.ForceL3FlushAfterPostSync.set(0);
auto &productHelper = device->getProductHelper();
auto copyDefaultEngineType = productHelper.getDefaultCopyEngine();
auto mockCmdQ = static_cast<MockCommandQueueHw<FamilyType> *>(commandQueue.get());
@@ -1036,8 +1043,9 @@ HWTEST_TEMPLATED_F(BcsBufferTests, givenInputAndOutputTimestampPacketWhenBlitCal
EXPECT_NE(outputTimestampPacketAllocation, inputTimestampPacketAllocation);
EXPECT_EQ(cmdQ->taskCount, inputTimestampPacketAllocation->getDefaultGraphicsAllocation()->getTaskCount(bcsCsr->getOsContext().getContextId()));
EXPECT_EQ(cmdQ->taskCount, outputTimestampPacketAllocation->getDefaultGraphicsAllocation()->getTaskCount(bcsCsr->getOsContext().getContextId()));
auto expectedTaskCount = bcsCsr->isUpdateTagFromWaitEnabled() ? cmdQ->taskCount + 1 : cmdQ->taskCount;
EXPECT_EQ(expectedTaskCount, inputTimestampPacketAllocation->getDefaultGraphicsAllocation()->getTaskCount(bcsCsr->getOsContext().getContextId()));
EXPECT_EQ(expectedTaskCount, outputTimestampPacketAllocation->getDefaultGraphicsAllocation()->getTaskCount(bcsCsr->getOsContext().getContextId()));
}
HWTEST_TEMPLATED_F(BcsBufferTests, givenBlockingWriteBufferWhenUsingBcsThenCallWait) {