@@ -1044,6 +1044,15 @@ TEST(CommandStreamReceiverSimpleTest, givenMultipleActivePartitionsWhenWaitingFo
10441044 executionEnvironment.initializeMemoryManager ();
10451045 DeviceBitfield deviceBitfield (0b11 );
10461046 MockCommandStreamReceiver csr (executionEnvironment, 0 , deviceBitfield);
1047+ auto osContext = std::unique_ptr<OsContext>(OsContext::create (nullptr , 0 ,
1048+ EngineDescriptorHelper::getDefaultDescriptor ({aub_stream::ENGINE_BCS, EngineUsage::Regular})));
1049+ csr.setupContext (*osContext);
1050+
1051+ auto hostPtr = reinterpret_cast <void *>(0x1234 );
1052+ size_t size = 100 ;
1053+ auto temporaryAllocation = std::make_unique<MemoryAllocation>(0 , GraphicsAllocation::AllocationType::EXTERNAL_HOST_PTR, hostPtr, size, 0 , MemoryPool::System4KBPages, MemoryManager::maxOsContextCount);
1054+ temporaryAllocation->updateTaskCount (0u , 0u );
1055+ csr.getInternalAllocationStorage ()->storeAllocationWithTaskCount (std::move (temporaryAllocation), TEMPORARY_ALLOCATION, 2u );
10471056
10481057 csr.mockTagAddress [0 ] = 0u ;
10491058 csr.mockTagAddress [2 ] = 0u ;
@@ -1065,6 +1074,30 @@ TEST(CommandStreamReceiverSimpleTest, givenMultipleActivePartitionsWhenWaitingFo
10651074 CpuIntrinsicsTests::pauseAddress = nullptr ;
10661075}
10671076
1077+ TEST (CommandStreamReceiverSimpleTest, givenEmptyTemporaryAllocationListWhenWaitingForTaskCountForCleaningTemporaryAllocationsThenDoNotWait) {
1078+ MockExecutionEnvironment executionEnvironment;
1079+ executionEnvironment.prepareRootDeviceEnvironments (1 );
1080+ executionEnvironment.initializeMemoryManager ();
1081+ DeviceBitfield deviceBitfield (1 );
1082+ MockCommandStreamReceiver csr (executionEnvironment, 0 , deviceBitfield);
1083+
1084+ csr.mockTagAddress [0 ] = 0u ;
1085+ csr.taskCount = 3u ;
1086+
1087+ VariableBackup<volatile uint32_t *> backupPauseAddress (&CpuIntrinsicsTests::pauseAddress);
1088+ VariableBackup<uint32_t > backupPauseValue (&CpuIntrinsicsTests::pauseValue);
1089+ VariableBackup<uint32_t > backupPauseOffset (&CpuIntrinsicsTests::pauseOffset);
1090+
1091+ CpuIntrinsicsTests::pauseAddress = &csr.mockTagAddress [0 ];
1092+ CpuIntrinsicsTests::pauseValue = 3u ;
1093+
1094+ CpuIntrinsicsTests::pauseCounter = 0 ;
1095+ csr.waitForTaskCountAndCleanTemporaryAllocationList (3u );
1096+ EXPECT_EQ (0u , CpuIntrinsicsTests::pauseCounter);
1097+
1098+ CpuIntrinsicsTests::pauseAddress = nullptr ;
1099+ }
1100+
10681101TEST (CommandStreamReceiverMultiContextTests, givenMultipleCsrsWhenSameResourcesAreUsedThenResidencyIsProperlyHandled) {
10691102 std::unique_ptr<MockDevice> device (MockDevice::createWithNewExecutionEnvironment<MockDevice>(defaultHwInfo.get (), 0u ));
10701103
0 commit comments