Revert "performance: remove not needed logic"

This reverts commit 0ec4e9333d.

Signed-off-by: Michal Mrozek <michal.mrozek@intel.com>
This commit is contained in:
Michal Mrozek
2024-07-30 06:31:25 +00:00
committed by Compute-Runtime-Automation
parent f9228ad11b
commit 5dc01e5764
5 changed files with 94 additions and 0 deletions

View File

@@ -1609,6 +1609,85 @@ TEST(CommandStreamReceiverSimpleTest, givenBaseCsrWhenWritingMemoryThenReturnFal
EXPECT_FALSE(csr.writeMemory(mockAllocation));
}
TEST(CommandStreamReceiverSimpleTest, givenNewResourceFlushDisabledWhenProvidingNeverUsedAllocationTaskCountThenDoNotMarkNewResourceTrue) {
MockExecutionEnvironment executionEnvironment;
executionEnvironment.prepareRootDeviceEnvironments(1);
executionEnvironment.initializeMemoryManager();
DeviceBitfield deviceBitfield(1);
MockCommandStreamReceiver csr(executionEnvironment, 0, deviceBitfield);
MockGraphicsAllocation mockAllocation;
csr.useNewResourceImplicitFlush = false;
csr.newResources = false;
csr.checkForNewResources(10u, GraphicsAllocation::objectNotUsed, mockAllocation);
EXPECT_FALSE(csr.newResources);
}
TEST(CommandStreamReceiverSimpleTest, givenNewResourceFlushEnabledWhenProvidingNeverUsedAllocationTaskCountThenMarkNewResourceTrue) {
MockExecutionEnvironment executionEnvironment;
executionEnvironment.prepareRootDeviceEnvironments(1);
executionEnvironment.initializeMemoryManager();
DeviceBitfield deviceBitfield(1);
MockCommandStreamReceiver csr(executionEnvironment, 0, deviceBitfield);
MockGraphicsAllocation mockAllocation;
csr.useNewResourceImplicitFlush = true;
csr.newResources = false;
csr.checkForNewResources(10u, GraphicsAllocation::objectNotUsed, mockAllocation);
EXPECT_TRUE(csr.newResources);
}
TEST(CommandStreamReceiverSimpleTest, givenNewResourceFlushEnabledWhenProvidingNeverUsedAllocationThatIsKernelIsaThenMarkNewResourceFalse) {
MockExecutionEnvironment executionEnvironment;
executionEnvironment.prepareRootDeviceEnvironments(1);
executionEnvironment.initializeMemoryManager();
DeviceBitfield deviceBitfield(1);
MockCommandStreamReceiver csr(executionEnvironment, 0, deviceBitfield);
MockGraphicsAllocation mockAllocation;
mockAllocation.setAllocationType(AllocationType::kernelIsa);
csr.useNewResourceImplicitFlush = true;
csr.newResources = false;
csr.checkForNewResources(10u, GraphicsAllocation::objectNotUsed, mockAllocation);
EXPECT_FALSE(csr.newResources);
}
TEST(CommandStreamReceiverSimpleTest, givenNewResourceFlushEnabledWhenProvidingAlreadyUsedAllocationTaskCountThenDoNotMarkNewResource) {
MockExecutionEnvironment executionEnvironment;
executionEnvironment.prepareRootDeviceEnvironments(1);
executionEnvironment.initializeMemoryManager();
DeviceBitfield deviceBitfield(1);
MockCommandStreamReceiver csr(executionEnvironment, 0, deviceBitfield);
MockGraphicsAllocation mockAllocation;
csr.useNewResourceImplicitFlush = true;
csr.newResources = false;
csr.checkForNewResources(10u, 10u, mockAllocation);
EXPECT_FALSE(csr.newResources);
}
TEST(CommandStreamReceiverSimpleTest, givenNewResourceFlushEnabledWhenProvidingNewAllocationAndVerbosityEnabledThenProvidePrintOfNewAllocationType) {
DebugManagerStateRestore restore;
debugManager.flags.ProvideVerboseImplicitFlush.set(true);
MockExecutionEnvironment executionEnvironment;
executionEnvironment.prepareRootDeviceEnvironments(1);
executionEnvironment.initializeMemoryManager();
DeviceBitfield deviceBitfield(1);
MockCommandStreamReceiver csr(executionEnvironment, 0, deviceBitfield);
MockGraphicsAllocation mockAllocation;
csr.useNewResourceImplicitFlush = true;
csr.newResources = false;
testing::internal::CaptureStdout();
csr.checkForNewResources(10u, GraphicsAllocation::objectNotUsed, mockAllocation);
EXPECT_TRUE(csr.newResources);
std::string output = testing::internal::GetCapturedStdout();
EXPECT_NE(0u, output.size());
EXPECT_STREQ("New resource detected of type 0\n", output.c_str());
}
TEST(CommandStreamReceiverSimpleTest, givenPrintfTagAllocationAddressFlagEnabledWhenCreatingTagAllocationThenPrintItsAddress) {
DebugManagerStateRestore restore;
debugManager.flags.PrintTagAllocationAddress.set(true);