fix: update task count when object is always resident

Related-To: NEO-11537

Signed-off-by: Szymon Morek <szymon.morek@intel.com>
This commit is contained in:
Szymon Morek
2024-05-27 13:48:58 +00:00
committed by Compute-Runtime-Automation
parent 5df982a85d
commit 2c2ff5e369
2 changed files with 21 additions and 0 deletions

View File

@@ -170,6 +170,7 @@ void CommandStreamReceiver::makeResident(GraphicsAllocation &gfxAllocation) {
}
}
}
gfxAllocation.updateTaskCount(submissionTaskCount, osContext->getContextId());
gfxAllocation.updateResidencyTaskCount(submissionTaskCount, osContext->getContextId());
}

View File

@@ -5251,6 +5251,26 @@ HWTEST_F(CommandStreamReceiverTest, givenCsrWhenInitializeDeviceWithFirstSubmiss
EXPECT_EQ(1u, commandStreamReceiver.taskCount);
}
HWTEST_F(CommandStreamReceiverTest, givenCsrWhenMakeResidentCalledThenUpdateTaskCountIfObjectIsAlwaysResident) {
auto &csr = pDevice->getUltCommandStreamReceiver<FamilyType>();
auto contextId = csr.getOsContext().getContextId();
MockGraphicsAllocation graphicsAllocation;
csr.makeResident(graphicsAllocation);
auto initialAllocTaskCount = graphicsAllocation.getTaskCount(contextId);
auto csrTaskCount = csr.peekTaskCount();
EXPECT_EQ(initialAllocTaskCount, csr.peekTaskCount() + 1);
graphicsAllocation.updateResidencyTaskCount(GraphicsAllocation::objectAlwaysResident, contextId);
csr.taskCount = 10;
csr.makeResident(graphicsAllocation);
auto updatedTaskCount = graphicsAllocation.getTaskCount(contextId);
csrTaskCount = csr.peekTaskCount();
EXPECT_EQ(updatedTaskCount, csr.peekTaskCount() + 1);
EXPECT_NE(updatedTaskCount, initialAllocTaskCount);
}
using CommandStreamReceiverHwHeaplessTest = Test<DeviceFixture>;
HWTEST_F(CommandStreamReceiverHwHeaplessTest, whenHeaplessCommandStreamReceiverFunctionsAreCalledThenExceptionIsThrown) {