fix: add missing host ptr assignment increment

Signed-off-by: Lukasz Jobczyk <lukasz.jobczyk@intel.com>
This commit is contained in:
Lukasz Jobczyk
2023-05-22 11:07:09 +00:00
committed by Compute-Runtime-Automation
parent 6a3a90a83f
commit 8e51d9ae90
10 changed files with 40 additions and 4 deletions

View File

@@ -113,7 +113,7 @@ void GraphicsAllocation::prepareHostPtrForResidency(CommandStreamReceiver *csr)
if (hostPtrTaskCountAssignment > 0) {
auto allocTaskCount = getTaskCount(csr->getOsContext().getContextId());
auto currentTaskCount = csr->peekTaskCount() + 1;
if (currentTaskCount > allocTaskCount) {
if (currentTaskCount > allocTaskCount || allocTaskCount == GraphicsAllocation::objectNotResident) {
updateTaskCount(currentTaskCount, csr->getOsContext().getContextId());
hostPtrTaskCountAssignment--;
}

View File

@@ -495,6 +495,20 @@ HWTEST_F(GraphicsAllocationTests, givenGraphicsAllocationAllocTaskCountLowerThan
EXPECT_EQ(graphicsAllocation.updateTaskCountCalleedTimes, calledTimesBefore + 1u);
}
HWTEST_F(GraphicsAllocationTests, givenGraphicsAllocationAllocTaskCountNotUsedLowerThanInCsrThenUpdateTaskCountWasCalled) {
executionEnvironment.initializeMemoryManager();
auto osContext = std::unique_ptr<OsContext>(OsContext::create(nullptr, 0, 0, EngineDescriptorHelper::getDefaultDescriptor()));
MockCommandStreamReceiver csr(executionEnvironment, 0, 1);
csr.osContext = osContext.get();
MockGraphicsAllocationTaskCount graphicsAllocation;
graphicsAllocation.updateTaskCount(GraphicsAllocation::objectNotResident, 0u);
csr.taskCount = 10;
graphicsAllocation.hostPtrTaskCountAssignment = 1;
auto calledTimesBefore = graphicsAllocation.updateTaskCountCalleedTimes;
graphicsAllocation.prepareHostPtrForResidency(&csr);
EXPECT_EQ(graphicsAllocation.updateTaskCountCalleedTimes, calledTimesBefore + 1u);
}
HWTEST_F(GraphicsAllocationTests, givenGraphicsAllocationAllocTaskCountLowerThanInCsrThenAssignmentCountIsDecremented) {
executionEnvironment.initializeMemoryManager();
auto osContext = std::unique_ptr<OsContext>(OsContext::create(nullptr, 0, 0, EngineDescriptorHelper::getDefaultDescriptor()));