Skip to content

Commit 392fb47

Browse files
fix: iterate over each indirect allocation
Related-To: GSD-9450 Signed-off-by: Szymon Morek <[email protected]> Source: e8ee91a
1 parent 8b4fe0a commit 392fb47

File tree

2 files changed

+2
-4
lines changed

2 files changed

+2
-4
lines changed

shared/source/memory_manager/unified_memory_manager.cpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -743,7 +743,6 @@ void SVMAllocsManager::makeIndirectAllocationsResident(CommandStreamReceiver &co
743743
std::unique_lock<std::shared_mutex> lock(mtx);
744744
bool parseAllAllocations = false;
745745
auto entry = indirectAllocationsResidency.find(&commandStreamReceiver);
746-
TaskCountType previousCounter = 0;
747746
if (entry == indirectAllocationsResidency.end()) {
748747
parseAllAllocations = true;
749748

@@ -755,14 +754,13 @@ void SVMAllocsManager::makeIndirectAllocationsResident(CommandStreamReceiver &co
755754
} else {
756755
if (this->allocationsCounter > entry->second.latestResidentObjectId) {
757756
parseAllAllocations = true;
758-
previousCounter = entry->second.latestResidentObjectId;
759757
entry->second.latestResidentObjectId = this->allocationsCounter;
760758
}
761759
entry->second.latestSentTaskCount = taskCount;
762760
}
763761
if (parseAllAllocations) {
764762
auto currentCounter = this->allocationsCounter.load();
765-
for (auto allocationId = static_cast<uint32_t>(previousCounter + 1); allocationId <= currentCounter; allocationId++) {
763+
for (auto allocationId = 1u; allocationId <= currentCounter; allocationId++) {
766764
makeResidentForAllocationsWithId(allocationId, commandStreamReceiver);
767765
}
768766
}

shared/test/unit_test/memory_manager/unified_memory_manager_tests.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -581,7 +581,7 @@ TEST_F(SVMLocalMemoryAllocatorTest, givenInternalAllocationWhenNewAllocationIsCr
581581
// now call with task count 2, first allocation shouldn't be modified
582582
svmManager->makeIndirectAllocationsResident(*csr, 2u);
583583

584-
EXPECT_FALSE(graphicsAllocation->gpuAllocations.getDefaultGraphicsAllocation()->isResident(csr->getOsContext().getContextId()));
584+
EXPECT_TRUE(graphicsAllocation->gpuAllocations.getDefaultGraphicsAllocation()->isResident(csr->getOsContext().getContextId()));
585585
EXPECT_TRUE(graphicsAllocation2->gpuAllocations.getDefaultGraphicsAllocation()->isResident(csr->getOsContext().getContextId()));
586586

587587
svmManager->freeSVMAlloc(ptr);

0 commit comments

Comments
 (0)