fix: clear residency container when failed to make resident

Related-To: NEO-14143
Signed-off-by: Maciej Plewka <maciej.plewka@intel.com>
This commit is contained in:
Maciej Plewka
2025-05-29 11:53:24 +00:00
committed by Compute-Runtime-Automation
parent c741628b00
commit 577c99fe9c
2 changed files with 20 additions and 1 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2018-2024 Intel Corporation
* Copyright (C) 2018-2025 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -107,6 +107,8 @@ bool WddmResidencyController::makeResidentResidencyAllocations(ResidencyContaine
residencyData->updateCompletionData(currentFence, this->osContextId);
}
}
} else {
allocationsForResidency.clear();
}
return result;

View File

@@ -862,6 +862,23 @@ TEST_F(WddmResidencyControllerWithMockWddmTest, givenMakeResidentFailsWhenCallin
EXPECT_EQ(2u, wddm->makeResidentResult.called);
}
TEST_F(WddmResidencyControllerWithMockWddmTest, givenMakeResidentFailsWhenCallingMakeResidentResidencyAllocationsThenResidencyContainerIsCleared) {
MockWddmAllocation allocation1(gmmHelper);
MockWddmAllocation allocation2(gmmHelper);
MockWddmAllocation allocation3(gmmHelper);
MockWddmAllocation allocation4(gmmHelper);
wddm->makeResidentNumberOfBytesToTrim = 4 * 4096;
wddm->makeResidentStatus = false;
ResidencyContainer residencyPack{&allocation1, &allocation2, &allocation3, &allocation4};
bool requiresBlockingResidencyHandling = true;
bool result = residencyController->makeResidentResidencyAllocations(residencyPack, requiresBlockingResidencyHandling);
EXPECT_FALSE(result);
EXPECT_EQ(residencyPack.size(), 0u);
}
TEST_F(WddmResidencyControllerWithMockWddmTest, givenMakeResidentFailsWhenCallingMakeResidentResidencyAllocationsThenDontMarkTripleAllocationsAsResident) {
MockWddmAllocation allocation1(gmmHelper);
MockWddmAllocation allocation2(gmmHelper);